From ac0fe90caf79490ea318d6e4400b941c1f6e28cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guilherme=20Ara=C3=BAjo?= Date: Mon, 19 May 2025 20:59:40 -0300 Subject: [PATCH 01/17] feat: introduce raw ast linter --- bin/commands/generate.mjs | 14 +- bin/commands/lint.mjs | 28 +-- bin/utils.mjs | 7 +- package-lock.json | 37 +++ package.json | 2 + src/linter/context.mjs | 59 +++++ src/linter/engine.mjs | 30 --- src/linter/index.mjs | 55 +++-- src/linter/rules/index.mjs | 4 +- src/linter/rules/invalid-change-version.mjs | 67 ++++-- src/linter/rules/missing-introduced-in.mjs | 36 +-- src/linter/rules/missing-llm-description.mjs | 61 +++-- src/linter/tests/engine.test.mjs | 44 ---- src/linter/tests/fixtures/entries.mjs | 80 ------- .../invalidChangeVersion-environment.mjs | 41 +++- src/linter/tests/fixtures/issues.mjs | 2 - src/linter/tests/fixtures/report.mjs | 25 ++ src/linter/tests/fixtures/tree.mjs | 4 + src/linter/tests/index.test.mjs | 59 +++++ .../rules/invalid-change-version.test.mjs | 214 +++++++++++++----- .../rules/missing-introduced-in.test.mjs | 84 +++++-- src/linter/types.d.ts | 26 ++- src/linter/utils/find.mjs | 20 ++ src/linter/utils/rules.mjs | 15 ++ src/parsers/markdown.mjs | 6 +- src/utils/parser/index.mjs | 42 +++- src/utils/queries/index.mjs | 9 +- 27 files changed, 685 insertions(+), 386 deletions(-) create mode 100644 src/linter/context.mjs delete mode 100644 src/linter/engine.mjs delete mode 100644 src/linter/tests/engine.test.mjs delete mode 100644 src/linter/tests/fixtures/entries.mjs create mode 100644 src/linter/tests/fixtures/report.mjs create mode 100644 src/linter/tests/fixtures/tree.mjs create mode 100644 src/linter/tests/index.test.mjs create mode 100644 src/linter/utils/find.mjs create mode 100644 src/linter/utils/rules.mjs diff --git a/bin/commands/generate.mjs b/bin/commands/generate.mjs index 6911b7df..a76a1e29 100644 --- a/bin/commands/generate.mjs +++ b/bin/commands/generate.mjs @@ -1,6 +1,5 @@ import { cpus } from 'node:os'; import { resolve } from 'node:path'; -import process from 'node:process'; import { coerce } from 'semver'; @@ -12,7 +11,8 @@ import createGenerator from '../../src/generators.mjs'; import { publicGenerators } from '../../src/generators/index.mjs'; import createNodeReleases from '../../src/releases.mjs'; import { loadAndParse } from '../utils.mjs'; -import { runLint } from './lint.mjs'; +import createLinter from '../../src/linter/index.mjs'; +import { getEnabledRules } from '../../src/linter/utils/rules.mjs'; const availableGenerators = Object.keys(publicGenerators); @@ -123,12 +123,12 @@ export default { * @returns {Promise} */ async action(opts) { - const docs = await loadAndParse(opts.input, opts.ignore); + const linter = opts.skipLint + ? undefined + : createLinter(getEnabledRules(opts.disableRule)); + const docs = await loadAndParse(opts.input, opts.ignore, linter); - if (!opts.skipLint && !runLint(docs)) { - console.error('Lint failed; aborting generation.'); - process.exit(1); - } + linter.report(); const { runGenerators } = createGenerator(docs); const { getAllMajors } = createNodeReleases(opts.changelog); diff --git a/bin/commands/lint.mjs b/bin/commands/lint.mjs index a0abafe2..e6aaf557 100644 --- a/bin/commands/lint.mjs +++ b/bin/commands/lint.mjs @@ -4,6 +4,7 @@ import createLinter from '../../src/linter/index.mjs'; import reporters from '../../src/linter/reporters/index.mjs'; import rules from '../../src/linter/rules/index.mjs'; import { loadAndParse } from '../utils.mjs'; +import { getEnabledRules } from '../../src/linter/utils/rules.mjs'; const availableRules = Object.keys(rules); const availableReporters = Object.keys(reporters); @@ -17,22 +18,6 @@ const availableReporters = Object.keys(reporters); * @property {keyof reporters} reporter - Reporter for linter output. */ -/** - * Run the linter on parsed documentation. - * @param {ApiDocMetadataEntry[]} docs - Parsed documentation objects. - * @param {LinterOptions} options - Linter configuration options. - * @returns {boolean} - True if no errors, false otherwise. - */ -export function runLint( - docs, - { disableRule = [], dryRun = false, reporter = 'console' } = {} -) { - const linter = createLinter(dryRun, disableRule); - linter.lintAll(docs); - linter.report(reporter); - return !linter.hasError(); -} - /** * @type {import('../utils.mjs').Command} */ @@ -95,9 +80,14 @@ export default { */ async action(opts) { try { - const docs = await loadAndParse(opts.input, opts.ignore); - const success = runLint(docs, opts); - process.exitCode = success ? 0 : 1; + const rules = getEnabledRules(opts.disableRule); + const linter = createLinter(rules, opts.dryRun); + + await loadAndParse(opts.input, opts.ignore, linter); + + linter.report(); + + process.exitCode = linter.hasError() ? 1 : 0; } catch (error) { console.error('Error running the linter:', error); process.exitCode = 1; diff --git a/bin/utils.mjs b/bin/utils.mjs index b32a0929..13eec8dc 100644 --- a/bin/utils.mjs +++ b/bin/utils.mjs @@ -9,7 +9,7 @@ import createMarkdownParser from '../src/parsers/markdown.mjs'; */ export const lazy = factory => { let instance; - return () => (instance ??= factory()); + return args => (instance ??= factory(args)); }; // Instantiate loader and parser once to reuse, @@ -23,11 +23,12 @@ const parser = lazy(createMarkdownParser); * Load and parse markdown API docs. * @param {string[]} input - Glob patterns for input files. * @param {string[]} [ignore] - Glob patterns to ignore. + * @param {import('../src/linter/types').Linter} [linter] - Linter instance * @returns {Promise} - Parsed documentation objects. */ -export async function loadAndParse(input, ignore) { +export async function loadAndParse(input, ignore, linter) { const files = await loader().loadFiles(input, ignore); - return parser().parseApiDocs(files); + return parser(linter).parseApiDocs(files); } /** diff --git a/package-lock.json b/package-lock.json index 5aee468d..5d3cebd7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -28,7 +28,9 @@ "shiki": "^3.2.1", "unified": "^11.0.5", "unist-builder": "^4.0.0", + "unist-util-find": "^3.0.0", "unist-util-find-after": "^5.0.0", + "unist-util-find-before": "^4.0.1", "unist-util-position": "^5.0.0", "unist-util-remove": "^4.0.0", "unist-util-select": "^5.1.0", @@ -2073,6 +2075,12 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/lodash.iteratee": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/lodash.iteratee/-/lodash.iteratee-4.7.0.tgz", + "integrity": "sha512-yv3cSQZmfpbIKo4Yo45B1taEvxjNvcpF1CEOc0Y6dEyvhPIfEJE3twDwPgWTPQubcSgXyBwBKG6wpQvWMDOf6Q==", + "license": "MIT" + }, "node_modules/lodash.merge": { "version": "4.6.2", "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", @@ -4021,6 +4029,21 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/unist-util-find": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/unist-util-find/-/unist-util-find-3.0.0.tgz", + "integrity": "sha512-T7ZqS7immLjYyC4FCp2hDo3ksZ1v+qcbb+e5+iWxc2jONgHOLXPCpms1L8VV4hVxCXgWTxmBHDztuEZFVwC+Gg==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "lodash.iteratee": "^4.0.0", + "unist-util-visit": "^5.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/unist-util-find-after": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/unist-util-find-after/-/unist-util-find-after-5.0.0.tgz", @@ -4035,6 +4058,20 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/unist-util-find-before": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/unist-util-find-before/-/unist-util-find-before-4.0.1.tgz", + "integrity": "sha512-hfpCNqPbCOseOjHU8oBkRXM8gDQ++Ua3dN7sDYz7VJ+1alt+yd/I+ECZDhv1aqpJ1x47AHbzP/xA0jWf4omAIw==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-is": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/unist-util-is": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-6.0.0.tgz", diff --git a/package.json b/package.json index 734ac400..befe5f90 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,9 @@ "shiki": "^3.2.1", "unified": "^11.0.5", "unist-builder": "^4.0.0", + "unist-util-find": "^3.0.0", "unist-util-find-after": "^5.0.0", + "unist-util-find-before": "^4.0.1", "unist-util-position": "^5.0.0", "unist-util-remove": "^4.0.0", "unist-util-select": "^5.1.0", diff --git a/src/linter/context.mjs b/src/linter/context.mjs new file mode 100644 index 00000000..5603071a --- /dev/null +++ b/src/linter/context.mjs @@ -0,0 +1,59 @@ +'use strict'; + +/** + * Creates a linting context for a given file and AST tree. + * + * @param {import('vfile').VFile} file + * @param {import('mdast').Root} tree + * @returns {import('./types').LintContext} + */ +const createContext = (file, tree) => { + /** + * Lint issues reported during validation. + * + * @type {import('./types').LintIssue[]} + */ + const issues = []; + + /** + * Reports a lint issue. + * + * @param {import('./types').ReportIssueProps} issue + * @returns {void} + */ + const report = ({ level, message, position }) => { + /** + * @type {import('./types').LintIssueLocation} + */ + const location = { + path: file.path, + }; + + if (position) { + location.position = position; + } + + issues.push({ + level, + message, + location, + }); + }; + + /** + * Gets all reported issues. + * + * @returns {import('./types').LintIssue[]} + */ + const getIssues = () => { + return issues; + }; + + return { + tree, + report, + getIssues, + }; +}; + +export default createContext; diff --git a/src/linter/engine.mjs b/src/linter/engine.mjs deleted file mode 100644 index 9ae164c7..00000000 --- a/src/linter/engine.mjs +++ /dev/null @@ -1,30 +0,0 @@ -'use strict'; - -/** - * Creates a linter engine instance to validate ApiDocMetadataEntry entries - * - * @param {import('./types').LintRule[]} rules Lint rules to validate the entries against - */ -const createLinterEngine = rules => { - /** - * Validates an array of ApiDocMetadataEntry entries against all defined rules - * - * @param {ApiDocMetadataEntry[]} entries - * @returns {import('./types').LintIssue[]} - */ - const lintAll = entries => { - const issues = []; - - for (const rule of rules) { - issues.push(...rule(entries)); - } - - return issues; - }; - - return { - lintAll, - }; -}; - -export default createLinterEngine; diff --git a/src/linter/index.mjs b/src/linter/index.mjs index 451d6ee3..1f94aa0b 100644 --- a/src/linter/index.mjs +++ b/src/linter/index.mjs @@ -1,52 +1,48 @@ 'use strict'; -import createLinterEngine from './engine.mjs'; +import createContext from './context.mjs'; import reporters from './reporters/index.mjs'; -import rules from './rules/index.mjs'; /** - * Creates a linter instance to validate ApiDocMetadataEntry entries + * Creates a linter instance to validate API documentation ASTs against a + * defined set of rules. * - * @param {boolean} dryRun Whether to run the engine in dry-run mode - * @param {string[]} disabledRules List of disabled rules names + * @param {import('./types').LintRule[]} rules - Lint rules to apply + * @param {boolean} [dryRun] - If true, the linter runs without reporting + * @returns {import('./types').Linter} */ -const createLinter = (dryRun, disabledRules) => { +const createLinter = (rules, dryRun = false) => { /** - * Retrieves all enabled rules - * - * @returns {import('./types').LintRule[]} - */ - const getEnabledRules = () => { - return Object.entries(rules) - .filter(([ruleName]) => !disabledRules.includes(ruleName)) - .map(([, rule]) => rule); - }; - - const engine = createLinterEngine(getEnabledRules(disabledRules)); - - /** - * Lint issues found during validations + * Lint issues collected during validations. * * @type {Array} */ const issues = []; /** - * Lints all entries using the linter engine + * Lints a API doc and collects issues. * - * @param entries + * @param {import('vfile').VFile} file + * @param {import('mdast').Root} tree + * @returns {void} */ - const lintAll = entries => { - issues.push(...engine.lintAll(entries)); + const lint = (file, tree) => { + const context = createContext(file, tree); + + for (const rule of rules) { + rule(context); + } + + issues.push(...context.getIssues()); }; /** - * Reports found issues using the specified reporter + * Reports collected issues using the specified reporter. * - * @param {keyof typeof reporters} reporterName Reporter name + * @param {keyof typeof reporters} [reporterName] Reporter name * @returns {void} */ - const report = reporterName => { + const report = (reporterName = 'console') => { if (dryRun) { return; } @@ -59,7 +55,7 @@ const createLinter = (dryRun, disabledRules) => { }; /** - * Checks if any error-level issues were found during linting + * Checks if any error-level issues were collected. * * @returns {boolean} */ @@ -68,7 +64,8 @@ const createLinter = (dryRun, disabledRules) => { }; return { - lintAll, + issues, + lint, report, hasError, }; diff --git a/src/linter/rules/index.mjs b/src/linter/rules/index.mjs index bb06a4a5..226e912c 100644 --- a/src/linter/rules/index.mjs +++ b/src/linter/rules/index.mjs @@ -1,6 +1,6 @@ 'use strict'; -import { duplicateStabilityNodes } from './duplicate-stability-nodes.mjs'; +// import { duplicateStabilityNodes } from './duplicate-stability-nodes.mjs'; import { invalidChangeVersion } from './invalid-change-version.mjs'; import { missingIntroducedIn } from './missing-introduced-in.mjs'; import { missingLlmDescription } from './missing-llm-description.mjs'; @@ -9,7 +9,7 @@ import { missingLlmDescription } from './missing-llm-description.mjs'; * @type {Record} */ export default { - 'duplicate-stability-nodes': duplicateStabilityNodes, + // 'duplicate-stability-nodes': duplicateStabilityNodes, 'invalid-change-version': invalidChangeVersion, 'missing-introduced-in': missingIntroducedIn, 'missing-llm-description': missingLlmDescription, diff --git a/src/linter/rules/invalid-change-version.mjs b/src/linter/rules/invalid-change-version.mjs index 0e69a5c0..21d00916 100644 --- a/src/linter/rules/invalid-change-version.mjs +++ b/src/linter/rules/invalid-change-version.mjs @@ -1,6 +1,14 @@ -import { LINT_MESSAGES } from '../constants.mjs'; import { valid, parse } from 'semver'; import { env } from 'node:process'; +import { visit } from 'unist-util-visit'; +import yaml from 'yaml'; + +import createQueries from '../../utils/queries/index.mjs'; +import { + extractYamlContent, + normalizeYamlSyntax, +} from '../../utils/parser/index.mjs'; +import { LINT_MESSAGES } from '../constants.mjs'; const NODE_RELEASED_VERSIONS = env.NODE_RELEASED_VERSIONS?.split(','); @@ -47,23 +55,50 @@ const isInvalid = NODE_RELEASED_VERSIONS : (version, _, { length }) => !(isValidReplaceMe(version, length) || valid(version)); +/** + * + * @param version + */ +const normalizeVersion = version => + Array.isArray(version) ? version : [version]; + /** * Identifies invalid change versions from metadata entries. * - * @param {ApiDocMetadataEntry[]} entries - Metadata entries to check. - * @returns {import('../types').LintIssue[]} List of detected lint issues. + * @param {import('../types.d.ts').LintContext} context + * @returns {void} */ -export const invalidChangeVersion = entries => - entries.flatMap(({ changes, api_doc_source, yaml_position }) => - changes.flatMap(({ version }) => - (Array.isArray(version) ? version : [version]) +export const invalidChangeVersion = context => { + visit(context.tree, createQueries.UNIST.isYamlNode, node => { + const yamlContent = extractYamlContent(node); + + const normalizedYaml = normalizeYamlSyntax(yamlContent); + + // TODO: Use YAML AST to provide better issues positions + /** + * @type {ApiDocRawMetadataEntry} + */ + const { changes } = yaml.parse(normalizedYaml); + + if (!changes) { + return; + } + + changes.forEach(({ version }) => + normalizeVersion(version) .filter(isInvalid) - .map(version => ({ - level: 'error', - message: version - ? LINT_MESSAGES.invalidChangeVersion.replace('{{version}}', version) - : LINT_MESSAGES.missingChangeVersion, - location: { path: api_doc_source, position: yaml_position }, - })) - ) - ); + .forEach(version => + context.report({ + level: 'error', + message: version + ? LINT_MESSAGES.invalidChangeVersion.replace( + '{{version}}', + version + ) + : LINT_MESSAGES.missingChangeVersion, + position: node.position, + }) + ) + ); + }); +}; diff --git a/src/linter/rules/missing-introduced-in.mjs b/src/linter/rules/missing-introduced-in.mjs index 785bc6b1..e2e99a37 100644 --- a/src/linter/rules/missing-introduced-in.mjs +++ b/src/linter/rules/missing-introduced-in.mjs @@ -1,26 +1,28 @@ +'use strict'; + import { LINT_MESSAGES } from '../constants.mjs'; +import { findTopLevelEntry } from '../utils/find.mjs'; + +const regex = //; /** - * Checks if `introduced_in` field is missing + * Checks if `introduced_in` field is missing in the top-level entry. * - * @param {ApiDocMetadataEntry[]} entries - * @returns {Array} + * @param {import('../types.d.ts').LintContext} context + * @returns {void} */ -export const missingIntroducedIn = entries => { - const issues = []; - - for (const entry of entries) { - // Early continue if not a top-level heading or if introduced_in exists - if (entry.heading.depth !== 1 || entry.introduced_in) continue; +export const missingIntroducedIn = context => { + const introducedIn = findTopLevelEntry( + context.tree, + node => node.type === 'html' && regex.test(node.value) + ); - issues.push({ - level: 'info', - message: LINT_MESSAGES.missingIntroducedIn, - location: { - path: entry.api_doc_source, - }, - }); + if (introducedIn) { + return; } - return issues; + return context.report({ + level: 'info', + message: LINT_MESSAGES.missingIntroducedIn, + }); }; diff --git a/src/linter/rules/missing-llm-description.mjs b/src/linter/rules/missing-llm-description.mjs index 18d5b1d5..a0608844 100644 --- a/src/linter/rules/missing-llm-description.mjs +++ b/src/linter/rules/missing-llm-description.mjs @@ -1,47 +1,38 @@ import { LINT_MESSAGES } from '../constants.mjs'; +import { findTopLevelEntry } from '../utils/find.mjs'; + +const regex = //; /** * Checks if a top-level entry is missing a llm_description field or a paragraph * node. * - * @param {ApiDocMetadataEntry[]} entries - * @returns {Array} + * @param {import('../types.d.ts').LintContext} context + * @returns {void} */ -export const missingLlmDescription = entries => { - return entries - .filter(entry => { - // Only process top-level headings - if (entry.heading.depth !== 1) { - return false; - } +export const missingLlmDescription = context => { + const llmDescription = findTopLevelEntry( + context.tree, + node => node.type === 'html' && regex.test(node.value) + ); - // Skip entries that have an llm_description property - if (entry.llm_description !== undefined) { - return false; - } + if (llmDescription) { + return; + } - const hasParagraph = entry.content.children.some( - node => node.type === 'paragraph' - ); + // Check if there is a paragraph node in the top-level entry that can be used + // as fallback for llm_description + const paragraph = findTopLevelEntry( + context.tree, + node => node.type === 'paragraph' + ); - // Skip entries that contain a paragraph that can be used as a fallback. - if (hasParagraph) { - return false; - } + if (paragraph) { + return false; + } - return true; - }) - .map(entry => mapToMissingEntryWarning(entry)); + context.report({ + level: 'warn', + message: LINT_MESSAGES.missingLlmDescription, + }); }; - -/** - * Maps a entry to a warning for missing llm description. - * - * @param {ApiDocMetadataEntry} entry - * @returns {import('../types.d.ts').LintIssue} - */ -const mapToMissingEntryWarning = entry => ({ - level: 'warn', - message: LINT_MESSAGES.missingLlmDescription, - location: { path: entry.api_doc_source }, -}); diff --git a/src/linter/tests/engine.test.mjs b/src/linter/tests/engine.test.mjs deleted file mode 100644 index ac33921f..00000000 --- a/src/linter/tests/engine.test.mjs +++ /dev/null @@ -1,44 +0,0 @@ -import { describe, mock, it } from 'node:test'; -import assert from 'node:assert/strict'; -import createLinterEngine from '../engine.mjs'; -import { assertEntry } from './fixtures/entries.mjs'; -import { errorIssue, infoIssue, warnIssue } from './fixtures/issues.mjs'; - -describe('createLinterEngine', () => { - it('should call each rule with the provided entry', () => { - const rule1 = mock.fn(() => []); - const rule2 = mock.fn(() => []); - - const engine = createLinterEngine([rule1, rule2]); - - engine.lintAll([assertEntry]); - - assert.strictEqual(rule1.mock.callCount(), 1); - assert.strictEqual(rule2.mock.callCount(), 1); - - assert.deepEqual(rule1.mock.calls[0].arguments, [[assertEntry]]); - assert.deepEqual(rule2.mock.calls[0].arguments, [[assertEntry]]); - }); - - it('should return the aggregated issues from all rules', () => { - const rule1 = mock.fn(() => [infoIssue, warnIssue]); - const rule2 = mock.fn(() => [errorIssue]); - - const engine = createLinterEngine([rule1, rule2]); - - const issues = engine.lintAll([assertEntry]); - - assert.equal(issues.length, 3); - assert.deepEqual(issues, [infoIssue, warnIssue, errorIssue]); - }); - - it('should return an empty array when no issues are found', () => { - const rule = () => []; - - const engine = createLinterEngine([rule]); - - const issues = engine.lintAll([assertEntry]); - - assert.deepEqual(issues, []); - }); -}); diff --git a/src/linter/tests/fixtures/entries.mjs b/src/linter/tests/fixtures/entries.mjs deleted file mode 100644 index 1319c18e..00000000 --- a/src/linter/tests/fixtures/entries.mjs +++ /dev/null @@ -1,80 +0,0 @@ -/** - * @type {ApiDocMetadataEntry} - */ -export const assertEntry = { - api: 'assert', - slug: 'assert', - source_link: 'lib/assert.js', - api_doc_source: 'doc/api/assert.md', - added_in: undefined, - deprecated_in: undefined, - removed_in: undefined, - n_api_version: undefined, - changes: [ - { - version: 'v9.9.0', - 'pr-url': 'https://github.com/nodejs/node/pull/17615', - description: 'Added error diffs to the strict assertion mode.', - }, - { - version: 'v9.9.0', - 'pr-url': 'https://github.com/nodejs/node/pull/17002', - description: 'Added strict assertion mode to the assert module.', - }, - { - version: ['v13.9.0', 'v12.16.2'], - 'pr-url': 'https://github.com/nodejs/node/pull/31635', - description: - 'Changed "strict mode" to "strict assertion mode" and "legacy mode" to "legacy assertion mode" to avoid confusion with the more usual meaning of "strict mode".', - }, - { - version: 'v15.0.0', - 'pr-url': 'https://github.com/nodejs/node/pull/34001', - description: "Exposed as `require('node:assert/strict')`.", - }, - { - version: 'REPLACEME', - 'pr-url': 'https://github.com/nodejs/node/pull/12345', - description: 'This is a test entry.', - }, - ], - heading: { - type: 'heading', - depth: 1, - children: [ - { - type: 'text', - value: 'Assert', - position: { - start: { line: 1, column: 3, offset: 2 }, - end: { line: 1, column: 9, offset: 8 }, - }, - }, - ], - position: { - start: { line: 1, column: 1, offset: 0 }, - end: { line: 1, column: 9, offset: 8 }, - }, - data: { - text: 'Assert', - name: 'Assert', - depth: 1, - slug: 'assert', - type: 'property', - }, - }, - stability: { - type: 'root', - children: [], - }, - content: { - type: 'root', - children: [], - }, - tags: [], - introduced_in: 'v0.1.21', - yaml_position: { - start: { line: 7, column: 1, offset: 103 }, - end: { line: 7, column: 35, offset: 137 }, - }, -}; diff --git a/src/linter/tests/fixtures/invalidChangeVersion-environment.mjs b/src/linter/tests/fixtures/invalidChangeVersion-environment.mjs index cbb4d0ca..2aa688bb 100644 --- a/src/linter/tests/fixtures/invalidChangeVersion-environment.mjs +++ b/src/linter/tests/fixtures/invalidChangeVersion-environment.mjs @@ -1,15 +1,36 @@ import { invalidChangeVersion } from '../../rules/invalid-change-version.mjs'; import { deepEqual } from 'node:assert'; -import { assertEntry } from './entries.mjs'; - -const issues = invalidChangeVersion([ - { - ...assertEntry, - changes: [ - ...assertEntry.changes, - { version: ['SOME_OTHER_RELEASED_VERSION', 'v0.1.2'] }, +import dedent from 'dedent'; +import { mock } from 'node:test'; + +const yamlContent = dedent` +`; + +const context = { + tree: { + type: 'root', + children: [ + { + type: 'html', + value: yamlContent, + position: { + start: { line: 1, column: 1, offset: 1 }, + end: { line: 1, column: 1, offset: 1 }, + }, + }, ], }, -]); + report: mock.fn(), + getIssues: mock.fn(), +}; + +invalidChangeVersion(context); -deepEqual(issues, []); +deepEqual(context.report.mock.callCount(), 0); diff --git a/src/linter/tests/fixtures/issues.mjs b/src/linter/tests/fixtures/issues.mjs index 1546e8bc..b52678ba 100644 --- a/src/linter/tests/fixtures/issues.mjs +++ b/src/linter/tests/fixtures/issues.mjs @@ -1,5 +1,3 @@ -// @ts-check - /** * @type {import('../../types').LintIssue} */ diff --git a/src/linter/tests/fixtures/report.mjs b/src/linter/tests/fixtures/report.mjs new file mode 100644 index 00000000..32128e4e --- /dev/null +++ b/src/linter/tests/fixtures/report.mjs @@ -0,0 +1,25 @@ +/** + * @type {import('../../types').ReportIssueProps} + */ +export const infoReport = { + level: 'info', + message: 'This is a INFO issue', +}; + +/** + * @type {import('../../types').ReportIssueProps} + */ +export const warnReport = { + level: 'warn', + message: 'This is a WARN issue', + position: { start: { line: 1, column: 1 }, end: { line: 1, column: 2 } }, +}; + +/** + * @type {import('../../types').ReportIssueProps} + */ +export const errorReport = { + level: 'error', + message: 'This is a ERROR issue', + position: { start: { line: 1, column: 1 }, end: { line: 1, column: 2 } }, +}; diff --git a/src/linter/tests/fixtures/tree.mjs b/src/linter/tests/fixtures/tree.mjs new file mode 100644 index 00000000..d1fce2ca --- /dev/null +++ b/src/linter/tests/fixtures/tree.mjs @@ -0,0 +1,4 @@ +export const emptyTree = { + type: 'root', + children: [], +}; diff --git a/src/linter/tests/index.test.mjs b/src/linter/tests/index.test.mjs new file mode 100644 index 00000000..2810e37d --- /dev/null +++ b/src/linter/tests/index.test.mjs @@ -0,0 +1,59 @@ +import { describe, mock, it } from 'node:test'; +import assert from 'node:assert/strict'; +import createLinter from '../index.mjs'; +import { errorIssue, infoIssue, warnIssue } from './fixtures/issues.mjs'; +import { VFile } from 'vfile'; +import createContext from '../context.mjs'; +import { errorReport, infoReport, warnReport } from './fixtures/report.mjs'; +import { emptyTree } from './fixtures/tree.mjs'; + +describe('createLinter', () => { + it('should call each rule with context', t => { + const context = { + tree: emptyTree, + report: () => {}, + getIssues: () => [], + }; + + t.mock.fn(createContext).mock.mockImplementation(() => context); + + const rule1 = mock.fn(() => []); + const rule2 = mock.fn(() => []); + + const linter = createLinter([rule1, rule2]); + + linter.lint(new VFile({ path: 'doc/api/test.md' }), emptyTree); + + assert.strictEqual(rule1.mock.callCount(), 1); + assert.strictEqual(rule2.mock.callCount(), 1); + + // assert.deepEqual(rule1.mock.calls[0].arguments, [context]); + // assert.deepEqual(rule2.mock.calls[0].arguments, [context]); + }); + + it('should return the aggregated issues from all rules', () => { + const rule1 = mock.fn(ctx => { + ctx.report(infoReport); + ctx.report(warnReport); + }); + + const rule2 = mock.fn(ctx => ctx.report(errorReport)); + + const linter = createLinter([rule1, rule2]); + + linter.lint(new VFile({ path: 'doc/api/test.md' }), emptyTree); + + assert.equal(linter.issues.length, 3); + assert.deepEqual(linter.issues, [infoIssue, warnIssue, errorIssue]); + }); + + it('should return an empty array when no issues are found', () => { + const rule = () => []; + + const linter = createLinter([rule]); + + linter.lint(new VFile({ path: 'doc/api/test.md' }), emptyTree); + + assert.deepEqual(linter.issues, []); + }); +}); diff --git a/src/linter/tests/rules/invalid-change-version.test.mjs b/src/linter/tests/rules/invalid-change-version.test.mjs index 2b7fe370..2be58d11 100644 --- a/src/linter/tests/rules/invalid-change-version.test.mjs +++ b/src/linter/tests/rules/invalid-change-version.test.mjs @@ -1,37 +1,85 @@ -import { describe, it } from 'node:test'; +import { describe, it, mock } from 'node:test'; import { invalidChangeVersion } from '../../rules/invalid-change-version.mjs'; -import { deepEqual, strictEqual } from 'node:assert'; -import { assertEntry } from '../fixtures/entries.mjs'; +import { deepStrictEqual, strictEqual } from 'node:assert'; +import dedent from 'dedent'; import { spawnSync } from 'node:child_process'; -import { fileURLToPath } from 'node:url'; import { execPath } from 'node:process'; +import { fileURLToPath } from 'node:url'; describe('invalidChangeVersion', () => { - it('should return an empty array if all change versions are non-empty', () => { - const issues = invalidChangeVersion([assertEntry]); + it('should not report if all change versions are non-empty', () => { + const yamlContent = dedent` +`; + + const context = { + tree: { + type: 'root', + children: [ + { + type: 'html', + value: yamlContent, + }, + ], + }, + report: mock.fn(), + getIssues: mock.fn(), + }; + + invalidChangeVersion(context); - deepEqual(issues, []); + strictEqual(context.report.mock.callCount(), 0); }); - it('should return an issue if a change version is missing', () => { - const issues = invalidChangeVersion([ - { - ...assertEntry, - changes: [...assertEntry.changes, { version: undefined }], + it('should report an issue if a change version is missing', () => { + const yamlContent = dedent` +`; + + const context = { + tree: { + type: 'root', + children: [ + { + type: 'html', + value: yamlContent, + position: { + start: { line: 1, column: 1, offset: 1 }, + end: { line: 1, column: 1, offset: 1 }, + }, + }, + ], }, - ]); + report: mock.fn(), + getIssues: mock.fn(), + }; + + invalidChangeVersion(context); + + strictEqual(context.report.mock.callCount(), 1); + + const call = context.report.mock.calls[0]; - deepEqual(issues, [ + deepStrictEqual(call.arguments, [ { level: 'error', - location: { - path: 'doc/api/assert.md', - position: { - end: { column: 35, line: 7, offset: 137 }, - start: { column: 1, line: 7, offset: 103 }, - }, - }, message: 'Missing version field in the API doc entry', + position: { + start: { line: 1, column: 1, offset: 1 }, + end: { line: 1, column: 1, offset: 1 }, + }, }, ]); }); @@ -66,57 +114,119 @@ describe('invalidChangeVersion', () => { }); it('should return an empty array if all change versions are valid', () => { - deepEqual(invalidChangeVersion([assertEntry]), []); + const yamlContent = dedent` +`; + + const context = { + tree: { + type: 'root', + children: [ + { + type: 'html', + value: yamlContent, + }, + ], + }, + report: mock.fn(), + getIssues: mock.fn(), + }; + + invalidChangeVersion(context); + + strictEqual(context.report.mock.callCount(), 0); }); it('should return an issue if a change version is invalid', () => { - const issues = invalidChangeVersion([ - { - ...assertEntry, - changes: [ - ...assertEntry.changes, - { version: ['v13.9.0', 'INVALID_VERSION'] }, + const yamlContent = dedent` +`; + + const context = { + tree: { + type: 'root', + children: [ + { + type: 'html', + value: yamlContent, + position: { + start: { column: 1, line: 7, offset: 103 }, + end: { column: 35, line: 7, offset: 137 }, + }, + }, ], }, - ]); + report: mock.fn(), + getIssues: mock.fn(), + }; - deepEqual(issues, [ + invalidChangeVersion(context); + strictEqual(context.report.mock.callCount(), 1); + const call = context.report.mock.calls[0]; + deepStrictEqual(call.arguments, [ { level: 'error', - location: { - path: 'doc/api/assert.md', - position: { - start: { column: 1, line: 7, offset: 103 }, - end: { column: 35, line: 7, offset: 137 }, - }, - }, message: 'Invalid version number: INVALID_VERSION', + position: { + start: { column: 1, line: 7, offset: 103 }, + end: { column: 35, line: 7, offset: 137 }, + }, }, ]); }); it('should return an issue if a change version contains a REPLACEME and a version', () => { - const issues = invalidChangeVersion([ - { - ...assertEntry, - changes: [ - ...assertEntry.changes, - { version: ['v24.0.0', 'REPLACEME'] }, + const yamlContent = dedent` +`; + + const context = { + tree: { + type: 'root', + children: [ + { + type: 'html', + value: yamlContent, + position: { + start: { column: 1, line: 7, offset: 103 }, + end: { column: 35, line: 7, offset: 137 }, + }, + }, ], }, - ]); + report: mock.fn(), + getIssues: mock.fn(), + }; - deepEqual(issues, [ + invalidChangeVersion(context); + strictEqual(context.report.mock.callCount(), 1); + const call = context.report.mock.calls[0]; + deepStrictEqual(call.arguments, [ { level: 'error', - location: { - path: 'doc/api/assert.md', - position: { - start: { column: 1, line: 7, offset: 103 }, - end: { column: 35, line: 7, offset: 137 }, - }, - }, message: 'Invalid version number: REPLACEME', + position: { + start: { column: 1, line: 7, offset: 103 }, + end: { column: 35, line: 7, offset: 137 }, + }, }, ]); }); diff --git a/src/linter/tests/rules/missing-introduced-in.test.mjs b/src/linter/tests/rules/missing-introduced-in.test.mjs index 4671a8b2..7d36ff0e 100644 --- a/src/linter/tests/rules/missing-introduced-in.test.mjs +++ b/src/linter/tests/rules/missing-introduced-in.test.mjs @@ -1,40 +1,80 @@ -import { describe, it } from 'node:test'; +import { describe, it, mock } from 'node:test'; import { missingIntroducedIn } from '../../rules/missing-introduced-in.mjs'; -import { deepEqual } from 'assert'; -import { assertEntry } from '../fixtures/entries.mjs'; +import { deepStrictEqual, strictEqual } from 'assert'; describe('missingIntroducedIn', () => { - it('should return an empty array if the introduced_in field is not missing', () => { - const issues = missingIntroducedIn([assertEntry]); + it('should not report if the introduced_in field is not missing', () => { + const context = { + tree: { + type: 'root', + children: [ + { + type: 'html', + value: '', + }, + ], + }, + report: mock.fn(), + getIssues: mock.fn(), + }; + + missingIntroducedIn(context); - deepEqual(issues, []); + strictEqual(context.report.mock.callCount(), 0); }); - it('should return an empty array if the heading depth is not equal to 1', () => { - const issues = missingIntroducedIn([ - { - ...assertEntry, - heading: { ...assertEntry.heading, depth: 2 }, + it('should report an issue if the introduced_in field is missing in the first entry', () => { + const context = { + tree: { + type: 'root', + children: [ + { + type: 'heading', + depth: 2, + }, + { + type: 'html', + value: '', + }, + ], }, - ]); + report: mock.fn(), + getIssues: mock.fn(), + }; - deepEqual(issues, []); - }); + missingIntroducedIn(context); + + strictEqual(context.report.mock.callCount(), 1); - it('should return an issue if the introduced_in property is missing', () => { - const issues = missingIntroducedIn([ + const call = context.report.mock.calls[0]; + + deepStrictEqual(call.arguments, [ { - ...assertEntry, - introduced_in: undefined, + level: 'info', + message: "Missing 'introduced_in' field in the API doc entry", }, ]); + }); + + it('should report an issue if the introduced_in property is missing', () => { + const context = { + tree: { + type: 'root', + children: [], + }, + report: mock.fn(), + getIssues: mock.fn(), + }; + + missingIntroducedIn(context); + + strictEqual(context.report.mock.callCount(), 1); + + const call = context.report.mock.calls[0]; - deepEqual(issues, [ + deepStrictEqual(call.arguments, [ { level: 'info', - location: { - path: 'doc/api/assert.md', - }, message: "Missing 'introduced_in' field in the API doc entry", }, ]); diff --git a/src/linter/types.d.ts b/src/linter/types.d.ts index cd236513..9466d668 100644 --- a/src/linter/types.d.ts +++ b/src/linter/types.d.ts @@ -1,4 +1,7 @@ +import { Root } from 'mdast'; import { Position } from 'unist'; +import reporters from './reporters/index.mjs'; +import { VFile } from 'vfile'; export type IssueLevel = 'info' | 'warn' | 'error'; @@ -13,6 +16,25 @@ export interface LintIssue { location: LintIssueLocation; } -type LintRule = (input: ApiDocMetadataEntry[]) => LintIssue[]; +type LintRule = (context: LintContext) => void; -export type Reporter = (msg: LintIssue) => void; +export type Reporter = (message: LintIssue) => void; + +export interface Linter { + readonly issues: LintIssue[]; + lint: (file: VFile, tree: Root) => void; + report: (reporterName: keyof typeof reporters) => void; + hasError: () => boolean; +} + +export interface ReportIssueProps { + level: IssueLevel; + message: string; + position?: Position; +} + +export interface LintContext { + readonly tree: Root; + report(issue: ReportIssueProps): void; + getIssues(): LintIssue[]; +} diff --git a/src/linter/utils/find.mjs b/src/linter/utils/find.mjs new file mode 100644 index 00000000..3da03e53 --- /dev/null +++ b/src/linter/utils/find.mjs @@ -0,0 +1,20 @@ +import { find } from 'unist-util-find'; +import { findBefore } from 'unist-util-find-before'; + +/** + * Finds the first node that matches the condition before the first h2 heading, + * this area is considered the top-level section of the tree + * + * @param {import('mdast').Node} node + * @param {import('unist-util-find').TestFn} condition + */ +export const findTopLevelEntry = (node, condition) => { + const h2 = find(node, { type: 'heading', depth: 2 }); + + // If there isn't h2, search the entire tree + if (!h2) { + return find(node, condition); + } + + return findBefore(node, h2, condition); +}; diff --git a/src/linter/utils/rules.mjs b/src/linter/utils/rules.mjs new file mode 100644 index 00000000..22479f75 --- /dev/null +++ b/src/linter/utils/rules.mjs @@ -0,0 +1,15 @@ +'use strict'; + +import rules from '../rules/index.mjs'; + +/** + * Gets all enabled rules + * + * @param {string[]} [disabledRules] - List of disabled rule names + * @returns {import('../types').LintRule[]} - List of enabled rules + */ +export const getEnabledRules = (disabledRules = []) => { + return Object.entries(rules) + .filter(([ruleName]) => !disabledRules.includes(ruleName)) + .map(([, rule]) => rule); +}; diff --git a/src/parsers/markdown.mjs b/src/parsers/markdown.mjs index 3617baca..e0e7f229 100644 --- a/src/parsers/markdown.mjs +++ b/src/parsers/markdown.mjs @@ -15,9 +15,9 @@ import { createNodeSlugger } from '../utils/slugger/index.mjs'; /** * Creates an API doc parser for a given Markdown API doc file * - * @param {import('./linter/index.mjs').Linter | undefined} linter + * @param {import('../linter/types').Linter} [linter] */ -const createParser = () => { +const createParser = linter => { // Creates an instance of the Remark processor with GFM support // which is used for stringifying the AST tree back to Markdown const remarkProcessor = getRemark(); @@ -63,6 +63,8 @@ const createParser = () => { // Parses the API doc into an AST tree using `unified` and `remark` const apiDocTree = remarkProcessor.parse(resolvedApiDoc); + linter?.lint(resolvedApiDoc, apiDocTree); + // Get all Markdown Footnote definitions from the tree const markdownDefinitions = selectAll('definition', apiDocTree); diff --git a/src/utils/parser/index.mjs b/src/utils/parser/index.mjs index dedfa4b3..63aa6efc 100644 --- a/src/utils/parser/index.mjs +++ b/src/utils/parser/index.mjs @@ -11,6 +11,38 @@ import { DOC_TYPES_MAPPING_OTHER, DOC_TYPES_MAPPING_PRIMITIVES, } from './constants.mjs'; +import createQueries from '../queries/index.mjs'; + +/** + * Extracts raw YAML content from a node + * + * @param {import('mdast').Html} node A HTML node containing the YAML content + * @returns {string} The extracted raw YAML content + */ +export const extractYamlContent = node => { + return node.value.replace( + createQueries.QUERIES.yamlInnerContent, + // Either capture a YAML multinline block, or a simple single-line YAML block + (_, simple, yaml) => simple || yaml + ); +}; + +/** + * Normalizes YAML syntax by fixing some non-cool formatted properties of the + * docs schema + * + * @param {string} yamlContent The raw YAML content to normalize + * @returns {string} The normalized YAML content + */ +export const normalizeYamlSyntax = yamlContent => { + return yamlContent + .replace('introduced_in=', 'introduced_in: ') + .replace('source_link=', 'source_link: ') + .replace('type=', 'type: ') + .replace('name=', 'name: ') + .replace('llm_description=', 'llm_description: ') + .replace(/^\n+|\n+$/g, ''); // Remove initial and final line breaks +}; /** * This method replaces plain text Types within the Markdown content into Markdown links @@ -90,18 +122,12 @@ export const transformTypeToReferenceLink = type => { * @returns {ApiDocRawMetadataEntry} The parsed YAML metadata */ export const parseYAMLIntoMetadata = yamlString => { - const replacedContent = yamlString - // special validations for some non-cool formatted properties of the docs schema - .replace('introduced_in=', 'introduced_in: ') - .replace('source_link=', 'source_link: ') - .replace('type=', 'type: ') - .replace('name=', 'name: ') - .replace('llm_description=', 'llm_description: '); + const normalizedYaml = normalizeYamlSyntax(yamlString); // Ensures that the parsed YAML is an object, because even if it is not // i.e. a plain string or an array, it will simply not result into anything /** @type {ApiDocRawMetadataEntry | string} */ - let parsedYaml = yaml.parse(replacedContent); + let parsedYaml = yaml.parse(normalizedYaml); // Ensure that only Objects get parsed on Object.keys(), since some `/; +const regex = //; /** * Checks if `introduced_in` field is missing in the top-level entry. From 8757cf582a0b05e13f3688c94aae6d92aa550e21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guilherme=20Ara=C3=BAjo?= Date: Mon, 19 May 2025 21:09:37 -0300 Subject: [PATCH 03/17] fix: abort generation early --- bin/commands/generate.mjs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bin/commands/generate.mjs b/bin/commands/generate.mjs index a76a1e29..18c2822c 100644 --- a/bin/commands/generate.mjs +++ b/bin/commands/generate.mjs @@ -130,6 +130,11 @@ export default { linter.report(); + if (linter.hasError()) { + console.error('Lint failed; aborting generation.'); + process.exit(1); + } + const { runGenerators } = createGenerator(docs); const { getAllMajors } = createNodeReleases(opts.changelog); From a118ea327fc4bcb741d957f5a0262d98ceb14c17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guilherme=20Ara=C3=BAjo?= Date: Mon, 19 May 2025 21:10:58 -0300 Subject: [PATCH 04/17] fix: remove unknown option --- bin/commands/generate.mjs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/bin/commands/generate.mjs b/bin/commands/generate.mjs index 18c2822c..ba76e3e4 100644 --- a/bin/commands/generate.mjs +++ b/bin/commands/generate.mjs @@ -12,7 +12,7 @@ import { publicGenerators } from '../../src/generators/index.mjs'; import createNodeReleases from '../../src/releases.mjs'; import { loadAndParse } from '../utils.mjs'; import createLinter from '../../src/linter/index.mjs'; -import { getEnabledRules } from '../../src/linter/utils/rules.mjs'; +import rules from '../../src/linter/rules/index.mjs'; const availableGenerators = Object.keys(publicGenerators); @@ -123,9 +123,8 @@ export default { * @returns {Promise} */ async action(opts) { - const linter = opts.skipLint - ? undefined - : createLinter(getEnabledRules(opts.disableRule)); + const linter = opts.skipLint ? undefined : createLinter(rules); + const docs = await loadAndParse(opts.input, opts.ignore, linter); linter.report(); From 0f5e10c4f5bab7c4b2034a8a35fbea92570c74d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guilherme=20Ara=C3=BAjo?= Date: Mon, 19 May 2025 21:17:31 -0300 Subject: [PATCH 05/17] refactor: better name --- src/linter/context.mjs | 2 +- .../fixtures/{report.mjs => descriptors.mjs} | 12 ++++++------ src/linter/tests/index.test.mjs | 15 ++++++++++----- src/linter/types.d.ts | 4 ++-- 4 files changed, 19 insertions(+), 14 deletions(-) rename src/linter/tests/fixtures/{report.mjs => descriptors.mjs} (58%) diff --git a/src/linter/context.mjs b/src/linter/context.mjs index 5603071a..34418f56 100644 --- a/src/linter/context.mjs +++ b/src/linter/context.mjs @@ -18,7 +18,7 @@ const createContext = (file, tree) => { /** * Reports a lint issue. * - * @param {import('./types').ReportIssueProps} issue + * @param {import('./types').IssueDescriptor} descriptor * @returns {void} */ const report = ({ level, message, position }) => { diff --git a/src/linter/tests/fixtures/report.mjs b/src/linter/tests/fixtures/descriptors.mjs similarity index 58% rename from src/linter/tests/fixtures/report.mjs rename to src/linter/tests/fixtures/descriptors.mjs index 32128e4e..eb38bf0f 100644 --- a/src/linter/tests/fixtures/report.mjs +++ b/src/linter/tests/fixtures/descriptors.mjs @@ -1,24 +1,24 @@ /** - * @type {import('../../types').ReportIssueProps} + * @type {import('../../types').IssueDescriptor} */ -export const infoReport = { +export const infoDescriptor = { level: 'info', message: 'This is a INFO issue', }; /** - * @type {import('../../types').ReportIssueProps} + * @type {import('../../types').IssueDescriptor} */ -export const warnReport = { +export const warnDescriptor = { level: 'warn', message: 'This is a WARN issue', position: { start: { line: 1, column: 1 }, end: { line: 1, column: 2 } }, }; /** - * @type {import('../../types').ReportIssueProps} + * @type {import('../../types').IssueDescriptor} */ -export const errorReport = { +export const errorDescriptor = { level: 'error', message: 'This is a ERROR issue', position: { start: { line: 1, column: 1 }, end: { line: 1, column: 2 } }, diff --git a/src/linter/tests/index.test.mjs b/src/linter/tests/index.test.mjs index 2810e37d..c1bc0f35 100644 --- a/src/linter/tests/index.test.mjs +++ b/src/linter/tests/index.test.mjs @@ -1,10 +1,15 @@ import { describe, mock, it } from 'node:test'; import assert from 'node:assert/strict'; +import { VFile } from 'vfile'; + import createLinter from '../index.mjs'; import { errorIssue, infoIssue, warnIssue } from './fixtures/issues.mjs'; -import { VFile } from 'vfile'; import createContext from '../context.mjs'; -import { errorReport, infoReport, warnReport } from './fixtures/report.mjs'; +import { + errorDescriptor, + infoDescriptor, + warnDescriptor, +} from './fixtures/descriptors.mjs'; import { emptyTree } from './fixtures/tree.mjs'; describe('createLinter', () => { @@ -33,11 +38,11 @@ describe('createLinter', () => { it('should return the aggregated issues from all rules', () => { const rule1 = mock.fn(ctx => { - ctx.report(infoReport); - ctx.report(warnReport); + ctx.report(infoDescriptor); + ctx.report(warnDescriptor); }); - const rule2 = mock.fn(ctx => ctx.report(errorReport)); + const rule2 = mock.fn(ctx => ctx.report(errorDescriptor)); const linter = createLinter([rule1, rule2]); diff --git a/src/linter/types.d.ts b/src/linter/types.d.ts index 9466d668..2c328e17 100644 --- a/src/linter/types.d.ts +++ b/src/linter/types.d.ts @@ -27,7 +27,7 @@ export interface Linter { hasError: () => boolean; } -export interface ReportIssueProps { +export interface IssueDescriptor { level: IssueLevel; message: string; position?: Position; @@ -35,6 +35,6 @@ export interface ReportIssueProps { export interface LintContext { readonly tree: Root; - report(issue: ReportIssueProps): void; + report(descriptor: IssueDescriptor): void; getIssues(): LintIssue[]; } From 58b99f61decbafa3b90271e02f05ae4a91bab9d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guilherme=20Ara=C3=BAjo?= Date: Mon, 19 May 2025 21:21:05 -0300 Subject: [PATCH 06/17] test: fix test names --- src/linter/tests/rules/invalid-change-version.test.mjs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/linter/tests/rules/invalid-change-version.test.mjs b/src/linter/tests/rules/invalid-change-version.test.mjs index 2be58d11..c51ad99e 100644 --- a/src/linter/tests/rules/invalid-change-version.test.mjs +++ b/src/linter/tests/rules/invalid-change-version.test.mjs @@ -113,7 +113,7 @@ changes: strictEqual(result.error, undefined); }); - it('should return an empty array if all change versions are valid', () => { + it('should not report if all change versions are valid', () => { const yamlContent = dedent` /; + +export const LLM_DESCRIPTION_REGEX = //; + export const LINT_MESSAGES = { missingIntroducedIn: "Missing 'introduced_in' field in the API doc entry", missingChangeVersion: 'Missing version field in the API doc entry', diff --git a/src/linter/context.mjs b/src/linter/context.mjs index 34418f56..00a07d8d 100644 --- a/src/linter/context.mjs +++ b/src/linter/context.mjs @@ -27,12 +27,9 @@ const createContext = (file, tree) => { */ const location = { path: file.path, + position, }; - if (position) { - location.position = position; - } - issues.push({ level, message, diff --git a/src/linter/rules/invalid-change-version.mjs b/src/linter/rules/invalid-change-version.mjs index 21d00916..edd28584 100644 --- a/src/linter/rules/invalid-change-version.mjs +++ b/src/linter/rules/invalid-change-version.mjs @@ -9,6 +9,7 @@ import { normalizeYamlSyntax, } from '../../utils/parser/index.mjs'; import { LINT_MESSAGES } from '../constants.mjs'; +import { enforceArray } from '../../utils/array.mjs'; const NODE_RELEASED_VERSIONS = env.NODE_RELEASED_VERSIONS?.split(','); @@ -55,13 +56,6 @@ const isInvalid = NODE_RELEASED_VERSIONS : (version, _, { length }) => !(isValidReplaceMe(version, length) || valid(version)); -/** - * - * @param version - */ -const normalizeVersion = version => - Array.isArray(version) ? version : [version]; - /** * Identifies invalid change versions from metadata entries. * @@ -85,7 +79,7 @@ export const invalidChangeVersion = context => { } changes.forEach(({ version }) => - normalizeVersion(version) + enforceArray(version) .filter(isInvalid) .forEach(version => context.report({ diff --git a/src/linter/rules/missing-introduced-in.mjs b/src/linter/rules/missing-introduced-in.mjs index 0b0ee304..1353e39e 100644 --- a/src/linter/rules/missing-introduced-in.mjs +++ b/src/linter/rules/missing-introduced-in.mjs @@ -1,10 +1,8 @@ 'use strict'; -import { LINT_MESSAGES } from '../constants.mjs'; +import { INTRDOCUED_IN_REGEX, LINT_MESSAGES } from '../constants.mjs'; import { findTopLevelEntry } from '../utils/find.mjs'; -const regex = //; - /** * Checks if `introduced_in` field is missing in the top-level entry. * @@ -14,7 +12,7 @@ const regex = //; export const missingIntroducedIn = context => { const introducedIn = findTopLevelEntry( context.tree, - node => node.type === 'html' && regex.test(node.value) + node => node.type === 'html' && INTRDOCUED_IN_REGEX.test(node.value) ); if (introducedIn) { diff --git a/src/linter/rules/missing-llm-description.mjs b/src/linter/rules/missing-llm-description.mjs index a0608844..ec3bb1c4 100644 --- a/src/linter/rules/missing-llm-description.mjs +++ b/src/linter/rules/missing-llm-description.mjs @@ -1,8 +1,6 @@ -import { LINT_MESSAGES } from '../constants.mjs'; +import { LINT_MESSAGES, LLM_DESCRIPTION_REGEX } from '../constants.mjs'; import { findTopLevelEntry } from '../utils/find.mjs'; -const regex = //; - /** * Checks if a top-level entry is missing a llm_description field or a paragraph * node. @@ -13,7 +11,7 @@ const regex = //; export const missingLlmDescription = context => { const llmDescription = findTopLevelEntry( context.tree, - node => node.type === 'html' && regex.test(node.value) + node => node.type === 'html' && LLM_DESCRIPTION_REGEX.test(node.value) ); if (llmDescription) { @@ -28,7 +26,7 @@ export const missingLlmDescription = context => { ); if (paragraph) { - return false; + return; } context.report({ diff --git a/src/utils/array.mjs b/src/utils/array.mjs new file mode 100644 index 00000000..706c6df8 --- /dev/null +++ b/src/utils/array.mjs @@ -0,0 +1,7 @@ +/** + * Converts a value to an array. + * @template T + * @param {T | T[]} val - The value to convert. + * @returns {T[]} The value as an array. + */ +export const enforceArray = val => (Array.isArray(val) ? val : [val]); From 318df51105cd09e5826df2190bb911e04f8b8325 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guilherme=20Ara=C3=BAjo?= Date: Tue, 20 May 2025 14:42:54 -0300 Subject: [PATCH 08/17] test: info issues position --- ast.json | 42842 +++++++++++++++++++ src/linter/tests/fixtures/descriptors.mjs | 1 + src/linter/tests/fixtures/issues.mjs | 1 + src/linter/tests/reporters/github.test.mjs | 2 +- 4 files changed, 42845 insertions(+), 1 deletion(-) create mode 100644 ast.json diff --git a/ast.json b/ast.json new file mode 100644 index 00000000..a44ef8d4 --- /dev/null +++ b/ast.json @@ -0,0 +1,42842 @@ +{ + "type": "root", + "children": [ + { + "type": "heading", + "depth": 1, + "children": [ + { + "type": "text", + "value": "Buffer", + "position": { + "start": { "line": 1, "column": 3, "offset": 2 }, + "end": { "line": 1, "column": 9, "offset": 8 } + } + } + ], + "position": { + "start": { "line": 1, "column": 1, "offset": 0 }, + "end": { "line": 1, "column": 9, "offset": 8 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 3, "column": 1, "offset": 10 }, + "end": { "line": 3, "column": 29, "offset": 38 } + } + }, + { + "type": "blockquote", + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "link", + "title": null, + "url": "documentation.html#stability-index", + "children": [ + { + "type": "text", + "value": "Stability: 2", + "position": { + "start": { "line": 5, "column": 4, "offset": 43 }, + "end": { "line": 5, "column": 16, "offset": 55 } + } + } + ], + "position": { + "start": { "line": 5, "column": 3, "offset": 42 }, + "end": { "line": 5, "column": 53, "offset": 92 } + } + }, + { + "type": "text", + "value": " - Stable", + "position": { + "start": { "line": 5, "column": 53, "offset": 92 }, + "end": { "line": 5, "column": 62, "offset": 101 } + } + } + ], + "position": { + "start": { "line": 5, "column": 3, "offset": 42 }, + "end": { "line": 5, "column": 62, "offset": 101 } + } + } + ], + "position": { + "start": { "line": 5, "column": 1, "offset": 40 }, + "end": { "line": 5, "column": 62, "offset": 101 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 7, "column": 1, "offset": 103 }, + "end": { "line": 7, "column": 35, "offset": 137 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 9, "column": 1, "offset": 139 }, + "end": { "line": 9, "column": 9, "offset": 147 } + } + }, + { + "type": "text", + "value": " objects are used to represent a fixed-length sequence of bytes. Many\nNode.js APIs support ", + "position": { + "start": { "line": 9, "column": 9, "offset": 147 }, + "end": { "line": 10, "column": 22, "offset": 238 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 10, "column": 22, "offset": 238 }, + "end": { "line": 10, "column": 30, "offset": 246 } + } + }, + { + "type": "text", + "value": "s.", + "position": { + "start": { "line": 10, "column": 30, "offset": 246 }, + "end": { "line": 10, "column": 32, "offset": 248 } + } + } + ], + "position": { + "start": { "line": 9, "column": 1, "offset": 139 }, + "end": { "line": 10, "column": 32, "offset": 248 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "The ", + "position": { + "start": { "line": 12, "column": 1, "offset": 250 }, + "end": { "line": 12, "column": 5, "offset": 254 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 12, "column": 5, "offset": 254 }, + "end": { "line": 12, "column": 13, "offset": 262 } + } + }, + { + "type": "text", + "value": " class is a subclass of JavaScript's {Uint8Array} class and\nextends it with methods that cover additional use cases. Node.js APIs accept\nplain {Uint8Array}s wherever ", + "position": { + "start": { "line": 12, "column": 13, "offset": 262 }, + "end": { "line": 14, "column": 30, "offset": 428 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 14, "column": 30, "offset": 428 }, + "end": { "line": 14, "column": 38, "offset": 436 } + } + }, + { + "type": "text", + "value": "s are supported as well.", + "position": { + "start": { "line": 14, "column": 38, "offset": 436 }, + "end": { "line": 14, "column": 62, "offset": 460 } + } + } + ], + "position": { + "start": { "line": 12, "column": 1, "offset": 250 }, + "end": { "line": 14, "column": 62, "offset": 460 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "While the ", + "position": { + "start": { "line": 16, "column": 1, "offset": 462 }, + "end": { "line": 16, "column": 11, "offset": 472 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 16, "column": 11, "offset": 472 }, + "end": { "line": 16, "column": 19, "offset": 480 } + } + }, + { + "type": "text", + "value": " class is available within the global scope, it is still\nrecommended to explicitly reference it via an import or require statement.", + "position": { + "start": { "line": 16, "column": 19, "offset": 480 }, + "end": { "line": 17, "column": 75, "offset": 611 } + } + } + ], + "position": { + "start": { "line": 16, "column": 1, "offset": 462 }, + "end": { "line": 17, "column": 75, "offset": 611 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\n// Creates a zero-filled Buffer of length 10.\nconst buf1 = Buffer.alloc(10);\n\n// Creates a Buffer of length 10,\n// filled with bytes which all have the value `1`.\nconst buf2 = Buffer.alloc(10, 1);\n\n// Creates an uninitialized buffer of length 10.\n// This is faster than calling Buffer.alloc() but the returned\n// Buffer instance might contain old data that needs to be\n// overwritten using fill(), write(), or other functions that fill the Buffer's\n// contents.\nconst buf3 = Buffer.allocUnsafe(10);\n\n// Creates a Buffer containing the bytes [1, 2, 3].\nconst buf4 = Buffer.from([1, 2, 3]);\n\n// Creates a Buffer containing the bytes [1, 1, 1, 1] – the entries\n// are all truncated using `(value & 255)` to fit into the range 0–255.\nconst buf5 = Buffer.from([257, 257.5, -255, '1']);\n\n// Creates a Buffer containing the UTF-8-encoded bytes for the string 'tést':\n// [0x74, 0xc3, 0xa9, 0x73, 0x74] (in hexadecimal notation)\n// [116, 195, 169, 115, 116] (in decimal notation)\nconst buf6 = Buffer.from('tést');\n\n// Creates a Buffer containing the Latin-1 bytes [0x74, 0xe9, 0x73, 0x74].\nconst buf7 = Buffer.from('tést', 'latin1');", + "position": { + "start": { "line": 19, "column": 1, "offset": 613 }, + "end": { "line": 50, "column": 4, "offset": 1787 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\n// Creates a zero-filled Buffer of length 10.\nconst buf1 = Buffer.alloc(10);\n\n// Creates a Buffer of length 10,\n// filled with bytes which all have the value `1`.\nconst buf2 = Buffer.alloc(10, 1);\n\n// Creates an uninitialized buffer of length 10.\n// This is faster than calling Buffer.alloc() but the returned\n// Buffer instance might contain old data that needs to be\n// overwritten using fill(), write(), or other functions that fill the Buffer's\n// contents.\nconst buf3 = Buffer.allocUnsafe(10);\n\n// Creates a Buffer containing the bytes [1, 2, 3].\nconst buf4 = Buffer.from([1, 2, 3]);\n\n// Creates a Buffer containing the bytes [1, 1, 1, 1] – the entries\n// are all truncated using `(value & 255)` to fit into the range 0–255.\nconst buf5 = Buffer.from([257, 257.5, -255, '1']);\n\n// Creates a Buffer containing the UTF-8-encoded bytes for the string 'tést':\n// [0x74, 0xc3, 0xa9, 0x73, 0x74] (in hexadecimal notation)\n// [116, 195, 169, 115, 116] (in decimal notation)\nconst buf6 = Buffer.from('tést');\n\n// Creates a Buffer containing the Latin-1 bytes [0x74, 0xe9, 0x73, 0x74].\nconst buf7 = Buffer.from('tést', 'latin1');", + "position": { + "start": { "line": 52, "column": 1, "offset": 1789 }, + "end": { "line": 83, "column": 4, "offset": 2968 } + } + }, + { + "type": "heading", + "depth": 2, + "children": [ + { + "type": "text", + "value": "Buffers and character encodings", + "position": { + "start": { "line": 85, "column": 4, "offset": 2973 }, + "end": { "line": 85, "column": 35, "offset": 3004 } + } + } + ], + "position": { + "start": { "line": 85, "column": 1, "offset": 2970 }, + "end": { "line": 85, "column": 35, "offset": 3004 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 87, "column": 1, "offset": 3006 }, + "end": { "line": 100, "column": 4, "offset": 3455 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "When converting between ", + "position": { + "start": { "line": 102, "column": 1, "offset": 3457 }, + "end": { "line": 102, "column": 25, "offset": 3481 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 102, "column": 25, "offset": 3481 }, + "end": { "line": 102, "column": 33, "offset": 3489 } + } + }, + { + "type": "text", + "value": "s and strings, a character encoding may be\nspecified. If no character encoding is specified, UTF-8 will be used as the\ndefault.", + "position": { + "start": { "line": 102, "column": 33, "offset": 3489 }, + "end": { "line": 104, "column": 9, "offset": 3616 } + } + } + ], + "position": { + "start": { "line": 102, "column": 1, "offset": 3457 }, + "end": { "line": 104, "column": 9, "offset": 3616 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from('hello world', 'utf8');\n\nconsole.log(buf.toString('hex'));\n// Prints: 68656c6c6f20776f726c64\nconsole.log(buf.toString('base64'));\n// Prints: aGVsbG8gd29ybGQ=\n\nconsole.log(Buffer.from('fhqwhgads', 'utf8'));\n// Prints: \nconsole.log(Buffer.from('fhqwhgads', 'utf16le'));\n// Prints: ", + "position": { + "start": { "line": 106, "column": 1, "offset": 3618 }, + "end": { "line": 120, "column": 4, "offset": 4068 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from('hello world', 'utf8');\n\nconsole.log(buf.toString('hex'));\n// Prints: 68656c6c6f20776f726c64\nconsole.log(buf.toString('base64'));\n// Prints: aGVsbG8gd29ybGQ=\n\nconsole.log(Buffer.from('fhqwhgads', 'utf8'));\n// Prints: \nconsole.log(Buffer.from('fhqwhgads', 'utf16le'));\n// Prints: ", + "position": { + "start": { "line": 122, "column": 1, "offset": 4070 }, + "end": { "line": 136, "column": 4, "offset": 4525 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Node.js buffers accept all case variations of encoding strings that they\nreceive. For example, UTF-8 can be specified as ", + "position": { + "start": { "line": 138, "column": 1, "offset": 4527 }, + "end": { "line": 139, "column": 49, "offset": 4648 } + } + }, + { + "type": "inlineCode", + "value": "'utf8'", + "position": { + "start": { "line": 139, "column": 49, "offset": 4648 }, + "end": { "line": 139, "column": 57, "offset": 4656 } + } + }, + { + "type": "text", + "value": ", ", + "position": { + "start": { "line": 139, "column": 57, "offset": 4656 }, + "end": { "line": 139, "column": 59, "offset": 4658 } + } + }, + { + "type": "inlineCode", + "value": "'UTF8'", + "position": { + "start": { "line": 139, "column": 59, "offset": 4658 }, + "end": { "line": 139, "column": 67, "offset": 4666 } + } + }, + { + "type": "text", + "value": ", or ", + "position": { + "start": { "line": 139, "column": 67, "offset": 4666 }, + "end": { "line": 139, "column": 72, "offset": 4671 } + } + }, + { + "type": "inlineCode", + "value": "'uTf8'", + "position": { + "start": { "line": 139, "column": 72, "offset": 4671 }, + "end": { "line": 139, "column": 80, "offset": 4679 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 139, "column": 80, "offset": 4679 }, + "end": { "line": 139, "column": 81, "offset": 4680 } + } + } + ], + "position": { + "start": { "line": 138, "column": 1, "offset": 4527 }, + "end": { "line": 139, "column": 81, "offset": 4680 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "The character encodings currently supported by Node.js are the following:", + "position": { + "start": { "line": 141, "column": 1, "offset": 4682 }, + "end": { "line": 141, "column": 74, "offset": 4755 } + } + } + ], + "position": { + "start": { "line": 141, "column": 1, "offset": 4682 }, + "end": { "line": 141, "column": 74, "offset": 4755 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": true, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "'utf8'", + "position": { + "start": { "line": 143, "column": 3, "offset": 4759 }, + "end": { "line": 143, "column": 11, "offset": 4767 } + } + }, + { + "type": "text", + "value": " (alias: ", + "position": { + "start": { "line": 143, "column": 11, "offset": 4767 }, + "end": { "line": 143, "column": 20, "offset": 4776 } + } + }, + { + "type": "inlineCode", + "value": "'utf-8'", + "position": { + "start": { "line": 143, "column": 20, "offset": 4776 }, + "end": { "line": 143, "column": 29, "offset": 4785 } + } + }, + { + "type": "text", + "value": "): Multi-byte encoded Unicode characters. Many web\npages and other document formats use ", + "position": { + "start": { "line": 143, "column": 29, "offset": 4785 }, + "end": { "line": 144, "column": 40, "offset": 4875 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "text", + "value": "UTF-8", + "position": { + "start": { "line": 144, "column": 41, "offset": 4876 }, + "end": { "line": 144, "column": 46, "offset": 4881 } + } + } + ], + "position": { + "start": { "line": 144, "column": 40, "offset": 4875 }, + "end": { "line": 144, "column": 49, "offset": 4884 } + }, + "label": "UTF-8", + "identifier": "utf-8", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": ". This is the default character\nencoding. When decoding a ", + "position": { + "start": { "line": 144, "column": 49, "offset": 4884 }, + "end": { "line": 145, "column": 29, "offset": 4944 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 145, "column": 29, "offset": 4944 }, + "end": { "line": 145, "column": 37, "offset": 4952 } + } + }, + { + "type": "text", + "value": " into a string that does not exclusively\ncontain valid UTF-8 data, the Unicode replacement character ", + "position": { + "start": { "line": 145, "column": 37, "offset": 4952 }, + "end": { "line": 146, "column": 63, "offset": 5055 } + } + }, + { + "type": "inlineCode", + "value": "U+FFFD", + "position": { + "start": { "line": 146, "column": 63, "offset": 5055 }, + "end": { "line": 146, "column": 71, "offset": 5063 } + } + }, + { + "type": "text", + "value": " � will be\nused to represent those errors.", + "position": { + "start": { "line": 146, "column": 71, "offset": 5063 }, + "end": { "line": 147, "column": 34, "offset": 5107 } + } + } + ], + "position": { + "start": { "line": 143, "column": 3, "offset": 4759 }, + "end": { "line": 147, "column": 34, "offset": 5107 } + } + } + ], + "position": { + "start": { "line": 143, "column": 1, "offset": 4757 }, + "end": { "line": 147, "column": 34, "offset": 5107 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "'utf16le'", + "position": { + "start": { "line": 149, "column": 3, "offset": 5111 }, + "end": { "line": 149, "column": 14, "offset": 5122 } + } + }, + { + "type": "text", + "value": " (alias: ", + "position": { + "start": { "line": 149, "column": 14, "offset": 5122 }, + "end": { "line": 149, "column": 23, "offset": 5131 } + } + }, + { + "type": "inlineCode", + "value": "'utf-16le'", + "position": { + "start": { "line": 149, "column": 23, "offset": 5131 }, + "end": { "line": 149, "column": 35, "offset": 5143 } + } + }, + { + "type": "text", + "value": "): Multi-byte encoded Unicode characters.\nUnlike ", + "position": { + "start": { "line": 149, "column": 35, "offset": 5143 }, + "end": { "line": 150, "column": 10, "offset": 5194 } + } + }, + { + "type": "inlineCode", + "value": "'utf8'", + "position": { + "start": { "line": 150, "column": 10, "offset": 5194 }, + "end": { "line": 150, "column": 18, "offset": 5202 } + } + }, + { + "type": "text", + "value": ", each character in the string will be encoded using either 2\nor 4 bytes. Node.js only supports the ", + "position": { + "start": { "line": 150, "column": 18, "offset": 5202 }, + "end": { "line": 151, "column": 41, "offset": 5304 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "text", + "value": "little-endian", + "position": { + "start": { "line": 151, "column": 42, "offset": 5305 }, + "end": { "line": 151, "column": 55, "offset": 5318 } + } + } + ], + "position": { + "start": { "line": 151, "column": 41, "offset": 5304 }, + "end": { "line": 151, "column": 68, "offset": 5331 } + }, + "label": "endianness", + "identifier": "endianness", + "referenceType": "full" + }, + { + "type": "text", + "value": " variant of\n", + "position": { + "start": { "line": 151, "column": 68, "offset": 5331 }, + "end": { "line": 152, "column": 1, "offset": 5343 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "text", + "value": "UTF-16", + "position": { + "start": { "line": 152, "column": 4, "offset": 5346 }, + "end": { "line": 152, "column": 10, "offset": 5352 } + } + } + ], + "position": { + "start": { "line": 152, "column": 3, "offset": 5345 }, + "end": { "line": 152, "column": 13, "offset": 5355 } + }, + "label": "UTF-16", + "identifier": "utf-16", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 152, "column": 13, "offset": 5355 }, + "end": { "line": 152, "column": 14, "offset": 5356 } + } + } + ], + "position": { + "start": { "line": 149, "column": 3, "offset": 5111 }, + "end": { "line": 152, "column": 14, "offset": 5356 } + } + } + ], + "position": { + "start": { "line": 149, "column": 1, "offset": 5109 }, + "end": { "line": 152, "column": 14, "offset": 5356 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "'latin1'", + "position": { + "start": { "line": 154, "column": 3, "offset": 5360 }, + "end": { "line": 154, "column": 13, "offset": 5370 } + } + }, + { + "type": "text", + "value": ": Latin-1 stands for ", + "position": { + "start": { "line": 154, "column": 13, "offset": 5370 }, + "end": { "line": 154, "column": 34, "offset": 5391 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "text", + "value": "ISO-8859-1", + "position": { + "start": { "line": 154, "column": 35, "offset": 5392 }, + "end": { "line": 154, "column": 45, "offset": 5402 } + } + } + ], + "position": { + "start": { "line": 154, "column": 34, "offset": 5391 }, + "end": { "line": 154, "column": 48, "offset": 5405 } + }, + "label": "ISO-8859-1", + "identifier": "iso-8859-1", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": ". This character encoding only\nsupports the Unicode characters from ", + "position": { + "start": { "line": 154, "column": 48, "offset": 5405 }, + "end": { "line": 155, "column": 40, "offset": 5475 } + } + }, + { + "type": "inlineCode", + "value": "U+0000", + "position": { + "start": { "line": 155, "column": 40, "offset": 5475 }, + "end": { "line": 155, "column": 48, "offset": 5483 } + } + }, + { + "type": "text", + "value": " to ", + "position": { + "start": { "line": 155, "column": 48, "offset": 5483 }, + "end": { "line": 155, "column": 52, "offset": 5487 } + } + }, + { + "type": "inlineCode", + "value": "U+00FF", + "position": { + "start": { "line": 155, "column": 52, "offset": 5487 }, + "end": { "line": 155, "column": 60, "offset": 5495 } + } + }, + { + "type": "text", + "value": ". Each character is\nencoded using a single byte. Characters that do not fit into that range are\ntruncated and will be mapped to characters in that range.", + "position": { + "start": { "line": 155, "column": 60, "offset": 5495 }, + "end": { "line": 157, "column": 60, "offset": 5652 } + } + } + ], + "position": { + "start": { "line": 154, "column": 3, "offset": 5360 }, + "end": { "line": 157, "column": 60, "offset": 5652 } + } + } + ], + "position": { + "start": { "line": 154, "column": 1, "offset": 5358 }, + "end": { "line": 157, "column": 60, "offset": 5652 } + } + } + ], + "position": { + "start": { "line": 143, "column": 1, "offset": 4757 }, + "end": { "line": 157, "column": 60, "offset": 5652 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Converting a ", + "position": { + "start": { "line": 159, "column": 1, "offset": 5654 }, + "end": { "line": 159, "column": 14, "offset": 5667 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 159, "column": 14, "offset": 5667 }, + "end": { "line": 159, "column": 22, "offset": 5675 } + } + }, + { + "type": "text", + "value": " into a string using one of the above is referred to as\ndecoding, and converting a string into a ", + "position": { + "start": { "line": 159, "column": 22, "offset": 5675 }, + "end": { "line": 160, "column": 42, "offset": 5772 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 160, "column": 42, "offset": 5772 }, + "end": { "line": 160, "column": 50, "offset": 5780 } + } + }, + { + "type": "text", + "value": " is referred to as encoding.", + "position": { + "start": { "line": 160, "column": 50, "offset": 5780 }, + "end": { "line": 160, "column": 78, "offset": 5808 } + } + } + ], + "position": { + "start": { "line": 159, "column": 1, "offset": 5654 }, + "end": { "line": 160, "column": 78, "offset": 5808 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Node.js also supports the following binary-to-text encodings. For\nbinary-to-text encodings, the naming convention is reversed: Converting a\n", + "position": { + "start": { "line": 162, "column": 1, "offset": 5810 }, + "end": { "line": 164, "column": 1, "offset": 5950 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 164, "column": 1, "offset": 5950 }, + "end": { "line": 164, "column": 9, "offset": 5958 } + } + }, + { + "type": "text", + "value": " into a string is typically referred to as encoding, and converting a\nstring into a ", + "position": { + "start": { "line": 164, "column": 9, "offset": 5958 }, + "end": { "line": 165, "column": 15, "offset": 6042 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 165, "column": 15, "offset": 6042 }, + "end": { "line": 165, "column": 23, "offset": 6050 } + } + }, + { + "type": "text", + "value": " as decoding.", + "position": { + "start": { "line": 165, "column": 23, "offset": 6050 }, + "end": { "line": 165, "column": 36, "offset": 6063 } + } + } + ], + "position": { + "start": { "line": 162, "column": 1, "offset": 5810 }, + "end": { "line": 165, "column": 36, "offset": 6063 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": true, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "'base64'", + "position": { + "start": { "line": 167, "column": 3, "offset": 6067 }, + "end": { "line": 167, "column": 13, "offset": 6077 } + } + }, + { + "type": "text", + "value": ": ", + "position": { + "start": { "line": 167, "column": 13, "offset": 6077 }, + "end": { "line": 167, "column": 15, "offset": 6079 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "text", + "value": "Base64", + "position": { + "start": { "line": 167, "column": 16, "offset": 6080 }, + "end": { "line": 167, "column": 22, "offset": 6086 } + } + } + ], + "position": { + "start": { "line": 167, "column": 15, "offset": 6079 }, + "end": { "line": 167, "column": 25, "offset": 6089 } + }, + "label": "Base64", + "identifier": "base64", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": " encoding. When creating a ", + "position": { + "start": { "line": 167, "column": 25, "offset": 6089 }, + "end": { "line": 167, "column": 52, "offset": 6116 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 167, "column": 52, "offset": 6116 }, + "end": { "line": 167, "column": 60, "offset": 6124 } + } + }, + { + "type": "text", + "value": " from a string,\nthis encoding will also correctly accept \"URL and Filename Safe Alphabet\" as\nspecified in ", + "position": { + "start": { "line": 167, "column": 60, "offset": 6124 }, + "end": { "line": 169, "column": 16, "offset": 6234 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "text", + "value": "RFC 4648, Section 5", + "position": { + "start": { "line": 169, "column": 17, "offset": 6235 }, + "end": { "line": 169, "column": 36, "offset": 6254 } + } + } + ], + "position": { + "start": { "line": 169, "column": 16, "offset": 6234 }, + "end": { "line": 169, "column": 39, "offset": 6257 } + }, + "label": "RFC 4648, Section 5", + "identifier": "rfc 4648, section 5", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": ". Whitespace characters such as spaces,\ntabs, and new lines contained within the base64-encoded string are ignored.", + "position": { + "start": { "line": 169, "column": 39, "offset": 6257 }, + "end": { "line": 170, "column": 78, "offset": 6374 } + } + } + ], + "position": { + "start": { "line": 167, "column": 3, "offset": 6067 }, + "end": { "line": 170, "column": 78, "offset": 6374 } + } + } + ], + "position": { + "start": { "line": 167, "column": 1, "offset": 6065 }, + "end": { "line": 170, "column": 78, "offset": 6374 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "'base64url'", + "position": { + "start": { "line": 172, "column": 3, "offset": 6378 }, + "end": { "line": 172, "column": 16, "offset": 6391 } + } + }, + { + "type": "text", + "value": ": ", + "position": { + "start": { "line": 172, "column": 16, "offset": 6391 }, + "end": { "line": 172, "column": 18, "offset": 6393 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "text", + "value": "base64url", + "position": { + "start": { "line": 172, "column": 19, "offset": 6394 }, + "end": { "line": 172, "column": 28, "offset": 6403 } + } + } + ], + "position": { + "start": { "line": 172, "column": 18, "offset": 6393 }, + "end": { "line": 172, "column": 31, "offset": 6406 } + }, + "label": "base64url", + "identifier": "base64url", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": " encoding as specified in\n", + "position": { + "start": { "line": 172, "column": 31, "offset": 6406 }, + "end": { "line": 173, "column": 1, "offset": 6432 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "text", + "value": "RFC 4648, Section 5", + "position": { + "start": { "line": 173, "column": 4, "offset": 6435 }, + "end": { "line": 173, "column": 23, "offset": 6454 } + } + } + ], + "position": { + "start": { "line": 173, "column": 3, "offset": 6434 }, + "end": { "line": 173, "column": 26, "offset": 6457 } + }, + "label": "RFC 4648, Section 5", + "identifier": "rfc 4648, section 5", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": ". When creating a ", + "position": { + "start": { "line": 173, "column": 26, "offset": 6457 }, + "end": { "line": 173, "column": 44, "offset": 6475 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 173, "column": 44, "offset": 6475 }, + "end": { "line": 173, "column": 52, "offset": 6483 } + } + }, + { + "type": "text", + "value": " from a string, this\nencoding will also correctly accept regular base64-encoded strings. When\nencoding a ", + "position": { + "start": { "line": 173, "column": 52, "offset": 6483 }, + "end": { "line": 175, "column": 14, "offset": 6592 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 175, "column": 14, "offset": 6592 }, + "end": { "line": 175, "column": 22, "offset": 6600 } + } + }, + { + "type": "text", + "value": " to a string, this encoding will omit padding.", + "position": { + "start": { "line": 175, "column": 22, "offset": 6600 }, + "end": { "line": 175, "column": 68, "offset": 6646 } + } + } + ], + "position": { + "start": { "line": 172, "column": 3, "offset": 6378 }, + "end": { "line": 175, "column": 68, "offset": 6646 } + } + } + ], + "position": { + "start": { "line": 172, "column": 1, "offset": 6376 }, + "end": { "line": 175, "column": 68, "offset": 6646 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "'hex'", + "position": { + "start": { "line": 177, "column": 3, "offset": 6650 }, + "end": { "line": 177, "column": 10, "offset": 6657 } + } + }, + { + "type": "text", + "value": ": Encode each byte as two hexadecimal characters. Data truncation\nmay occur when decoding strings that do not exclusively consist of an even\nnumber of hexadecimal characters. See below for an example.", + "position": { + "start": { "line": 177, "column": 10, "offset": 6657 }, + "end": { "line": 179, "column": 62, "offset": 6861 } + } + } + ], + "position": { + "start": { "line": 177, "column": 3, "offset": 6650 }, + "end": { "line": 179, "column": 62, "offset": 6861 } + } + } + ], + "position": { + "start": { "line": 177, "column": 1, "offset": 6648 }, + "end": { "line": 179, "column": 62, "offset": 6861 } + } + } + ], + "position": { + "start": { "line": 167, "column": 1, "offset": 6065 }, + "end": { "line": 179, "column": 62, "offset": 6861 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "The following legacy character encodings are also supported:", + "position": { + "start": { "line": 181, "column": 1, "offset": 6863 }, + "end": { "line": 181, "column": 61, "offset": 6923 } + } + } + ], + "position": { + "start": { "line": 181, "column": 1, "offset": 6863 }, + "end": { "line": 181, "column": 61, "offset": 6923 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": true, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "'ascii'", + "position": { + "start": { "line": 183, "column": 3, "offset": 6927 }, + "end": { "line": 183, "column": 12, "offset": 6936 } + } + }, + { + "type": "text", + "value": ": For 7-bit ", + "position": { + "start": { "line": 183, "column": 12, "offset": 6936 }, + "end": { "line": 183, "column": 24, "offset": 6948 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "text", + "value": "ASCII", + "position": { + "start": { "line": 183, "column": 25, "offset": 6949 }, + "end": { "line": 183, "column": 30, "offset": 6954 } + } + } + ], + "position": { + "start": { "line": 183, "column": 24, "offset": 6948 }, + "end": { "line": 183, "column": 33, "offset": 6957 } + }, + "label": "ASCII", + "identifier": "ascii", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": " data only. When encoding a string into a\n", + "position": { + "start": { "line": 183, "column": 33, "offset": 6957 }, + "end": { "line": 184, "column": 1, "offset": 6999 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 184, "column": 3, "offset": 7001 }, + "end": { "line": 184, "column": 11, "offset": 7009 } + } + }, + { + "type": "text", + "value": ", this is equivalent to using ", + "position": { + "start": { "line": 184, "column": 11, "offset": 7009 }, + "end": { "line": 184, "column": 41, "offset": 7039 } + } + }, + { + "type": "inlineCode", + "value": "'latin1'", + "position": { + "start": { "line": 184, "column": 41, "offset": 7039 }, + "end": { "line": 184, "column": 51, "offset": 7049 } + } + }, + { + "type": "text", + "value": ". When decoding a ", + "position": { + "start": { "line": 184, "column": 51, "offset": 7049 }, + "end": { "line": 184, "column": 69, "offset": 7067 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 184, "column": 69, "offset": 7067 }, + "end": { "line": 184, "column": 77, "offset": 7075 } + } + }, + { + "type": "text", + "value": "\ninto a string, using this encoding will additionally unset the highest bit of\neach byte before decoding as ", + "position": { + "start": { "line": 184, "column": 77, "offset": 7075 }, + "end": { "line": 186, "column": 32, "offset": 7187 } + } + }, + { + "type": "inlineCode", + "value": "'latin1'", + "position": { + "start": { "line": 186, "column": 32, "offset": 7187 }, + "end": { "line": 186, "column": 42, "offset": 7197 } + } + }, + { + "type": "text", + "value": ".\nGenerally, there should be no reason to use this encoding, as ", + "position": { + "start": { "line": 186, "column": 42, "offset": 7197 }, + "end": { "line": 187, "column": 65, "offset": 7263 } + } + }, + { + "type": "inlineCode", + "value": "'utf8'", + "position": { + "start": { "line": 187, "column": 65, "offset": 7263 }, + "end": { "line": 187, "column": 73, "offset": 7271 } + } + }, + { + "type": "text", + "value": "\n(or, if the data is known to always be ASCII-only, ", + "position": { + "start": { "line": 187, "column": 73, "offset": 7271 }, + "end": { "line": 188, "column": 54, "offset": 7325 } + } + }, + { + "type": "inlineCode", + "value": "'latin1'", + "position": { + "start": { "line": 188, "column": 54, "offset": 7325 }, + "end": { "line": 188, "column": 64, "offset": 7335 } + } + }, + { + "type": "text", + "value": ") will be a\nbetter choice when encoding or decoding ASCII-only text. It is only provided\nfor legacy compatibility.", + "position": { + "start": { "line": 188, "column": 64, "offset": 7335 }, + "end": { "line": 190, "column": 28, "offset": 7453 } + } + } + ], + "position": { + "start": { "line": 183, "column": 3, "offset": 6927 }, + "end": { "line": 190, "column": 28, "offset": 7453 } + } + } + ], + "position": { + "start": { "line": 183, "column": 1, "offset": 6925 }, + "end": { "line": 190, "column": 28, "offset": 7453 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "'binary'", + "position": { + "start": { "line": 192, "column": 3, "offset": 7457 }, + "end": { "line": 192, "column": 13, "offset": 7467 } + } + }, + { + "type": "text", + "value": ": Alias for ", + "position": { + "start": { "line": 192, "column": 13, "offset": 7467 }, + "end": { "line": 192, "column": 25, "offset": 7479 } + } + }, + { + "type": "inlineCode", + "value": "'latin1'", + "position": { + "start": { "line": 192, "column": 25, "offset": 7479 }, + "end": { "line": 192, "column": 35, "offset": 7489 } + } + }, + { + "type": "text", + "value": ".\nThe name of this encoding can be very misleading, as all of the\nencodings listed here convert between strings and binary data. For converting\nbetween strings and ", + "position": { + "start": { "line": 192, "column": 35, "offset": 7489 }, + "end": { "line": 195, "column": 23, "offset": 7659 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 195, "column": 23, "offset": 7659 }, + "end": { "line": 195, "column": 31, "offset": 7667 } + } + }, + { + "type": "text", + "value": "s, typically ", + "position": { + "start": { "line": 195, "column": 31, "offset": 7667 }, + "end": { "line": 195, "column": 44, "offset": 7680 } + } + }, + { + "type": "inlineCode", + "value": "'utf8'", + "position": { + "start": { "line": 195, "column": 44, "offset": 7680 }, + "end": { "line": 195, "column": 52, "offset": 7688 } + } + }, + { + "type": "text", + "value": " is the right choice.", + "position": { + "start": { "line": 195, "column": 52, "offset": 7688 }, + "end": { "line": 195, "column": 73, "offset": 7709 } + } + } + ], + "position": { + "start": { "line": 192, "column": 3, "offset": 7457 }, + "end": { "line": 195, "column": 73, "offset": 7709 } + } + } + ], + "position": { + "start": { "line": 192, "column": 1, "offset": 7455 }, + "end": { "line": 195, "column": 73, "offset": 7709 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "'ucs2'", + "position": { + "start": { "line": 197, "column": 3, "offset": 7713 }, + "end": { "line": 197, "column": 11, "offset": 7721 } + } + }, + { + "type": "text", + "value": ", ", + "position": { + "start": { "line": 197, "column": 11, "offset": 7721 }, + "end": { "line": 197, "column": 13, "offset": 7723 } + } + }, + { + "type": "inlineCode", + "value": "'ucs-2'", + "position": { + "start": { "line": 197, "column": 13, "offset": 7723 }, + "end": { "line": 197, "column": 22, "offset": 7732 } + } + }, + { + "type": "text", + "value": ": Aliases of ", + "position": { + "start": { "line": 197, "column": 22, "offset": 7732 }, + "end": { "line": 197, "column": 35, "offset": 7745 } + } + }, + { + "type": "inlineCode", + "value": "'utf16le'", + "position": { + "start": { "line": 197, "column": 35, "offset": 7745 }, + "end": { "line": 197, "column": 46, "offset": 7756 } + } + }, + { + "type": "text", + "value": ". UCS-2 used to refer to a variant\nof UTF-16 that did not support characters that had code points larger than\nU+FFFF. In Node.js, these code points are always supported.", + "position": { + "start": { "line": 197, "column": 46, "offset": 7756 }, + "end": { "line": 199, "column": 62, "offset": 7929 } + } + } + ], + "position": { + "start": { "line": 197, "column": 3, "offset": 7713 }, + "end": { "line": 199, "column": 62, "offset": 7929 } + } + } + ], + "position": { + "start": { "line": 197, "column": 1, "offset": 7711 }, + "end": { "line": 199, "column": 62, "offset": 7929 } + } + } + ], + "position": { + "start": { "line": 183, "column": 1, "offset": 6925 }, + "end": { "line": 199, "column": 62, "offset": 7929 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nBuffer.from('1ag123', 'hex');\n// Prints , data truncated when first non-hexadecimal value\n// ('g') encountered.\n\nBuffer.from('1a7', 'hex');\n// Prints , data truncated when data ends in single digit ('7').\n\nBuffer.from('1634', 'hex');\n// Prints , all data represented.", + "position": { + "start": { "line": 201, "column": 1, "offset": 7931 }, + "end": { "line": 213, "column": 4, "offset": 8284 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nBuffer.from('1ag123', 'hex');\n// Prints , data truncated when first non-hexadecimal value\n// ('g') encountered.\n\nBuffer.from('1a7', 'hex');\n// Prints , data truncated when data ends in single digit ('7').\n\nBuffer.from('1634', 'hex');\n// Prints , all data represented.", + "position": { + "start": { "line": 215, "column": 1, "offset": 8286 }, + "end": { "line": 227, "column": 4, "offset": 8644 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Modern Web browsers follow the ", + "position": { + "start": { "line": 229, "column": 1, "offset": 8646 }, + "end": { "line": 229, "column": 32, "offset": 8677 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "text", + "value": "WHATWG Encoding Standard", + "position": { + "start": { "line": 229, "column": 33, "offset": 8678 }, + "end": { "line": 229, "column": 57, "offset": 8702 } + } + } + ], + "position": { + "start": { "line": 229, "column": 32, "offset": 8677 }, + "end": { "line": 229, "column": 60, "offset": 8705 } + }, + "label": "WHATWG Encoding Standard", + "identifier": "whatwg encoding standard", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": " which aliases\nboth ", + "position": { + "start": { "line": 229, "column": 60, "offset": 8705 }, + "end": { "line": 230, "column": 6, "offset": 8725 } + } + }, + { + "type": "inlineCode", + "value": "'latin1'", + "position": { + "start": { "line": 230, "column": 6, "offset": 8725 }, + "end": { "line": 230, "column": 16, "offset": 8735 } + } + }, + { + "type": "text", + "value": " and ", + "position": { + "start": { "line": 230, "column": 16, "offset": 8735 }, + "end": { "line": 230, "column": 21, "offset": 8740 } + } + }, + { + "type": "inlineCode", + "value": "'ISO-8859-1'", + "position": { + "start": { "line": 230, "column": 21, "offset": 8740 }, + "end": { "line": 230, "column": 35, "offset": 8754 } + } + }, + { + "type": "text", + "value": " to ", + "position": { + "start": { "line": 230, "column": 35, "offset": 8754 }, + "end": { "line": 230, "column": 39, "offset": 8758 } + } + }, + { + "type": "inlineCode", + "value": "'win-1252'", + "position": { + "start": { "line": 230, "column": 39, "offset": 8758 }, + "end": { "line": 230, "column": 51, "offset": 8770 } + } + }, + { + "type": "text", + "value": ". This means that while doing\nsomething like ", + "position": { + "start": { "line": 230, "column": 51, "offset": 8770 }, + "end": { "line": 231, "column": 16, "offset": 8815 } + } + }, + { + "type": "inlineCode", + "value": "http.get()", + "position": { + "start": { "line": 231, "column": 16, "offset": 8815 }, + "end": { "line": 231, "column": 28, "offset": 8827 } + } + }, + { + "type": "text", + "value": ", if the returned charset is one of those listed in\nthe WHATWG specification it is possible that the server actually returned\n", + "position": { + "start": { "line": 231, "column": 28, "offset": 8827 }, + "end": { "line": 233, "column": 1, "offset": 8953 } + } + }, + { + "type": "inlineCode", + "value": "'win-1252'", + "position": { + "start": { "line": 233, "column": 1, "offset": 8953 }, + "end": { "line": 233, "column": 13, "offset": 8965 } + } + }, + { + "type": "text", + "value": "-encoded data, and using ", + "position": { + "start": { "line": 233, "column": 13, "offset": 8965 }, + "end": { "line": 233, "column": 38, "offset": 8990 } + } + }, + { + "type": "inlineCode", + "value": "'latin1'", + "position": { + "start": { "line": 233, "column": 38, "offset": 8990 }, + "end": { "line": 233, "column": 48, "offset": 9000 } + } + }, + { + "type": "text", + "value": " encoding may incorrectly decode\nthe characters.", + "position": { + "start": { "line": 233, "column": 48, "offset": 9000 }, + "end": { "line": 234, "column": 16, "offset": 9048 } + } + } + ], + "position": { + "start": { "line": 229, "column": 1, "offset": 8646 }, + "end": { "line": 234, "column": 16, "offset": 9048 } + } + }, + { + "type": "heading", + "depth": 2, + "children": [ + { + "type": "text", + "value": "Buffers and TypedArrays", + "position": { + "start": { "line": 236, "column": 4, "offset": 9053 }, + "end": { "line": 236, "column": 27, "offset": 9076 } + } + } + ], + "position": { + "start": { "line": 236, "column": 1, "offset": 9050 }, + "end": { "line": 236, "column": 27, "offset": 9076 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 238, "column": 1, "offset": 9078 }, + "end": { "line": 243, "column": 4, "offset": 9241 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 245, "column": 1, "offset": 9243 }, + "end": { "line": 245, "column": 9, "offset": 9251 } + } + }, + { + "type": "text", + "value": " instances are also JavaScript {Uint8Array} and {TypedArray}\ninstances. All {TypedArray} methods are available on ", + "position": { + "start": { "line": 245, "column": 9, "offset": 9251 }, + "end": { "line": 246, "column": 54, "offset": 9365 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 246, "column": 54, "offset": 9365 }, + "end": { "line": 246, "column": 62, "offset": 9373 } + } + }, + { + "type": "text", + "value": "s. There are,\nhowever, subtle incompatibilities between the ", + "position": { + "start": { "line": 246, "column": 62, "offset": 9373 }, + "end": { "line": 247, "column": 47, "offset": 9433 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 247, "column": 47, "offset": 9433 }, + "end": { "line": 247, "column": 55, "offset": 9441 } + } + }, + { + "type": "text", + "value": " API and the\n{TypedArray} API.", + "position": { + "start": { "line": 247, "column": 55, "offset": 9441 }, + "end": { "line": 248, "column": 18, "offset": 9471 } + } + } + ], + "position": { + "start": { "line": 245, "column": 1, "offset": 9243 }, + "end": { "line": 248, "column": 18, "offset": 9471 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "In particular:", + "position": { + "start": { "line": 250, "column": 1, "offset": 9473 }, + "end": { "line": 250, "column": 15, "offset": 9487 } + } + } + ], + "position": { + "start": { "line": 250, "column": 1, "offset": 9473 }, + "end": { "line": 250, "column": 15, "offset": 9487 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "While ", + "position": { + "start": { "line": 252, "column": 3, "offset": 9491 }, + "end": { "line": 252, "column": 9, "offset": 9497 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "TypedArray.prototype.slice()", + "position": { + "start": { "line": 252, "column": 10, "offset": 9498 }, + "end": { "line": 252, "column": 40, "offset": 9528 } + } + } + ], + "position": { + "start": { "line": 252, "column": 9, "offset": 9497 }, + "end": { "line": 252, "column": 43, "offset": 9531 } + }, + "label": "`TypedArray.prototype.slice()`", + "identifier": "`typedarray.prototype.slice()`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": " creates a copy of part of the ", + "position": { + "start": { "line": 252, "column": 43, "offset": 9531 }, + "end": { "line": 252, "column": 74, "offset": 9562 } + } + }, + { + "type": "inlineCode", + "value": "TypedArray", + "position": { + "start": { "line": 252, "column": 74, "offset": 9562 }, + "end": { "line": 252, "column": 86, "offset": 9574 } + } + }, + { + "type": "text", + "value": ",\n", + "position": { + "start": { "line": 252, "column": 86, "offset": 9574 }, + "end": { "line": 253, "column": 1, "offset": 9576 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "Buffer.prototype.slice()", + "position": { + "start": { "line": 253, "column": 4, "offset": 9579 }, + "end": { "line": 253, "column": 30, "offset": 9605 } + } + } + ], + "position": { + "start": { "line": 253, "column": 3, "offset": 9578 }, + "end": { "line": 253, "column": 46, "offset": 9621 } + }, + "label": "`buf.slice()`", + "identifier": "`buf.slice()`", + "referenceType": "full" + }, + { + "type": "text", + "value": " creates a view over the existing ", + "position": { + "start": { "line": 253, "column": 46, "offset": 9621 }, + "end": { "line": 253, "column": 80, "offset": 9655 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 253, "column": 80, "offset": 9655 }, + "end": { "line": 253, "column": 88, "offset": 9663 } + } + }, + { + "type": "text", + "value": "\nwithout copying. This behavior can be surprising, and only exists for legacy\ncompatibility. ", + "position": { + "start": { "line": 253, "column": 88, "offset": 9663 }, + "end": { "line": 255, "column": 18, "offset": 9760 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "TypedArray.prototype.subarray()", + "position": { + "start": { "line": 255, "column": 19, "offset": 9761 }, + "end": { "line": 255, "column": 52, "offset": 9794 } + } + } + ], + "position": { + "start": { "line": 255, "column": 18, "offset": 9760 }, + "end": { "line": 255, "column": 55, "offset": 9797 } + }, + "label": "`TypedArray.prototype.subarray()`", + "identifier": "`typedarray.prototype.subarray()`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": " can be used to achieve\nthe behavior of ", + "position": { + "start": { "line": 255, "column": 55, "offset": 9797 }, + "end": { "line": 256, "column": 19, "offset": 9839 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "Buffer.prototype.slice()", + "position": { + "start": { "line": 256, "column": 20, "offset": 9840 }, + "end": { "line": 256, "column": 46, "offset": 9866 } + } + } + ], + "position": { + "start": { "line": 256, "column": 19, "offset": 9839 }, + "end": { "line": 256, "column": 62, "offset": 9882 } + }, + "label": "`buf.slice()`", + "identifier": "`buf.slice()`", + "referenceType": "full" + }, + { + "type": "text", + "value": " on both ", + "position": { + "start": { "line": 256, "column": 62, "offset": 9882 }, + "end": { "line": 256, "column": 71, "offset": 9891 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 256, "column": 71, "offset": 9891 }, + "end": { "line": 256, "column": 79, "offset": 9899 } + } + }, + { + "type": "text", + "value": "s\nand other ", + "position": { + "start": { "line": 256, "column": 79, "offset": 9899 }, + "end": { "line": 257, "column": 13, "offset": 9913 } + } + }, + { + "type": "inlineCode", + "value": "TypedArray", + "position": { + "start": { "line": 257, "column": 13, "offset": 9913 }, + "end": { "line": 257, "column": 25, "offset": 9925 } + } + }, + { + "type": "text", + "value": "s and should be preferred.", + "position": { + "start": { "line": 257, "column": 25, "offset": 9925 }, + "end": { "line": 257, "column": 51, "offset": 9951 } + } + } + ], + "position": { + "start": { "line": 252, "column": 3, "offset": 9491 }, + "end": { "line": 257, "column": 51, "offset": 9951 } + } + } + ], + "position": { + "start": { "line": 252, "column": 1, "offset": 9489 }, + "end": { "line": 257, "column": 51, "offset": 9951 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "buf.toString()", + "position": { + "start": { "line": 258, "column": 4, "offset": 9955 }, + "end": { "line": 258, "column": 20, "offset": 9971 } + } + } + ], + "position": { + "start": { "line": 258, "column": 3, "offset": 9954 }, + "end": { "line": 258, "column": 23, "offset": 9974 } + }, + "label": "`buf.toString()`", + "identifier": "`buf.tostring()`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": " is incompatible with its ", + "position": { + "start": { "line": 258, "column": 23, "offset": 9974 }, + "end": { "line": 258, "column": 49, "offset": 10000 } + } + }, + { + "type": "inlineCode", + "value": "TypedArray", + "position": { + "start": { "line": 258, "column": 49, "offset": 10000 }, + "end": { "line": 258, "column": 61, "offset": 10012 } + } + }, + { + "type": "text", + "value": " equivalent.", + "position": { + "start": { "line": 258, "column": 61, "offset": 10012 }, + "end": { "line": 258, "column": 73, "offset": 10024 } + } + } + ], + "position": { + "start": { "line": 258, "column": 3, "offset": 9954 }, + "end": { "line": 258, "column": 73, "offset": 10024 } + } + } + ], + "position": { + "start": { "line": 258, "column": 1, "offset": 9952 }, + "end": { "line": 258, "column": 73, "offset": 10024 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "A number of methods, e.g. ", + "position": { + "start": { "line": 259, "column": 3, "offset": 10027 }, + "end": { "line": 259, "column": 29, "offset": 10053 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "buf.indexOf()", + "position": { + "start": { "line": 259, "column": 30, "offset": 10054 }, + "end": { "line": 259, "column": 45, "offset": 10069 } + } + } + ], + "position": { + "start": { "line": 259, "column": 29, "offset": 10053 }, + "end": { "line": 259, "column": 48, "offset": 10072 } + }, + "label": "`buf.indexOf()`", + "identifier": "`buf.indexof()`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": ", support additional arguments.", + "position": { + "start": { "line": 259, "column": 48, "offset": 10072 }, + "end": { "line": 259, "column": 79, "offset": 10103 } + } + } + ], + "position": { + "start": { "line": 259, "column": 3, "offset": 10027 }, + "end": { "line": 259, "column": 79, "offset": 10103 } + } + } + ], + "position": { + "start": { "line": 259, "column": 1, "offset": 10025 }, + "end": { "line": 259, "column": 79, "offset": 10103 } + } + } + ], + "position": { + "start": { "line": 252, "column": 1, "offset": 9489 }, + "end": { "line": 259, "column": 79, "offset": 10103 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "There are two ways to create new {TypedArray} instances from a ", + "position": { + "start": { "line": 261, "column": 1, "offset": 10105 }, + "end": { "line": 261, "column": 64, "offset": 10168 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 261, "column": 64, "offset": 10168 }, + "end": { "line": 261, "column": 72, "offset": 10176 } + } + }, + { + "type": "text", + "value": ":", + "position": { + "start": { "line": 261, "column": 72, "offset": 10176 }, + "end": { "line": 261, "column": 73, "offset": 10177 } + } + } + ], + "position": { + "start": { "line": 261, "column": 1, "offset": 10105 }, + "end": { "line": 261, "column": 73, "offset": 10177 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Passing a ", + "position": { + "start": { "line": 263, "column": 3, "offset": 10181 }, + "end": { "line": 263, "column": 13, "offset": 10191 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 263, "column": 13, "offset": 10191 }, + "end": { "line": 263, "column": 21, "offset": 10199 } + } + }, + { + "type": "text", + "value": " to a {TypedArray} constructor will copy the ", + "position": { + "start": { "line": 263, "column": 21, "offset": 10199 }, + "end": { "line": 263, "column": 66, "offset": 10244 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 263, "column": 66, "offset": 10244 }, + "end": { "line": 263, "column": 74, "offset": 10252 } + } + }, + { + "type": "text", + "value": "'s\ncontents, interpreted as an array of integers, and not as a byte sequence\nof the target type.", + "position": { + "start": { "line": 263, "column": 74, "offset": 10252 }, + "end": { "line": 265, "column": 22, "offset": 10352 } + } + } + ], + "position": { + "start": { "line": 263, "column": 3, "offset": 10181 }, + "end": { "line": 265, "column": 22, "offset": 10352 } + } + } + ], + "position": { + "start": { "line": 263, "column": 1, "offset": 10179 }, + "end": { "line": 265, "column": 22, "offset": 10352 } + } + } + ], + "position": { + "start": { "line": 263, "column": 1, "offset": 10179 }, + "end": { "line": 265, "column": 22, "offset": 10352 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from([1, 2, 3, 4]);\nconst uint32array = new Uint32Array(buf);\n\nconsole.log(uint32array);\n\n// Prints: Uint32Array(4) [ 1, 2, 3, 4 ]", + "position": { + "start": { "line": 267, "column": 1, "offset": 10354 }, + "end": { "line": 276, "column": 4, "offset": 10553 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from([1, 2, 3, 4]);\nconst uint32array = new Uint32Array(buf);\n\nconsole.log(uint32array);\n\n// Prints: Uint32Array(4) [ 1, 2, 3, 4 ]", + "position": { + "start": { "line": 278, "column": 1, "offset": 10555 }, + "end": { "line": 287, "column": 4, "offset": 10759 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Passing the ", + "position": { + "start": { "line": 289, "column": 3, "offset": 10763 }, + "end": { "line": 289, "column": 15, "offset": 10775 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 289, "column": 15, "offset": 10775 }, + "end": { "line": 289, "column": 23, "offset": 10783 } + } + }, + { + "type": "text", + "value": "'s underlying {ArrayBuffer} will create a\n{TypedArray} that shares its memory with the ", + "position": { + "start": { "line": 289, "column": 23, "offset": 10783 }, + "end": { "line": 290, "column": 48, "offset": 10872 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 290, "column": 48, "offset": 10872 }, + "end": { "line": 290, "column": 56, "offset": 10880 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 290, "column": 56, "offset": 10880 }, + "end": { "line": 290, "column": 57, "offset": 10881 } + } + } + ], + "position": { + "start": { "line": 289, "column": 3, "offset": 10763 }, + "end": { "line": 290, "column": 57, "offset": 10881 } + } + } + ], + "position": { + "start": { "line": 289, "column": 1, "offset": 10761 }, + "end": { "line": 290, "column": 57, "offset": 10881 } + } + } + ], + "position": { + "start": { "line": 289, "column": 1, "offset": 10761 }, + "end": { "line": 290, "column": 57, "offset": 10881 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from('hello', 'utf16le');\nconst uint16array = new Uint16Array(\n buf.buffer,\n buf.byteOffset,\n buf.length / Uint16Array.BYTES_PER_ELEMENT);\n\nconsole.log(uint16array);\n\n// Prints: Uint16Array(5) [ 104, 101, 108, 108, 111 ]", + "position": { + "start": { "line": 292, "column": 1, "offset": 10883 }, + "end": { "line": 304, "column": 4, "offset": 11175 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from('hello', 'utf16le');\nconst uint16array = new Uint16Array(\n buf.buffer,\n buf.byteOffset,\n buf.length / Uint16Array.BYTES_PER_ELEMENT);\n\nconsole.log(uint16array);\n\n// Prints: Uint16Array(5) [ 104, 101, 108, 108, 111 ]", + "position": { + "start": { "line": 306, "column": 1, "offset": 11177 }, + "end": { "line": 318, "column": 4, "offset": 11474 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "It is possible to create a new ", + "position": { + "start": { "line": 320, "column": 1, "offset": 11476 }, + "end": { "line": 320, "column": 32, "offset": 11507 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 320, "column": 32, "offset": 11507 }, + "end": { "line": 320, "column": 40, "offset": 11515 } + } + }, + { + "type": "text", + "value": " that shares the same allocated\nmemory as a {TypedArray} instance by using the ", + "position": { + "start": { "line": 320, "column": 40, "offset": 11515 }, + "end": { "line": 321, "column": 48, "offset": 11594 } + } + }, + { + "type": "inlineCode", + "value": "TypedArray", + "position": { + "start": { "line": 321, "column": 48, "offset": 11594 }, + "end": { "line": 321, "column": 60, "offset": 11606 } + } + }, + { + "type": "text", + "value": " object's\n", + "position": { + "start": { "line": 321, "column": 60, "offset": 11606 }, + "end": { "line": 322, "column": 1, "offset": 11616 } + } + }, + { + "type": "inlineCode", + "value": ".buffer", + "position": { + "start": { "line": 322, "column": 1, "offset": 11616 }, + "end": { "line": 322, "column": 10, "offset": 11625 } + } + }, + { + "type": "text", + "value": " property in the same way. ", + "position": { + "start": { "line": 322, "column": 10, "offset": 11625 }, + "end": { "line": 322, "column": 37, "offset": 11652 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "Buffer.from()", + "position": { + "start": { "line": 322, "column": 38, "offset": 11653 }, + "end": { "line": 322, "column": 53, "offset": 11668 } + } + } + ], + "position": { + "start": { "line": 322, "column": 37, "offset": 11652 }, + "end": { "line": 322, "column": 79, "offset": 11694 } + }, + "label": "`Buffer.from(arrayBuf)`", + "identifier": "`buffer.from(arraybuf)`", + "referenceType": "full" + }, + { + "type": "text", + "value": "\nbehaves like ", + "position": { + "start": { "line": 322, "column": 79, "offset": 11694 }, + "end": { "line": 323, "column": 14, "offset": 11708 } + } + }, + { + "type": "inlineCode", + "value": "new Uint8Array()", + "position": { + "start": { "line": 323, "column": 14, "offset": 11708 }, + "end": { "line": 323, "column": 32, "offset": 11726 } + } + }, + { + "type": "text", + "value": " in this context.", + "position": { + "start": { "line": 323, "column": 32, "offset": 11726 }, + "end": { "line": 323, "column": 49, "offset": 11743 } + } + } + ], + "position": { + "start": { "line": 320, "column": 1, "offset": 11476 }, + "end": { "line": 323, "column": 49, "offset": 11743 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst arr = new Uint16Array(2);\n\narr[0] = 5000;\narr[1] = 4000;\n\n// Copies the contents of `arr`.\nconst buf1 = Buffer.from(arr);\n\n// Shares memory with `arr`.\nconst buf2 = Buffer.from(arr.buffer);\n\nconsole.log(buf1);\n// Prints: \nconsole.log(buf2);\n// Prints: \n\narr[1] = 6000;\n\nconsole.log(buf1);\n// Prints: \nconsole.log(buf2);\n// Prints: ", + "position": { + "start": { "line": 325, "column": 1, "offset": 11745 }, + "end": { "line": 350, "column": 4, "offset": 12200 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst arr = new Uint16Array(2);\n\narr[0] = 5000;\narr[1] = 4000;\n\n// Copies the contents of `arr`.\nconst buf1 = Buffer.from(arr);\n\n// Shares memory with `arr`.\nconst buf2 = Buffer.from(arr.buffer);\n\nconsole.log(buf1);\n// Prints: \nconsole.log(buf2);\n// Prints: \n\narr[1] = 6000;\n\nconsole.log(buf1);\n// Prints: \nconsole.log(buf2);\n// Prints: ", + "position": { + "start": { "line": 352, "column": 1, "offset": 12202 }, + "end": { "line": 377, "column": 4, "offset": 12662 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "When creating a ", + "position": { + "start": { "line": 379, "column": 1, "offset": 12664 }, + "end": { "line": 379, "column": 17, "offset": 12680 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 379, "column": 17, "offset": 12680 }, + "end": { "line": 379, "column": 25, "offset": 12688 } + } + }, + { + "type": "text", + "value": " using a {TypedArray}'s ", + "position": { + "start": { "line": 379, "column": 25, "offset": 12688 }, + "end": { "line": 379, "column": 49, "offset": 12712 } + } + }, + { + "type": "inlineCode", + "value": ".buffer", + "position": { + "start": { "line": 379, "column": 49, "offset": 12712 }, + "end": { "line": 379, "column": 58, "offset": 12721 } + } + }, + { + "type": "text", + "value": ", it is\npossible to use only a portion of the underlying {ArrayBuffer} by passing in\n", + "position": { + "start": { "line": 379, "column": 58, "offset": 12721 }, + "end": { "line": 381, "column": 1, "offset": 12806 } + } + }, + { + "type": "inlineCode", + "value": "byteOffset", + "position": { + "start": { "line": 381, "column": 1, "offset": 12806 }, + "end": { "line": 381, "column": 13, "offset": 12818 } + } + }, + { + "type": "text", + "value": " and ", + "position": { + "start": { "line": 381, "column": 13, "offset": 12818 }, + "end": { "line": 381, "column": 18, "offset": 12823 } + } + }, + { + "type": "inlineCode", + "value": "length", + "position": { + "start": { "line": 381, "column": 18, "offset": 12823 }, + "end": { "line": 381, "column": 26, "offset": 12831 } + } + }, + { + "type": "text", + "value": " parameters.", + "position": { + "start": { "line": 381, "column": 26, "offset": 12831 }, + "end": { "line": 381, "column": 38, "offset": 12843 } + } + } + ], + "position": { + "start": { "line": 379, "column": 1, "offset": 12664 }, + "end": { "line": 381, "column": 38, "offset": 12843 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst arr = new Uint16Array(20);\nconst buf = Buffer.from(arr.buffer, 0, 16);\n\nconsole.log(buf.length);\n// Prints: 16", + "position": { + "start": { "line": 383, "column": 1, "offset": 12845 }, + "end": { "line": 391, "column": 4, "offset": 13011 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst arr = new Uint16Array(20);\nconst buf = Buffer.from(arr.buffer, 0, 16);\n\nconsole.log(buf.length);\n// Prints: 16", + "position": { + "start": { "line": 393, "column": 1, "offset": 13013 }, + "end": { "line": 401, "column": 4, "offset": 13184 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "The ", + "position": { + "start": { "line": 403, "column": 1, "offset": 13186 }, + "end": { "line": 403, "column": 5, "offset": 13190 } + } + }, + { + "type": "inlineCode", + "value": "Buffer.from()", + "position": { + "start": { "line": 403, "column": 5, "offset": 13190 }, + "end": { "line": 403, "column": 20, "offset": 13205 } + } + }, + { + "type": "text", + "value": " and ", + "position": { + "start": { "line": 403, "column": 20, "offset": 13205 }, + "end": { "line": 403, "column": 25, "offset": 13210 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "TypedArray.from()", + "position": { + "start": { "line": 403, "column": 26, "offset": 13211 }, + "end": { "line": 403, "column": 45, "offset": 13230 } + } + } + ], + "position": { + "start": { "line": 403, "column": 25, "offset": 13210 }, + "end": { "line": 403, "column": 48, "offset": 13233 } + }, + "label": "`TypedArray.from()`", + "identifier": "`typedarray.from()`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": " have different signatures and\nimplementations. Specifically, the {TypedArray} variants accept a second\nargument that is a mapping function that is invoked on every element of the\ntyped array:", + "position": { + "start": { "line": 403, "column": 48, "offset": 13233 }, + "end": { "line": 406, "column": 13, "offset": 13425 } + } + } + ], + "position": { + "start": { "line": 403, "column": 1, "offset": 13186 }, + "end": { "line": 406, "column": 13, "offset": 13425 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "TypedArray.from(source[, mapFn[, thisArg]])", + "position": { + "start": { "line": 408, "column": 3, "offset": 13429 }, + "end": { "line": 408, "column": 48, "offset": 13474 } + } + } + ], + "position": { + "start": { "line": 408, "column": 3, "offset": 13429 }, + "end": { "line": 408, "column": 48, "offset": 13474 } + } + } + ], + "position": { + "start": { "line": 408, "column": 1, "offset": 13427 }, + "end": { "line": 408, "column": 48, "offset": 13474 } + } + } + ], + "position": { + "start": { "line": 408, "column": 1, "offset": 13427 }, + "end": { "line": 408, "column": 48, "offset": 13474 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "The ", + "position": { + "start": { "line": 410, "column": 1, "offset": 13476 }, + "end": { "line": 410, "column": 5, "offset": 13480 } + } + }, + { + "type": "inlineCode", + "value": "Buffer.from()", + "position": { + "start": { "line": 410, "column": 5, "offset": 13480 }, + "end": { "line": 410, "column": 20, "offset": 13495 } + } + }, + { + "type": "text", + "value": " method, however, does not support the use of a mapping\nfunction:", + "position": { + "start": { "line": 410, "column": 20, "offset": 13495 }, + "end": { "line": 411, "column": 10, "offset": 13560 } + } + } + ], + "position": { + "start": { "line": 410, "column": 1, "offset": 13476 }, + "end": { "line": 411, "column": 10, "offset": 13560 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "Buffer.from(array)", + "position": { + "start": { "line": 413, "column": 4, "offset": 13565 }, + "end": { "line": 413, "column": 24, "offset": 13585 } + } + } + ], + "position": { + "start": { "line": 413, "column": 3, "offset": 13564 }, + "end": { "line": 413, "column": 27, "offset": 13588 } + }, + "label": "`Buffer.from(array)`", + "identifier": "`buffer.from(array)`", + "referenceType": "collapsed" + } + ], + "position": { + "start": { "line": 413, "column": 3, "offset": 13564 }, + "end": { "line": 413, "column": 27, "offset": 13588 } + } + } + ], + "position": { + "start": { "line": 413, "column": 1, "offset": 13562 }, + "end": { "line": 413, "column": 27, "offset": 13588 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "Buffer.from(buffer)", + "position": { + "start": { "line": 414, "column": 4, "offset": 13592 }, + "end": { "line": 414, "column": 25, "offset": 13613 } + } + } + ], + "position": { + "start": { "line": 414, "column": 3, "offset": 13591 }, + "end": { "line": 414, "column": 28, "offset": 13616 } + }, + "label": "`Buffer.from(buffer)`", + "identifier": "`buffer.from(buffer)`", + "referenceType": "collapsed" + } + ], + "position": { + "start": { "line": 414, "column": 3, "offset": 13591 }, + "end": { "line": 414, "column": 28, "offset": 13616 } + } + } + ], + "position": { + "start": { "line": 414, "column": 1, "offset": 13589 }, + "end": { "line": 414, "column": 28, "offset": 13616 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "Buffer.from(arrayBuffer[, byteOffset[, length]])", + "position": { + "start": { "line": 415, "column": 4, "offset": 13620 }, + "end": { "line": 415, "column": 54, "offset": 13670 } + } + } + ], + "position": { + "start": { "line": 415, "column": 3, "offset": 13619 }, + "end": { "line": 415, "column": 80, "offset": 13696 } + }, + "label": "`Buffer.from(arrayBuf)`", + "identifier": "`buffer.from(arraybuf)`", + "referenceType": "full" + } + ], + "position": { + "start": { "line": 415, "column": 3, "offset": 13619 }, + "end": { "line": 415, "column": 80, "offset": 13696 } + } + } + ], + "position": { + "start": { "line": 415, "column": 1, "offset": 13617 }, + "end": { "line": 415, "column": 80, "offset": 13696 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "Buffer.from(string[, encoding])", + "position": { + "start": { "line": 416, "column": 4, "offset": 13700 }, + "end": { "line": 416, "column": 37, "offset": 13733 } + } + } + ], + "position": { + "start": { "line": 416, "column": 3, "offset": 13699 }, + "end": { "line": 416, "column": 61, "offset": 13757 } + }, + "label": "`Buffer.from(string)`", + "identifier": "`buffer.from(string)`", + "referenceType": "full" + } + ], + "position": { + "start": { "line": 416, "column": 3, "offset": 13699 }, + "end": { "line": 416, "column": 61, "offset": 13757 } + } + } + ], + "position": { + "start": { "line": 416, "column": 1, "offset": 13697 }, + "end": { "line": 416, "column": 61, "offset": 13757 } + } + } + ], + "position": { + "start": { "line": 413, "column": 1, "offset": 13562 }, + "end": { "line": 416, "column": 61, "offset": 13757 } + } + }, + { + "type": "heading", + "depth": 2, + "children": [ + { + "type": "text", + "value": "Buffers and iteration", + "position": { + "start": { "line": 418, "column": 4, "offset": 13762 }, + "end": { "line": 418, "column": 25, "offset": 13783 } + } + } + ], + "position": { + "start": { "line": 418, "column": 1, "offset": 13759 }, + "end": { "line": 418, "column": 25, "offset": 13783 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 420, "column": 1, "offset": 13785 }, + "end": { "line": 420, "column": 9, "offset": 13793 } + } + }, + { + "type": "text", + "value": " instances can be iterated over using ", + "position": { + "start": { "line": 420, "column": 9, "offset": 13793 }, + "end": { "line": 420, "column": 47, "offset": 13831 } + } + }, + { + "type": "inlineCode", + "value": "for..of", + "position": { + "start": { "line": 420, "column": 47, "offset": 13831 }, + "end": { "line": 420, "column": 56, "offset": 13840 } + } + }, + { + "type": "text", + "value": " syntax:", + "position": { + "start": { "line": 420, "column": 56, "offset": 13840 }, + "end": { "line": 420, "column": 64, "offset": 13848 } + } + } + ], + "position": { + "start": { "line": 420, "column": 1, "offset": 13785 }, + "end": { "line": 420, "column": 64, "offset": 13848 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from([1, 2, 3]);\n\nfor (const b of buf) {\n console.log(b);\n}\n// Prints:\n// 1\n// 2\n// 3", + "position": { + "start": { "line": 422, "column": 1, "offset": 13850 }, + "end": { "line": 434, "column": 4, "offset": 14011 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from([1, 2, 3]);\n\nfor (const b of buf) {\n console.log(b);\n}\n// Prints:\n// 1\n// 2\n// 3", + "position": { + "start": { "line": 436, "column": 1, "offset": 14013 }, + "end": { "line": 448, "column": 4, "offset": 14179 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Additionally, the ", + "position": { + "start": { "line": 450, "column": 1, "offset": 14181 }, + "end": { "line": 450, "column": 19, "offset": 14199 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "buf.values()", + "position": { + "start": { "line": 450, "column": 20, "offset": 14200 }, + "end": { "line": 450, "column": 34, "offset": 14214 } + } + } + ], + "position": { + "start": { "line": 450, "column": 19, "offset": 14199 }, + "end": { "line": 450, "column": 37, "offset": 14217 } + }, + "label": "`buf.values()`", + "identifier": "`buf.values()`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": ", ", + "position": { + "start": { "line": 450, "column": 37, "offset": 14217 }, + "end": { "line": 450, "column": 39, "offset": 14219 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "buf.keys()", + "position": { + "start": { "line": 450, "column": 40, "offset": 14220 }, + "end": { "line": 450, "column": 52, "offset": 14232 } + } + } + ], + "position": { + "start": { "line": 450, "column": 39, "offset": 14219 }, + "end": { "line": 450, "column": 55, "offset": 14235 } + }, + "label": "`buf.keys()`", + "identifier": "`buf.keys()`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": ", and\n", + "position": { + "start": { "line": 450, "column": 55, "offset": 14235 }, + "end": { "line": 451, "column": 1, "offset": 14241 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "buf.entries()", + "position": { + "start": { "line": 451, "column": 2, "offset": 14242 }, + "end": { "line": 451, "column": 17, "offset": 14257 } + } + } + ], + "position": { + "start": { "line": 451, "column": 1, "offset": 14241 }, + "end": { "line": 451, "column": 20, "offset": 14260 } + }, + "label": "`buf.entries()`", + "identifier": "`buf.entries()`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": " methods can be used to create iterators.", + "position": { + "start": { "line": 451, "column": 20, "offset": 14260 }, + "end": { "line": 451, "column": 61, "offset": 14301 } + } + } + ], + "position": { + "start": { "line": 450, "column": 1, "offset": 14181 }, + "end": { "line": 451, "column": 61, "offset": 14301 } + } + }, + { + "type": "heading", + "depth": 2, + "children": [ + { + "type": "text", + "value": "Class: ", + "position": { + "start": { "line": 453, "column": 4, "offset": 14306 }, + "end": { "line": 453, "column": 11, "offset": 14313 } + } + }, + { + "type": "inlineCode", + "value": "Blob", + "position": { + "start": { "line": 453, "column": 11, "offset": 14313 }, + "end": { "line": 453, "column": 17, "offset": 14319 } + } + } + ], + "position": { + "start": { "line": 453, "column": 1, "offset": 14303 }, + "end": { "line": 453, "column": 17, "offset": 14319 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 455, "column": 1, "offset": 14321 }, + "end": { "line": 465, "column": 4, "offset": 14512 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "A ", + "position": { + "start": { "line": 467, "column": 1, "offset": 14514 }, + "end": { "line": 467, "column": 3, "offset": 14516 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "Blob", + "position": { + "start": { "line": 467, "column": 4, "offset": 14517 }, + "end": { "line": 467, "column": 10, "offset": 14523 } + } + } + ], + "position": { + "start": { "line": 467, "column": 3, "offset": 14516 }, + "end": { "line": 467, "column": 13, "offset": 14526 } + }, + "label": "`Blob`", + "identifier": "`blob`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": " encapsulates immutable, raw data that can be safely shared across\nmultiple worker threads.", + "position": { + "start": { "line": 467, "column": 13, "offset": 14526 }, + "end": { "line": 468, "column": 25, "offset": 14617 } + } + } + ], + "position": { + "start": { "line": 467, "column": 1, "offset": 14514 }, + "end": { "line": 468, "column": 25, "offset": 14617 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "new buffer.Blob([sources[, options]])", + "position": { + "start": { "line": 470, "column": 5, "offset": 14623 }, + "end": { "line": 470, "column": 44, "offset": 14662 } + } + } + ], + "position": { + "start": { "line": 470, "column": 1, "offset": 14619 }, + "end": { "line": 470, "column": 44, "offset": 14662 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 472, "column": 1, "offset": 14664 }, + "end": { "line": 481, "column": 4, "offset": 14936 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "sources", + "position": { + "start": { "line": 483, "column": 3, "offset": 14940 }, + "end": { "line": 483, "column": 12, "offset": 14949 } + } + }, + { + "type": "text", + "value": " {string[]|ArrayBuffer[]|TypedArray[]|DataView[]|Blob[]} An\narray of string, {ArrayBuffer}, {TypedArray}, {DataView}, or {Blob} objects,\nor any mix of such objects, that will be stored within the ", + "position": { + "start": { "line": 483, "column": 12, "offset": 14949 }, + "end": { "line": 485, "column": 62, "offset": 15154 } + } + }, + { + "type": "inlineCode", + "value": "Blob", + "position": { + "start": { "line": 485, "column": 62, "offset": 15154 }, + "end": { "line": 485, "column": 68, "offset": 15160 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 485, "column": 68, "offset": 15160 }, + "end": { "line": 485, "column": 69, "offset": 15161 } + } + } + ], + "position": { + "start": { "line": 483, "column": 3, "offset": 14940 }, + "end": { "line": 485, "column": 69, "offset": 15161 } + } + } + ], + "position": { + "start": { "line": 483, "column": 1, "offset": 14938 }, + "end": { "line": 485, "column": 69, "offset": 15161 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "options", + "position": { + "start": { "line": 486, "column": 3, "offset": 15164 }, + "end": { "line": 486, "column": 12, "offset": 15173 } + } + }, + { + "type": "text", + "value": " {Object}", + "position": { + "start": { "line": 486, "column": 12, "offset": 15173 }, + "end": { "line": 486, "column": 21, "offset": 15182 } + } + } + ], + "position": { + "start": { "line": 486, "column": 3, "offset": 15164 }, + "end": { "line": 486, "column": 21, "offset": 15182 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "endings", + "position": { + "start": { + "line": 487, + "column": 5, + "offset": 15187 + }, + "end": { + "line": 487, + "column": 14, + "offset": 15196 + } + } + }, + { + "type": "text", + "value": " {string} One of either ", + "position": { + "start": { + "line": 487, + "column": 14, + "offset": 15196 + }, + "end": { + "line": 487, + "column": 38, + "offset": 15220 + } + } + }, + { + "type": "inlineCode", + "value": "'transparent'", + "position": { + "start": { + "line": 487, + "column": 38, + "offset": 15220 + }, + "end": { + "line": 487, + "column": 53, + "offset": 15235 + } + } + }, + { + "type": "text", + "value": " or ", + "position": { + "start": { + "line": 487, + "column": 53, + "offset": 15235 + }, + "end": { + "line": 487, + "column": 57, + "offset": 15239 + } + } + }, + { + "type": "inlineCode", + "value": "'native'", + "position": { + "start": { + "line": 487, + "column": 57, + "offset": 15239 + }, + "end": { + "line": 487, + "column": 67, + "offset": 15249 + } + } + }, + { + "type": "text", + "value": ". When set\nto ", + "position": { + "start": { + "line": 487, + "column": 67, + "offset": 15249 + }, + "end": { "line": 488, "column": 8, "offset": 15267 } + } + }, + { + "type": "inlineCode", + "value": "'native'", + "position": { + "start": { + "line": 488, + "column": 8, + "offset": 15267 + }, + "end": { + "line": 488, + "column": 18, + "offset": 15277 + } + } + }, + { + "type": "text", + "value": ", line endings in string source parts will be converted to\nthe platform native line-ending as specified by ", + "position": { + "start": { + "line": 488, + "column": 18, + "offset": 15277 + }, + "end": { + "line": 489, + "column": 53, + "offset": 15388 + } + } + }, + { + "type": "inlineCode", + "value": "require('node:os').EOL", + "position": { + "start": { + "line": 489, + "column": 53, + "offset": 15388 + }, + "end": { + "line": 489, + "column": 77, + "offset": 15412 + } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { + "line": 489, + "column": 77, + "offset": 15412 + }, + "end": { + "line": 489, + "column": 78, + "offset": 15413 + } + } + } + ], + "position": { + "start": { "line": 487, "column": 5, "offset": 15187 }, + "end": { "line": 489, "column": 78, "offset": 15413 } + } + } + ], + "position": { + "start": { "line": 487, "column": 3, "offset": 15185 }, + "end": { "line": 489, "column": 78, "offset": 15413 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "type", + "position": { + "start": { + "line": 490, + "column": 5, + "offset": 15418 + }, + "end": { + "line": 490, + "column": 11, + "offset": 15424 + } + } + }, + { + "type": "text", + "value": " {string} The Blob content-type. The intent is for ", + "position": { + "start": { + "line": 490, + "column": 11, + "offset": 15424 + }, + "end": { + "line": 490, + "column": 62, + "offset": 15475 + } + } + }, + { + "type": "inlineCode", + "value": "type", + "position": { + "start": { + "line": 490, + "column": 62, + "offset": 15475 + }, + "end": { + "line": 490, + "column": 68, + "offset": 15481 + } + } + }, + { + "type": "text", + "value": " to convey\nthe MIME media type of the data, however no validation of the type format\nis performed.", + "position": { + "start": { + "line": 490, + "column": 68, + "offset": 15481 + }, + "end": { + "line": 492, + "column": 18, + "offset": 15587 + } + } + } + ], + "position": { + "start": { "line": 490, "column": 5, "offset": 15418 }, + "end": { "line": 492, "column": 18, "offset": 15587 } + } + } + ], + "position": { + "start": { "line": 490, "column": 3, "offset": 15416 }, + "end": { "line": 492, "column": 18, "offset": 15587 } + } + } + ], + "position": { + "start": { "line": 487, "column": 3, "offset": 15185 }, + "end": { "line": 492, "column": 18, "offset": 15587 } + } + } + ], + "position": { + "start": { "line": 486, "column": 1, "offset": 15162 }, + "end": { "line": 492, "column": 18, "offset": 15587 } + } + } + ], + "position": { + "start": { "line": 483, "column": 1, "offset": 14938 }, + "end": { "line": 492, "column": 18, "offset": 15587 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Creates a new ", + "position": { + "start": { "line": 494, "column": 1, "offset": 15589 }, + "end": { "line": 494, "column": 15, "offset": 15603 } + } + }, + { + "type": "inlineCode", + "value": "Blob", + "position": { + "start": { "line": 494, "column": 15, "offset": 15603 }, + "end": { "line": 494, "column": 21, "offset": 15609 } + } + }, + { + "type": "text", + "value": " object containing a concatenation of the given sources.", + "position": { + "start": { "line": 494, "column": 21, "offset": 15609 }, + "end": { "line": 494, "column": 77, "offset": 15665 } + } + } + ], + "position": { + "start": { "line": 494, "column": 1, "offset": 15589 }, + "end": { "line": 494, "column": 77, "offset": 15665 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "{ArrayBuffer}, {TypedArray}, {DataView}, and {Buffer} sources are copied into\nthe 'Blob' and can therefore be safely modified after the 'Blob' is created.", + "position": { + "start": { "line": 496, "column": 1, "offset": 15667 }, + "end": { "line": 497, "column": 77, "offset": 15821 } + } + } + ], + "position": { + "start": { "line": 496, "column": 1, "offset": 15667 }, + "end": { "line": 497, "column": 77, "offset": 15821 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "String sources are encoded as UTF-8 byte sequences and copied into the Blob.\nUnmatched surrogate pairs within each string part will be replaced by Unicode\nU+FFFD replacement characters.", + "position": { + "start": { "line": 499, "column": 1, "offset": 15823 }, + "end": { "line": 501, "column": 31, "offset": 16008 } + } + } + ], + "position": { + "start": { "line": 499, "column": 1, "offset": 15823 }, + "end": { "line": 501, "column": 31, "offset": 16008 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "blob.arrayBuffer()", + "position": { + "start": { "line": 503, "column": 5, "offset": 16014 }, + "end": { "line": 503, "column": 25, "offset": 16034 } + } + } + ], + "position": { + "start": { "line": 503, "column": 1, "offset": 16010 }, + "end": { "line": 503, "column": 25, "offset": 16034 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 505, "column": 1, "offset": 16036 }, + "end": { "line": 509, "column": 4, "offset": 16081 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {Promise}", + "position": { + "start": { "line": 511, "column": 3, "offset": 16085 }, + "end": { "line": 511, "column": 21, "offset": 16103 } + } + } + ], + "position": { + "start": { "line": 511, "column": 3, "offset": 16085 }, + "end": { "line": 511, "column": 21, "offset": 16103 } + } + } + ], + "position": { + "start": { "line": 511, "column": 1, "offset": 16083 }, + "end": { "line": 511, "column": 21, "offset": 16103 } + } + } + ], + "position": { + "start": { "line": 511, "column": 1, "offset": 16083 }, + "end": { "line": 511, "column": 21, "offset": 16103 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns a promise that fulfills with an {ArrayBuffer} containing a copy of\nthe ", + "position": { + "start": { "line": 513, "column": 1, "offset": 16105 }, + "end": { "line": 514, "column": 5, "offset": 16184 } + } + }, + { + "type": "inlineCode", + "value": "Blob", + "position": { + "start": { "line": 514, "column": 5, "offset": 16184 }, + "end": { "line": 514, "column": 11, "offset": 16190 } + } + }, + { + "type": "text", + "value": " data.", + "position": { + "start": { "line": 514, "column": 11, "offset": 16190 }, + "end": { "line": 514, "column": 17, "offset": 16196 } + } + } + ], + "position": { + "start": { "line": 513, "column": 1, "offset": 16105 }, + "end": { "line": 514, "column": 17, "offset": 16196 } + } + }, + { + "type": "heading", + "depth": 4, + "children": [ + { + "type": "inlineCode", + "value": "blob.bytes()", + "position": { + "start": { "line": 516, "column": 6, "offset": 16203 }, + "end": { "line": 516, "column": 20, "offset": 16217 } + } + } + ], + "position": { + "start": { "line": 516, "column": 1, "offset": 16198 }, + "end": { "line": 516, "column": 20, "offset": 16217 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 518, "column": 1, "offset": 16219 }, + "end": { "line": 522, "column": 4, "offset": 16264 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "The ", + "position": { + "start": { "line": 524, "column": 1, "offset": 16266 }, + "end": { "line": 524, "column": 5, "offset": 16270 } + } + }, + { + "type": "inlineCode", + "value": "blob.bytes()", + "position": { + "start": { "line": 524, "column": 5, "offset": 16270 }, + "end": { "line": 524, "column": 19, "offset": 16284 } + } + }, + { + "type": "text", + "value": " method returns the byte of the ", + "position": { + "start": { "line": 524, "column": 19, "offset": 16284 }, + "end": { "line": 524, "column": 51, "offset": 16316 } + } + }, + { + "type": "inlineCode", + "value": "Blob", + "position": { + "start": { "line": 524, "column": 51, "offset": 16316 }, + "end": { "line": 524, "column": 57, "offset": 16322 } + } + }, + { + "type": "text", + "value": " object as a ", + "position": { + "start": { "line": 524, "column": 57, "offset": 16322 }, + "end": { "line": 524, "column": 70, "offset": 16335 } + } + }, + { + "type": "inlineCode", + "value": "Promise", + "position": { + "start": { "line": 524, "column": 70, "offset": 16335 }, + "end": { "line": 524, "column": 91, "offset": 16356 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 524, "column": 91, "offset": 16356 }, + "end": { "line": 524, "column": 92, "offset": 16357 } + } + } + ], + "position": { + "start": { "line": 524, "column": 1, "offset": 16266 }, + "end": { "line": 524, "column": 92, "offset": 16357 } + } + }, + { + "type": "code", + "lang": "js", + "meta": null, + "value": "const blob = new Blob(['hello']);\nblob.bytes().then((bytes) => {\n console.log(bytes); // Outputs: Uint8Array(5) [ 104, 101, 108, 108, 111 ]\n});", + "position": { + "start": { "line": 526, "column": 1, "offset": 16359 }, + "end": { "line": 531, "column": 4, "offset": 16513 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "blob.size", + "position": { + "start": { "line": 533, "column": 5, "offset": 16519 }, + "end": { "line": 533, "column": 16, "offset": 16530 } + } + } + ], + "position": { + "start": { "line": 533, "column": 1, "offset": 16515 }, + "end": { "line": 533, "column": 16, "offset": 16530 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 535, "column": 1, "offset": 16532 }, + "end": { "line": 539, "column": 4, "offset": 16577 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "The total size of the ", + "position": { + "start": { "line": 541, "column": 1, "offset": 16579 }, + "end": { "line": 541, "column": 23, "offset": 16601 } + } + }, + { + "type": "inlineCode", + "value": "Blob", + "position": { + "start": { "line": 541, "column": 23, "offset": 16601 }, + "end": { "line": 541, "column": 29, "offset": 16607 } + } + }, + { + "type": "text", + "value": " in bytes.", + "position": { + "start": { "line": 541, "column": 29, "offset": 16607 }, + "end": { "line": 541, "column": 39, "offset": 16617 } + } + } + ], + "position": { + "start": { "line": 541, "column": 1, "offset": 16579 }, + "end": { "line": 541, "column": 39, "offset": 16617 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "blob.slice([start[, end[, type]]])", + "position": { + "start": { "line": 543, "column": 5, "offset": 16623 }, + "end": { "line": 543, "column": 41, "offset": 16659 } + } + } + ], + "position": { + "start": { "line": 543, "column": 1, "offset": 16619 }, + "end": { "line": 543, "column": 41, "offset": 16659 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 545, "column": 1, "offset": 16661 }, + "end": { "line": 549, "column": 4, "offset": 16706 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "start", + "position": { + "start": { "line": 551, "column": 3, "offset": 16710 }, + "end": { "line": 551, "column": 10, "offset": 16717 } + } + }, + { + "type": "text", + "value": " {number} The starting index.", + "position": { + "start": { "line": 551, "column": 10, "offset": 16717 }, + "end": { "line": 551, "column": 39, "offset": 16746 } + } + } + ], + "position": { + "start": { "line": 551, "column": 3, "offset": 16710 }, + "end": { "line": 551, "column": 39, "offset": 16746 } + } + } + ], + "position": { + "start": { "line": 551, "column": 1, "offset": 16708 }, + "end": { "line": 551, "column": 39, "offset": 16746 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "end", + "position": { + "start": { "line": 552, "column": 3, "offset": 16749 }, + "end": { "line": 552, "column": 8, "offset": 16754 } + } + }, + { + "type": "text", + "value": " {number} The ending index.", + "position": { + "start": { "line": 552, "column": 8, "offset": 16754 }, + "end": { "line": 552, "column": 35, "offset": 16781 } + } + } + ], + "position": { + "start": { "line": 552, "column": 3, "offset": 16749 }, + "end": { "line": 552, "column": 35, "offset": 16781 } + } + } + ], + "position": { + "start": { "line": 552, "column": 1, "offset": 16747 }, + "end": { "line": 552, "column": 35, "offset": 16781 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "type", + "position": { + "start": { "line": 553, "column": 3, "offset": 16784 }, + "end": { "line": 553, "column": 9, "offset": 16790 } + } + }, + { + "type": "text", + "value": " {string} The content-type for the new ", + "position": { + "start": { "line": 553, "column": 9, "offset": 16790 }, + "end": { "line": 553, "column": 48, "offset": 16829 } + } + }, + { + "type": "inlineCode", + "value": "Blob", + "position": { + "start": { "line": 553, "column": 48, "offset": 16829 }, + "end": { "line": 553, "column": 54, "offset": 16835 } + } + } + ], + "position": { + "start": { "line": 553, "column": 3, "offset": 16784 }, + "end": { "line": 553, "column": 54, "offset": 16835 } + } + } + ], + "position": { + "start": { "line": 553, "column": 1, "offset": 16782 }, + "end": { "line": 553, "column": 54, "offset": 16835 } + } + } + ], + "position": { + "start": { "line": 551, "column": 1, "offset": 16708 }, + "end": { "line": 553, "column": 54, "offset": 16835 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Creates and returns a new ", + "position": { + "start": { "line": 555, "column": 1, "offset": 16837 }, + "end": { "line": 555, "column": 27, "offset": 16863 } + } + }, + { + "type": "inlineCode", + "value": "Blob", + "position": { + "start": { "line": 555, "column": 27, "offset": 16863 }, + "end": { "line": 555, "column": 33, "offset": 16869 } + } + }, + { + "type": "text", + "value": " containing a subset of this ", + "position": { + "start": { "line": 555, "column": 33, "offset": 16869 }, + "end": { "line": 555, "column": 62, "offset": 16898 } + } + }, + { + "type": "inlineCode", + "value": "Blob", + "position": { + "start": { "line": 555, "column": 62, "offset": 16898 }, + "end": { "line": 555, "column": 68, "offset": 16904 } + } + }, + { + "type": "text", + "value": " objects\ndata. The original ", + "position": { + "start": { "line": 555, "column": 68, "offset": 16904 }, + "end": { "line": 556, "column": 20, "offset": 16932 } + } + }, + { + "type": "inlineCode", + "value": "Blob", + "position": { + "start": { "line": 556, "column": 20, "offset": 16932 }, + "end": { "line": 556, "column": 26, "offset": 16938 } + } + }, + { + "type": "text", + "value": " is not altered.", + "position": { + "start": { "line": 556, "column": 26, "offset": 16938 }, + "end": { "line": 556, "column": 42, "offset": 16954 } + } + } + ], + "position": { + "start": { "line": 555, "column": 1, "offset": 16837 }, + "end": { "line": 556, "column": 42, "offset": 16954 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "blob.stream()", + "position": { + "start": { "line": 558, "column": 5, "offset": 16960 }, + "end": { "line": 558, "column": 20, "offset": 16975 } + } + } + ], + "position": { + "start": { "line": 558, "column": 1, "offset": 16956 }, + "end": { "line": 558, "column": 20, "offset": 16975 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 560, "column": 1, "offset": 16977 }, + "end": { "line": 562, "column": 4, "offset": 17005 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {ReadableStream}", + "position": { + "start": { "line": 564, "column": 3, "offset": 17009 }, + "end": { "line": 564, "column": 28, "offset": 17034 } + } + } + ], + "position": { + "start": { "line": 564, "column": 3, "offset": 17009 }, + "end": { "line": 564, "column": 28, "offset": 17034 } + } + } + ], + "position": { + "start": { "line": 564, "column": 1, "offset": 17007 }, + "end": { "line": 564, "column": 28, "offset": 17034 } + } + } + ], + "position": { + "start": { "line": 564, "column": 1, "offset": 17007 }, + "end": { "line": 564, "column": 28, "offset": 17034 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns a new ", + "position": { + "start": { "line": 566, "column": 1, "offset": 17036 }, + "end": { "line": 566, "column": 15, "offset": 17050 } + } + }, + { + "type": "inlineCode", + "value": "ReadableStream", + "position": { + "start": { "line": 566, "column": 15, "offset": 17050 }, + "end": { "line": 566, "column": 31, "offset": 17066 } + } + }, + { + "type": "text", + "value": " that allows the content of the ", + "position": { + "start": { "line": 566, "column": 31, "offset": 17066 }, + "end": { "line": 566, "column": 63, "offset": 17098 } + } + }, + { + "type": "inlineCode", + "value": "Blob", + "position": { + "start": { "line": 566, "column": 63, "offset": 17098 }, + "end": { "line": 566, "column": 69, "offset": 17104 } + } + }, + { + "type": "text", + "value": " to be read.", + "position": { + "start": { "line": 566, "column": 69, "offset": 17104 }, + "end": { "line": 566, "column": 81, "offset": 17116 } + } + } + ], + "position": { + "start": { "line": 566, "column": 1, "offset": 17036 }, + "end": { "line": 566, "column": 81, "offset": 17116 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "blob.text()", + "position": { + "start": { "line": 568, "column": 5, "offset": 17122 }, + "end": { "line": 568, "column": 18, "offset": 17135 } + } + } + ], + "position": { + "start": { "line": 568, "column": 1, "offset": 17118 }, + "end": { "line": 568, "column": 18, "offset": 17135 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 570, "column": 1, "offset": 17137 }, + "end": { "line": 574, "column": 4, "offset": 17182 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {Promise}", + "position": { + "start": { "line": 576, "column": 3, "offset": 17186 }, + "end": { "line": 576, "column": 21, "offset": 17204 } + } + } + ], + "position": { + "start": { "line": 576, "column": 3, "offset": 17186 }, + "end": { "line": 576, "column": 21, "offset": 17204 } + } + } + ], + "position": { + "start": { "line": 576, "column": 1, "offset": 17184 }, + "end": { "line": 576, "column": 21, "offset": 17204 } + } + } + ], + "position": { + "start": { "line": 576, "column": 1, "offset": 17184 }, + "end": { "line": 576, "column": 21, "offset": 17204 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns a promise that fulfills with the contents of the ", + "position": { + "start": { "line": 578, "column": 1, "offset": 17206 }, + "end": { "line": 578, "column": 58, "offset": 17263 } + } + }, + { + "type": "inlineCode", + "value": "Blob", + "position": { + "start": { "line": 578, "column": 58, "offset": 17263 }, + "end": { "line": 578, "column": 64, "offset": 17269 } + } + }, + { + "type": "text", + "value": " decoded as a\nUTF-8 string.", + "position": { + "start": { "line": 578, "column": 64, "offset": 17269 }, + "end": { "line": 579, "column": 14, "offset": 17296 } + } + } + ], + "position": { + "start": { "line": 578, "column": 1, "offset": 17206 }, + "end": { "line": 579, "column": 14, "offset": 17296 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "blob.type", + "position": { + "start": { "line": 581, "column": 5, "offset": 17302 }, + "end": { "line": 581, "column": 16, "offset": 17313 } + } + } + ], + "position": { + "start": { "line": 581, "column": 1, "offset": 17298 }, + "end": { "line": 581, "column": 16, "offset": 17313 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 583, "column": 1, "offset": 17315 }, + "end": { "line": 587, "column": 4, "offset": 17360 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Type: {string}", + "position": { + "start": { "line": 589, "column": 3, "offset": 17364 }, + "end": { "line": 589, "column": 17, "offset": 17378 } + } + } + ], + "position": { + "start": { "line": 589, "column": 3, "offset": 17364 }, + "end": { "line": 589, "column": 17, "offset": 17378 } + } + } + ], + "position": { + "start": { "line": 589, "column": 1, "offset": 17362 }, + "end": { "line": 589, "column": 17, "offset": 17378 } + } + } + ], + "position": { + "start": { "line": 589, "column": 1, "offset": 17362 }, + "end": { "line": 589, "column": 17, "offset": 17378 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "The content-type of the ", + "position": { + "start": { "line": 591, "column": 1, "offset": 17380 }, + "end": { "line": 591, "column": 25, "offset": 17404 } + } + }, + { + "type": "inlineCode", + "value": "Blob", + "position": { + "start": { "line": 591, "column": 25, "offset": 17404 }, + "end": { "line": 591, "column": 31, "offset": 17410 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 591, "column": 31, "offset": 17410 }, + "end": { "line": 591, "column": 32, "offset": 17411 } + } + } + ], + "position": { + "start": { "line": 591, "column": 1, "offset": 17380 }, + "end": { "line": 591, "column": 32, "offset": 17411 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "Blob", + "position": { + "start": { "line": 593, "column": 5, "offset": 17417 }, + "end": { "line": 593, "column": 11, "offset": 17423 } + } + }, + { + "type": "text", + "value": " objects and ", + "position": { + "start": { "line": 593, "column": 11, "offset": 17423 }, + "end": { "line": 593, "column": 24, "offset": 17436 } + } + }, + { + "type": "inlineCode", + "value": "MessageChannel", + "position": { + "start": { "line": 593, "column": 24, "offset": 17436 }, + "end": { "line": 593, "column": 40, "offset": 17452 } + } + } + ], + "position": { + "start": { "line": 593, "column": 1, "offset": 17413 }, + "end": { "line": 593, "column": 40, "offset": 17452 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Once a {Blob} object is created, it can be sent via ", + "position": { + "start": { "line": 595, "column": 1, "offset": 17454 }, + "end": { "line": 595, "column": 53, "offset": 17506 } + } + }, + { + "type": "inlineCode", + "value": "MessagePort", + "position": { + "start": { "line": 595, "column": 53, "offset": 17506 }, + "end": { "line": 595, "column": 66, "offset": 17519 } + } + }, + { + "type": "text", + "value": " to multiple\ndestinations without transferring or immediately copying the data. The data\ncontained by the ", + "position": { + "start": { "line": 595, "column": 66, "offset": 17519 }, + "end": { "line": 597, "column": 18, "offset": 17625 } + } + }, + { + "type": "inlineCode", + "value": "Blob", + "position": { + "start": { "line": 597, "column": 18, "offset": 17625 }, + "end": { "line": 597, "column": 24, "offset": 17631 } + } + }, + { + "type": "text", + "value": " is copied only when the ", + "position": { + "start": { "line": 597, "column": 24, "offset": 17631 }, + "end": { "line": 597, "column": 49, "offset": 17656 } + } + }, + { + "type": "inlineCode", + "value": "arrayBuffer()", + "position": { + "start": { "line": 597, "column": 49, "offset": 17656 }, + "end": { "line": 597, "column": 64, "offset": 17671 } + } + }, + { + "type": "text", + "value": " or ", + "position": { + "start": { "line": 597, "column": 64, "offset": 17671 }, + "end": { "line": 597, "column": 68, "offset": 17675 } + } + }, + { + "type": "inlineCode", + "value": "text()", + "position": { + "start": { "line": 597, "column": 68, "offset": 17675 }, + "end": { "line": 597, "column": 76, "offset": 17683 } + } + }, + { + "type": "text", + "value": "\nmethods are called.", + "position": { + "start": { "line": 597, "column": 76, "offset": 17683 }, + "end": { "line": 598, "column": 20, "offset": 17703 } + } + } + ], + "position": { + "start": { "line": 595, "column": 1, "offset": 17454 }, + "end": { "line": 598, "column": 20, "offset": 17703 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Blob } from 'node:buffer';\nimport { setTimeout as delay } from 'node:timers/promises';\n\nconst blob = new Blob(['hello there']);\n\nconst mc1 = new MessageChannel();\nconst mc2 = new MessageChannel();\n\nmc1.port1.onmessage = async ({ data }) => {\n console.log(await data.arrayBuffer());\n mc1.port1.close();\n};\n\nmc2.port1.onmessage = async ({ data }) => {\n await delay(1000);\n console.log(await data.arrayBuffer());\n mc2.port1.close();\n};\n\nmc1.port2.postMessage(blob);\nmc2.port2.postMessage(blob);\n\n// The Blob is still usable after posting.\nblob.text().then(console.log);", + "position": { + "start": { "line": 600, "column": 1, "offset": 17705 }, + "end": { "line": 625, "column": 4, "offset": 18296 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Blob } = require('node:buffer');\nconst { setTimeout: delay } = require('node:timers/promises');\n\nconst blob = new Blob(['hello there']);\n\nconst mc1 = new MessageChannel();\nconst mc2 = new MessageChannel();\n\nmc1.port1.onmessage = async ({ data }) => {\n console.log(await data.arrayBuffer());\n mc1.port1.close();\n};\n\nmc2.port1.onmessage = async ({ data }) => {\n await delay(1000);\n console.log(await data.arrayBuffer());\n mc2.port1.close();\n};\n\nmc1.port2.postMessage(blob);\nmc2.port2.postMessage(blob);\n\n// The Blob is still usable after posting.\nblob.text().then(console.log);", + "position": { + "start": { "line": 627, "column": 1, "offset": 18298 }, + "end": { "line": 652, "column": 4, "offset": 18897 } + } + }, + { + "type": "heading", + "depth": 2, + "children": [ + { + "type": "text", + "value": "Class: ", + "position": { + "start": { "line": 654, "column": 4, "offset": 18902 }, + "end": { "line": 654, "column": 11, "offset": 18909 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 654, "column": 11, "offset": 18909 }, + "end": { "line": 654, "column": 19, "offset": 18917 } + } + } + ], + "position": { + "start": { "line": 654, "column": 1, "offset": 18899 }, + "end": { "line": 654, "column": 19, "offset": 18917 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "The ", + "position": { + "start": { "line": 656, "column": 1, "offset": 18919 }, + "end": { "line": 656, "column": 5, "offset": 18923 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 656, "column": 5, "offset": 18923 }, + "end": { "line": 656, "column": 13, "offset": 18931 } + } + }, + { + "type": "text", + "value": " class is a global type for dealing with binary data directly.\nIt can be constructed in a variety of ways.", + "position": { + "start": { "line": 656, "column": 13, "offset": 18931 }, + "end": { "line": 657, "column": 44, "offset": 19037 } + } + } + ], + "position": { + "start": { "line": 656, "column": 1, "offset": 18919 }, + "end": { "line": 657, "column": 44, "offset": 19037 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "text", + "value": "Static method: ", + "position": { + "start": { "line": 659, "column": 5, "offset": 19043 }, + "end": { "line": 659, "column": 20, "offset": 19058 } + } + }, + { + "type": "inlineCode", + "value": "Buffer.alloc(size[, fill[, encoding]])", + "position": { + "start": { "line": 659, "column": 20, "offset": 19058 }, + "end": { "line": 659, "column": 60, "offset": 19098 } + } + } + ], + "position": { + "start": { "line": 659, "column": 1, "offset": 19039 }, + "end": { "line": 659, "column": 60, "offset": 19098 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 661, "column": 1, "offset": 19100 }, + "end": { "line": 684, "column": 4, "offset": 20125 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "size", + "position": { + "start": { "line": 686, "column": 3, "offset": 20129 }, + "end": { "line": 686, "column": 9, "offset": 20135 } + } + }, + { + "type": "text", + "value": " {integer} The desired length of the new ", + "position": { + "start": { "line": 686, "column": 9, "offset": 20135 }, + "end": { "line": 686, "column": 50, "offset": 20176 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 686, "column": 50, "offset": 20176 }, + "end": { "line": 686, "column": 58, "offset": 20184 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 686, "column": 58, "offset": 20184 }, + "end": { "line": 686, "column": 59, "offset": 20185 } + } + } + ], + "position": { + "start": { "line": 686, "column": 3, "offset": 20129 }, + "end": { "line": 686, "column": 59, "offset": 20185 } + } + } + ], + "position": { + "start": { "line": 686, "column": 1, "offset": 20127 }, + "end": { "line": 686, "column": 59, "offset": 20185 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "fill", + "position": { + "start": { "line": 687, "column": 3, "offset": 20188 }, + "end": { "line": 687, "column": 9, "offset": 20194 } + } + }, + { + "type": "text", + "value": " {string|Buffer|Uint8Array|integer} A value to pre-fill the new ", + "position": { + "start": { "line": 687, "column": 9, "offset": 20194 }, + "end": { "line": 687, "column": 73, "offset": 20258 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 687, "column": 73, "offset": 20258 }, + "end": { "line": 687, "column": 81, "offset": 20266 } + } + }, + { + "type": "text", + "value": "\nwith. ", + "position": { + "start": { "line": 687, "column": 81, "offset": 20266 }, + "end": { "line": 688, "column": 9, "offset": 20275 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { "line": 688, "column": 11, "offset": 20277 }, + "end": { "line": 688, "column": 19, "offset": 20285 } + } + } + ], + "position": { + "start": { "line": 688, "column": 9, "offset": 20275 }, + "end": { "line": 688, "column": 21, "offset": 20287 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 688, "column": 21, "offset": 20287 }, + "end": { "line": 688, "column": 22, "offset": 20288 } + } + }, + { + "type": "inlineCode", + "value": "0", + "position": { + "start": { "line": 688, "column": 22, "offset": 20288 }, + "end": { "line": 688, "column": 25, "offset": 20291 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 688, "column": 25, "offset": 20291 }, + "end": { "line": 688, "column": 26, "offset": 20292 } + } + } + ], + "position": { + "start": { "line": 687, "column": 3, "offset": 20188 }, + "end": { "line": 688, "column": 26, "offset": 20292 } + } + } + ], + "position": { + "start": { "line": 687, "column": 1, "offset": 20186 }, + "end": { "line": 688, "column": 26, "offset": 20292 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "encoding", + "position": { + "start": { "line": 689, "column": 3, "offset": 20295 }, + "end": { "line": 689, "column": 13, "offset": 20305 } + } + }, + { + "type": "text", + "value": " {string} If ", + "position": { + "start": { "line": 689, "column": 13, "offset": 20305 }, + "end": { "line": 689, "column": 26, "offset": 20318 } + } + }, + { + "type": "inlineCode", + "value": "fill", + "position": { + "start": { "line": 689, "column": 26, "offset": 20318 }, + "end": { "line": 689, "column": 32, "offset": 20324 } + } + }, + { + "type": "text", + "value": " is a string, this is its encoding.\n", + "position": { + "start": { "line": 689, "column": 32, "offset": 20324 }, + "end": { "line": 690, "column": 1, "offset": 20360 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { "line": 690, "column": 5, "offset": 20364 }, + "end": { "line": 690, "column": 13, "offset": 20372 } + } + } + ], + "position": { + "start": { "line": 690, "column": 3, "offset": 20362 }, + "end": { "line": 690, "column": 15, "offset": 20374 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 690, "column": 15, "offset": 20374 }, + "end": { "line": 690, "column": 16, "offset": 20375 } + } + }, + { + "type": "inlineCode", + "value": "'utf8'", + "position": { + "start": { "line": 690, "column": 16, "offset": 20375 }, + "end": { "line": 690, "column": 24, "offset": 20383 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 690, "column": 24, "offset": 20383 }, + "end": { "line": 690, "column": 25, "offset": 20384 } + } + } + ], + "position": { + "start": { "line": 689, "column": 3, "offset": 20295 }, + "end": { "line": 690, "column": 25, "offset": 20384 } + } + } + ], + "position": { + "start": { "line": 689, "column": 1, "offset": 20293 }, + "end": { "line": 690, "column": 25, "offset": 20384 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {Buffer}", + "position": { + "start": { "line": 691, "column": 3, "offset": 20387 }, + "end": { "line": 691, "column": 20, "offset": 20404 } + } + } + ], + "position": { + "start": { "line": 691, "column": 3, "offset": 20387 }, + "end": { "line": 691, "column": 20, "offset": 20404 } + } + } + ], + "position": { + "start": { "line": 691, "column": 1, "offset": 20385 }, + "end": { "line": 691, "column": 20, "offset": 20404 } + } + } + ], + "position": { + "start": { "line": 686, "column": 1, "offset": 20127 }, + "end": { "line": 691, "column": 20, "offset": 20404 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Allocates a new ", + "position": { + "start": { "line": 693, "column": 1, "offset": 20406 }, + "end": { "line": 693, "column": 17, "offset": 20422 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 693, "column": 17, "offset": 20422 }, + "end": { "line": 693, "column": 25, "offset": 20430 } + } + }, + { + "type": "text", + "value": " of ", + "position": { + "start": { "line": 693, "column": 25, "offset": 20430 }, + "end": { "line": 693, "column": 29, "offset": 20434 } + } + }, + { + "type": "inlineCode", + "value": "size", + "position": { + "start": { "line": 693, "column": 29, "offset": 20434 }, + "end": { "line": 693, "column": 35, "offset": 20440 } + } + }, + { + "type": "text", + "value": " bytes. If ", + "position": { + "start": { "line": 693, "column": 35, "offset": 20440 }, + "end": { "line": 693, "column": 46, "offset": 20451 } + } + }, + { + "type": "inlineCode", + "value": "fill", + "position": { + "start": { "line": 693, "column": 46, "offset": 20451 }, + "end": { "line": 693, "column": 52, "offset": 20457 } + } + }, + { + "type": "text", + "value": " is ", + "position": { + "start": { "line": 693, "column": 52, "offset": 20457 }, + "end": { "line": 693, "column": 56, "offset": 20461 } + } + }, + { + "type": "inlineCode", + "value": "undefined", + "position": { + "start": { "line": 693, "column": 56, "offset": 20461 }, + "end": { "line": 693, "column": 67, "offset": 20472 } + } + }, + { + "type": "text", + "value": ", the\n", + "position": { + "start": { "line": 693, "column": 67, "offset": 20472 }, + "end": { "line": 694, "column": 1, "offset": 20478 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 694, "column": 1, "offset": 20478 }, + "end": { "line": 694, "column": 9, "offset": 20486 } + } + }, + { + "type": "text", + "value": " will be zero-filled.", + "position": { + "start": { "line": 694, "column": 9, "offset": 20486 }, + "end": { "line": 694, "column": 30, "offset": 20507 } + } + } + ], + "position": { + "start": { "line": 693, "column": 1, "offset": 20406 }, + "end": { "line": 694, "column": 30, "offset": 20507 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.alloc(5);\n\nconsole.log(buf);\n// Prints: ", + "position": { + "start": { "line": 696, "column": 1, "offset": 20509 }, + "end": { "line": 703, "column": 4, "offset": 20641 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.alloc(5);\n\nconsole.log(buf);\n// Prints: ", + "position": { + "start": { "line": 705, "column": 1, "offset": 20643 }, + "end": { "line": 712, "column": 4, "offset": 20780 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "If ", + "position": { + "start": { "line": 714, "column": 1, "offset": 20782 }, + "end": { "line": 714, "column": 4, "offset": 20785 } + } + }, + { + "type": "inlineCode", + "value": "size", + "position": { + "start": { "line": 714, "column": 4, "offset": 20785 }, + "end": { "line": 714, "column": 10, "offset": 20791 } + } + }, + { + "type": "text", + "value": " is larger than\n", + "position": { + "start": { "line": 714, "column": 10, "offset": 20791 }, + "end": { "line": 715, "column": 1, "offset": 20807 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "buffer.constants.MAX_LENGTH", + "position": { + "start": { "line": 715, "column": 2, "offset": 20808 }, + "end": { "line": 715, "column": 31, "offset": 20837 } + } + } + ], + "position": { + "start": { "line": 715, "column": 1, "offset": 20807 }, + "end": { "line": 715, "column": 34, "offset": 20840 } + }, + "label": "`buffer.constants.MAX_LENGTH`", + "identifier": "`buffer.constants.max_length`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": " or smaller than 0, ", + "position": { + "start": { "line": 715, "column": 34, "offset": 20840 }, + "end": { "line": 715, "column": 54, "offset": 20860 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "ERR_OUT_OF_RANGE", + "position": { + "start": { "line": 715, "column": 55, "offset": 20861 }, + "end": { "line": 715, "column": 73, "offset": 20879 } + } + } + ], + "position": { + "start": { "line": 715, "column": 54, "offset": 20860 }, + "end": { "line": 715, "column": 76, "offset": 20882 } + }, + "label": "`ERR_OUT_OF_RANGE`", + "identifier": "`err_out_of_range`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": "\nis thrown.", + "position": { + "start": { "line": 715, "column": 76, "offset": 20882 }, + "end": { "line": 716, "column": 11, "offset": 20893 } + } + } + ], + "position": { + "start": { "line": 714, "column": 1, "offset": 20782 }, + "end": { "line": 716, "column": 11, "offset": 20893 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "If ", + "position": { + "start": { "line": 718, "column": 1, "offset": 20895 }, + "end": { "line": 718, "column": 4, "offset": 20898 } + } + }, + { + "type": "inlineCode", + "value": "fill", + "position": { + "start": { "line": 718, "column": 4, "offset": 20898 }, + "end": { "line": 718, "column": 10, "offset": 20904 } + } + }, + { + "type": "text", + "value": " is specified, the allocated ", + "position": { + "start": { "line": 718, "column": 10, "offset": 20904 }, + "end": { "line": 718, "column": 39, "offset": 20933 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 718, "column": 39, "offset": 20933 }, + "end": { "line": 718, "column": 47, "offset": 20941 } + } + }, + { + "type": "text", + "value": " will be initialized by calling\n", + "position": { + "start": { "line": 718, "column": 47, "offset": 20941 }, + "end": { "line": 719, "column": 1, "offset": 20973 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "buf.fill(fill)", + "position": { + "start": { "line": 719, "column": 2, "offset": 20974 }, + "end": { "line": 719, "column": 18, "offset": 20990 } + } + } + ], + "position": { + "start": { "line": 719, "column": 1, "offset": 20973 }, + "end": { "line": 719, "column": 33, "offset": 21005 } + }, + "label": "`buf.fill()`", + "identifier": "`buf.fill()`", + "referenceType": "full" + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 719, "column": 33, "offset": 21005 }, + "end": { "line": 719, "column": 34, "offset": 21006 } + } + } + ], + "position": { + "start": { "line": 718, "column": 1, "offset": 20895 }, + "end": { "line": 719, "column": 34, "offset": 21006 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.alloc(5, 'a');\n\nconsole.log(buf);\n// Prints: ", + "position": { + "start": { "line": 721, "column": 1, "offset": 21008 }, + "end": { "line": 728, "column": 4, "offset": 21145 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.alloc(5, 'a');\n\nconsole.log(buf);\n// Prints: ", + "position": { + "start": { "line": 730, "column": 1, "offset": 21147 }, + "end": { "line": 737, "column": 4, "offset": 21289 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "If both ", + "position": { + "start": { "line": 739, "column": 1, "offset": 21291 }, + "end": { "line": 739, "column": 9, "offset": 21299 } + } + }, + { + "type": "inlineCode", + "value": "fill", + "position": { + "start": { "line": 739, "column": 9, "offset": 21299 }, + "end": { "line": 739, "column": 15, "offset": 21305 } + } + }, + { + "type": "text", + "value": " and ", + "position": { + "start": { "line": 739, "column": 15, "offset": 21305 }, + "end": { "line": 739, "column": 20, "offset": 21310 } + } + }, + { + "type": "inlineCode", + "value": "encoding", + "position": { + "start": { "line": 739, "column": 20, "offset": 21310 }, + "end": { "line": 739, "column": 30, "offset": 21320 } + } + }, + { + "type": "text", + "value": " are specified, the allocated ", + "position": { + "start": { "line": 739, "column": 30, "offset": 21320 }, + "end": { "line": 739, "column": 60, "offset": 21350 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 739, "column": 60, "offset": 21350 }, + "end": { "line": 739, "column": 68, "offset": 21358 } + } + }, + { + "type": "text", + "value": " will be\ninitialized by calling ", + "position": { + "start": { "line": 739, "column": 68, "offset": 21358 }, + "end": { "line": 740, "column": 24, "offset": 21390 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "buf.fill(fill, encoding)", + "position": { + "start": { "line": 740, "column": 25, "offset": 21391 }, + "end": { "line": 740, "column": 51, "offset": 21417 } + } + } + ], + "position": { + "start": { "line": 740, "column": 24, "offset": 21390 }, + "end": { "line": 740, "column": 66, "offset": 21432 } + }, + "label": "`buf.fill()`", + "identifier": "`buf.fill()`", + "referenceType": "full" + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 740, "column": 66, "offset": 21432 }, + "end": { "line": 740, "column": 67, "offset": 21433 } + } + } + ], + "position": { + "start": { "line": 739, "column": 1, "offset": 21291 }, + "end": { "line": 740, "column": 67, "offset": 21433 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.alloc(11, 'aGVsbG8gd29ybGQ=', 'base64');\n\nconsole.log(buf);\n// Prints: ", + "position": { + "start": { "line": 742, "column": 1, "offset": 21435 }, + "end": { "line": 749, "column": 4, "offset": 21616 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.alloc(11, 'aGVsbG8gd29ybGQ=', 'base64');\n\nconsole.log(buf);\n// Prints: ", + "position": { + "start": { "line": 751, "column": 1, "offset": 21618 }, + "end": { "line": 758, "column": 4, "offset": 21804 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Calling ", + "position": { + "start": { "line": 760, "column": 1, "offset": 21806 }, + "end": { "line": 760, "column": 9, "offset": 21814 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "Buffer.alloc()", + "position": { + "start": { "line": 760, "column": 10, "offset": 21815 }, + "end": { "line": 760, "column": 26, "offset": 21831 } + } + } + ], + "position": { + "start": { "line": 760, "column": 9, "offset": 21814 }, + "end": { "line": 760, "column": 29, "offset": 21834 } + }, + "label": "`Buffer.alloc()`", + "identifier": "`buffer.alloc()`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": " can be measurably slower than the alternative\n", + "position": { + "start": { "line": 760, "column": 29, "offset": 21834 }, + "end": { "line": 761, "column": 1, "offset": 21881 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "Buffer.allocUnsafe()", + "position": { + "start": { "line": 761, "column": 2, "offset": 21882 }, + "end": { "line": 761, "column": 24, "offset": 21904 } + } + } + ], + "position": { + "start": { "line": 761, "column": 1, "offset": 21881 }, + "end": { "line": 761, "column": 27, "offset": 21907 } + }, + "label": "`Buffer.allocUnsafe()`", + "identifier": "`buffer.allocunsafe()`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": " but ensures that the newly created ", + "position": { + "start": { "line": 761, "column": 27, "offset": 21907 }, + "end": { "line": 761, "column": 63, "offset": 21943 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 761, "column": 63, "offset": 21943 }, + "end": { "line": 761, "column": 71, "offset": 21951 } + } + }, + { + "type": "text", + "value": " instance\ncontents will never contain sensitive data from previous allocations, including\ndata that might not have been allocated for ", + "position": { + "start": { "line": 761, "column": 71, "offset": 21951 }, + "end": { "line": 763, "column": 45, "offset": 22085 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 763, "column": 45, "offset": 22085 }, + "end": { "line": 763, "column": 53, "offset": 22093 } + } + }, + { + "type": "text", + "value": "s.", + "position": { + "start": { "line": 763, "column": 53, "offset": 22093 }, + "end": { "line": 763, "column": 55, "offset": 22095 } + } + } + ], + "position": { + "start": { "line": 760, "column": 1, "offset": 21806 }, + "end": { "line": 763, "column": 55, "offset": 22095 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "A ", + "position": { + "start": { "line": 765, "column": 1, "offset": 22097 }, + "end": { "line": 765, "column": 3, "offset": 22099 } + } + }, + { + "type": "inlineCode", + "value": "TypeError", + "position": { + "start": { "line": 765, "column": 3, "offset": 22099 }, + "end": { "line": 765, "column": 14, "offset": 22110 } + } + }, + { + "type": "text", + "value": " will be thrown if ", + "position": { + "start": { "line": 765, "column": 14, "offset": 22110 }, + "end": { "line": 765, "column": 33, "offset": 22129 } + } + }, + { + "type": "inlineCode", + "value": "size", + "position": { + "start": { "line": 765, "column": 33, "offset": 22129 }, + "end": { "line": 765, "column": 39, "offset": 22135 } + } + }, + { + "type": "text", + "value": " is not a number.", + "position": { + "start": { "line": 765, "column": 39, "offset": 22135 }, + "end": { "line": 765, "column": 56, "offset": 22152 } + } + } + ], + "position": { + "start": { "line": 765, "column": 1, "offset": 22097 }, + "end": { "line": 765, "column": 56, "offset": 22152 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "text", + "value": "Static method: ", + "position": { + "start": { "line": 767, "column": 5, "offset": 22158 }, + "end": { "line": 767, "column": 20, "offset": 22173 } + } + }, + { + "type": "inlineCode", + "value": "Buffer.allocUnsafe(size)", + "position": { + "start": { "line": 767, "column": 20, "offset": 22173 }, + "end": { "line": 767, "column": 46, "offset": 22199 } + } + } + ], + "position": { + "start": { "line": 767, "column": 1, "offset": 22154 }, + "end": { "line": 767, "column": 46, "offset": 22199 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 769, "column": 1, "offset": 22201 }, + "end": { "line": 783, "column": 4, "offset": 22796 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "size", + "position": { + "start": { "line": 785, "column": 3, "offset": 22800 }, + "end": { "line": 785, "column": 9, "offset": 22806 } + } + }, + { + "type": "text", + "value": " {integer} The desired length of the new ", + "position": { + "start": { "line": 785, "column": 9, "offset": 22806 }, + "end": { "line": 785, "column": 50, "offset": 22847 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 785, "column": 50, "offset": 22847 }, + "end": { "line": 785, "column": 58, "offset": 22855 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 785, "column": 58, "offset": 22855 }, + "end": { "line": 785, "column": 59, "offset": 22856 } + } + } + ], + "position": { + "start": { "line": 785, "column": 3, "offset": 22800 }, + "end": { "line": 785, "column": 59, "offset": 22856 } + } + } + ], + "position": { + "start": { "line": 785, "column": 1, "offset": 22798 }, + "end": { "line": 785, "column": 59, "offset": 22856 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {Buffer}", + "position": { + "start": { "line": 786, "column": 3, "offset": 22859 }, + "end": { "line": 786, "column": 20, "offset": 22876 } + } + } + ], + "position": { + "start": { "line": 786, "column": 3, "offset": 22859 }, + "end": { "line": 786, "column": 20, "offset": 22876 } + } + } + ], + "position": { + "start": { "line": 786, "column": 1, "offset": 22857 }, + "end": { "line": 786, "column": 20, "offset": 22876 } + } + } + ], + "position": { + "start": { "line": 785, "column": 1, "offset": 22798 }, + "end": { "line": 786, "column": 20, "offset": 22876 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Allocates a new ", + "position": { + "start": { "line": 788, "column": 1, "offset": 22878 }, + "end": { "line": 788, "column": 17, "offset": 22894 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 788, "column": 17, "offset": 22894 }, + "end": { "line": 788, "column": 25, "offset": 22902 } + } + }, + { + "type": "text", + "value": " of ", + "position": { + "start": { "line": 788, "column": 25, "offset": 22902 }, + "end": { "line": 788, "column": 29, "offset": 22906 } + } + }, + { + "type": "inlineCode", + "value": "size", + "position": { + "start": { "line": 788, "column": 29, "offset": 22906 }, + "end": { "line": 788, "column": 35, "offset": 22912 } + } + }, + { + "type": "text", + "value": " bytes. If ", + "position": { + "start": { "line": 788, "column": 35, "offset": 22912 }, + "end": { "line": 788, "column": 46, "offset": 22923 } + } + }, + { + "type": "inlineCode", + "value": "size", + "position": { + "start": { "line": 788, "column": 46, "offset": 22923 }, + "end": { "line": 788, "column": 52, "offset": 22929 } + } + }, + { + "type": "text", + "value": " is larger than\n", + "position": { + "start": { "line": 788, "column": 52, "offset": 22929 }, + "end": { "line": 789, "column": 1, "offset": 22945 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "buffer.constants.MAX_LENGTH", + "position": { + "start": { "line": 789, "column": 2, "offset": 22946 }, + "end": { "line": 789, "column": 31, "offset": 22975 } + } + } + ], + "position": { + "start": { "line": 789, "column": 1, "offset": 22945 }, + "end": { "line": 789, "column": 34, "offset": 22978 } + }, + "label": "`buffer.constants.MAX_LENGTH`", + "identifier": "`buffer.constants.max_length`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": " or smaller than 0, ", + "position": { + "start": { "line": 789, "column": 34, "offset": 22978 }, + "end": { "line": 789, "column": 54, "offset": 22998 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "ERR_OUT_OF_RANGE", + "position": { + "start": { "line": 789, "column": 55, "offset": 22999 }, + "end": { "line": 789, "column": 73, "offset": 23017 } + } + } + ], + "position": { + "start": { "line": 789, "column": 54, "offset": 22998 }, + "end": { "line": 789, "column": 76, "offset": 23020 } + }, + "label": "`ERR_OUT_OF_RANGE`", + "identifier": "`err_out_of_range`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": "\nis thrown.", + "position": { + "start": { "line": 789, "column": 76, "offset": 23020 }, + "end": { "line": 790, "column": 11, "offset": 23031 } + } + } + ], + "position": { + "start": { "line": 788, "column": 1, "offset": 22878 }, + "end": { "line": 790, "column": 11, "offset": 23031 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "The underlying memory for ", + "position": { + "start": { "line": 792, "column": 1, "offset": 23033 }, + "end": { "line": 792, "column": 27, "offset": 23059 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 792, "column": 27, "offset": 23059 }, + "end": { "line": 792, "column": 35, "offset": 23067 } + } + }, + { + "type": "text", + "value": " instances created in this way is ", + "position": { + "start": { "line": 792, "column": 35, "offset": 23067 }, + "end": { "line": 792, "column": 69, "offset": 23101 } + } + }, + { + "type": "emphasis", + "children": [ + { + "type": "text", + "value": "not\ninitialized", + "position": { + "start": { "line": 792, "column": 70, "offset": 23102 }, + "end": { "line": 793, "column": 12, "offset": 23117 } + } + } + ], + "position": { + "start": { "line": 792, "column": 69, "offset": 23101 }, + "end": { "line": 793, "column": 13, "offset": 23118 } + } + }, + { + "type": "text", + "value": ". The contents of the newly created ", + "position": { + "start": { "line": 793, "column": 13, "offset": 23118 }, + "end": { "line": 793, "column": 49, "offset": 23154 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 793, "column": 49, "offset": 23154 }, + "end": { "line": 793, "column": 57, "offset": 23162 } + } + }, + { + "type": "text", + "value": " are unknown and\n", + "position": { + "start": { "line": 793, "column": 57, "offset": 23162 }, + "end": { "line": 794, "column": 1, "offset": 23179 } + } + }, + { + "type": "emphasis", + "children": [ + { + "type": "text", + "value": "may contain sensitive data", + "position": { + "start": { "line": 794, "column": 2, "offset": 23180 }, + "end": { "line": 794, "column": 28, "offset": 23206 } + } + } + ], + "position": { + "start": { "line": 794, "column": 1, "offset": 23179 }, + "end": { "line": 794, "column": 29, "offset": 23207 } + } + }, + { + "type": "text", + "value": ". Use ", + "position": { + "start": { "line": 794, "column": 29, "offset": 23207 }, + "end": { "line": 794, "column": 35, "offset": 23213 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "Buffer.alloc()", + "position": { + "start": { "line": 794, "column": 36, "offset": 23214 }, + "end": { "line": 794, "column": 52, "offset": 23230 } + } + } + ], + "position": { + "start": { "line": 794, "column": 35, "offset": 23213 }, + "end": { "line": 794, "column": 55, "offset": 23233 } + }, + "label": "`Buffer.alloc()`", + "identifier": "`buffer.alloc()`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": " instead to initialize\n", + "position": { + "start": { "line": 794, "column": 55, "offset": 23233 }, + "end": { "line": 795, "column": 1, "offset": 23256 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 795, "column": 1, "offset": 23256 }, + "end": { "line": 795, "column": 9, "offset": 23264 } + } + }, + { + "type": "text", + "value": " instances with zeroes.", + "position": { + "start": { "line": 795, "column": 9, "offset": 23264 }, + "end": { "line": 795, "column": 32, "offset": 23287 } + } + } + ], + "position": { + "start": { "line": 792, "column": 1, "offset": 23033 }, + "end": { "line": 795, "column": 32, "offset": 23287 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.allocUnsafe(10);\n\nconsole.log(buf);\n// Prints (contents may vary): \n\nbuf.fill(0);\n\nconsole.log(buf);\n// Prints: ", + "position": { + "start": { "line": 797, "column": 1, "offset": 23289 }, + "end": { "line": 809, "column": 4, "offset": 23546 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.allocUnsafe(10);\n\nconsole.log(buf);\n// Prints (contents may vary): \n\nbuf.fill(0);\n\nconsole.log(buf);\n// Prints: ", + "position": { + "start": { "line": 811, "column": 1, "offset": 23548 }, + "end": { "line": 823, "column": 4, "offset": 23810 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "A ", + "position": { + "start": { "line": 825, "column": 1, "offset": 23812 }, + "end": { "line": 825, "column": 3, "offset": 23814 } + } + }, + { + "type": "inlineCode", + "value": "TypeError", + "position": { + "start": { "line": 825, "column": 3, "offset": 23814 }, + "end": { "line": 825, "column": 14, "offset": 23825 } + } + }, + { + "type": "text", + "value": " will be thrown if ", + "position": { + "start": { "line": 825, "column": 14, "offset": 23825 }, + "end": { "line": 825, "column": 33, "offset": 23844 } + } + }, + { + "type": "inlineCode", + "value": "size", + "position": { + "start": { "line": 825, "column": 33, "offset": 23844 }, + "end": { "line": 825, "column": 39, "offset": 23850 } + } + }, + { + "type": "text", + "value": " is not a number.", + "position": { + "start": { "line": 825, "column": 39, "offset": 23850 }, + "end": { "line": 825, "column": 56, "offset": 23867 } + } + } + ], + "position": { + "start": { "line": 825, "column": 1, "offset": 23812 }, + "end": { "line": 825, "column": 56, "offset": 23867 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "The ", + "position": { + "start": { "line": 827, "column": 1, "offset": 23869 }, + "end": { "line": 827, "column": 5, "offset": 23873 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 827, "column": 5, "offset": 23873 }, + "end": { "line": 827, "column": 13, "offset": 23881 } + } + }, + { + "type": "text", + "value": " module pre-allocates an internal ", + "position": { + "start": { "line": 827, "column": 13, "offset": 23881 }, + "end": { "line": 827, "column": 47, "offset": 23915 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 827, "column": 47, "offset": 23915 }, + "end": { "line": 827, "column": 55, "offset": 23923 } + } + }, + { + "type": "text", + "value": " instance of\nsize ", + "position": { + "start": { "line": 827, "column": 55, "offset": 23923 }, + "end": { "line": 828, "column": 6, "offset": 23941 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "Buffer.poolSize", + "position": { + "start": { "line": 828, "column": 7, "offset": 23942 }, + "end": { "line": 828, "column": 24, "offset": 23959 } + } + } + ], + "position": { + "start": { "line": 828, "column": 6, "offset": 23941 }, + "end": { "line": 828, "column": 27, "offset": 23962 } + }, + "label": "`Buffer.poolSize`", + "identifier": "`buffer.poolsize`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": " that is used as a pool for the fast allocation of new\n", + "position": { + "start": { "line": 828, "column": 27, "offset": 23962 }, + "end": { "line": 829, "column": 1, "offset": 24017 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 829, "column": 1, "offset": 24017 }, + "end": { "line": 829, "column": 9, "offset": 24025 } + } + }, + { + "type": "text", + "value": " instances created using ", + "position": { + "start": { "line": 829, "column": 9, "offset": 24025 }, + "end": { "line": 829, "column": 34, "offset": 24050 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "Buffer.allocUnsafe()", + "position": { + "start": { "line": 829, "column": 35, "offset": 24051 }, + "end": { "line": 829, "column": 57, "offset": 24073 } + } + } + ], + "position": { + "start": { "line": 829, "column": 34, "offset": 24050 }, + "end": { "line": 829, "column": 60, "offset": 24076 } + }, + "label": "`Buffer.allocUnsafe()`", + "identifier": "`buffer.allocunsafe()`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": ", ", + "position": { + "start": { "line": 829, "column": 60, "offset": 24076 }, + "end": { "line": 829, "column": 62, "offset": 24078 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "Buffer.from(array)", + "position": { + "start": { "line": 829, "column": 63, "offset": 24079 }, + "end": { "line": 829, "column": 83, "offset": 24099 } + } + } + ], + "position": { + "start": { "line": 829, "column": 62, "offset": 24078 }, + "end": { "line": 829, "column": 86, "offset": 24102 } + }, + "label": "`Buffer.from(array)`", + "identifier": "`buffer.from(array)`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": ",\n", + "position": { + "start": { "line": 829, "column": 86, "offset": 24102 }, + "end": { "line": 830, "column": 1, "offset": 24104 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "Buffer.from(string)", + "position": { + "start": { "line": 830, "column": 2, "offset": 24105 }, + "end": { "line": 830, "column": 23, "offset": 24126 } + } + } + ], + "position": { + "start": { "line": 830, "column": 1, "offset": 24104 }, + "end": { "line": 830, "column": 26, "offset": 24129 } + }, + "label": "`Buffer.from(string)`", + "identifier": "`buffer.from(string)`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": ", and ", + "position": { + "start": { "line": 830, "column": 26, "offset": 24129 }, + "end": { "line": 830, "column": 32, "offset": 24135 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "Buffer.concat()", + "position": { + "start": { "line": 830, "column": 33, "offset": 24136 }, + "end": { "line": 830, "column": 50, "offset": 24153 } + } + } + ], + "position": { + "start": { "line": 830, "column": 32, "offset": 24135 }, + "end": { "line": 830, "column": 53, "offset": 24156 } + }, + "label": "`Buffer.concat()`", + "identifier": "`buffer.concat()`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": " only when ", + "position": { + "start": { "line": 830, "column": 53, "offset": 24156 }, + "end": { "line": 830, "column": 64, "offset": 24167 } + } + }, + { + "type": "inlineCode", + "value": "size", + "position": { + "start": { "line": 830, "column": 64, "offset": 24167 }, + "end": { "line": 830, "column": 70, "offset": 24173 } + } + }, + { + "type": "text", + "value": " is less than\n", + "position": { + "start": { "line": 830, "column": 70, "offset": 24173 }, + "end": { "line": 831, "column": 1, "offset": 24187 } + } + }, + { + "type": "inlineCode", + "value": "Buffer.poolSize >>> 1", + "position": { + "start": { "line": 831, "column": 1, "offset": 24187 }, + "end": { "line": 831, "column": 24, "offset": 24210 } + } + }, + { + "type": "text", + "value": " (floor of ", + "position": { + "start": { "line": 831, "column": 24, "offset": 24210 }, + "end": { "line": 831, "column": 35, "offset": 24221 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "Buffer.poolSize", + "position": { + "start": { "line": 831, "column": 36, "offset": 24222 }, + "end": { "line": 831, "column": 53, "offset": 24239 } + } + } + ], + "position": { + "start": { "line": 831, "column": 35, "offset": 24221 }, + "end": { "line": 831, "column": 56, "offset": 24242 } + }, + "label": "`Buffer.poolSize`", + "identifier": "`buffer.poolsize`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": " divided by two).", + "position": { + "start": { "line": 831, "column": 56, "offset": 24242 }, + "end": { "line": 831, "column": 73, "offset": 24259 } + } + } + ], + "position": { + "start": { "line": 827, "column": 1, "offset": 23869 }, + "end": { "line": 831, "column": 73, "offset": 24259 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Use of this pre-allocated internal memory pool is a key difference between\ncalling ", + "position": { + "start": { "line": 833, "column": 1, "offset": 24261 }, + "end": { "line": 834, "column": 9, "offset": 24344 } + } + }, + { + "type": "inlineCode", + "value": "Buffer.alloc(size, fill)", + "position": { + "start": { "line": 834, "column": 9, "offset": 24344 }, + "end": { "line": 834, "column": 35, "offset": 24370 } + } + }, + { + "type": "text", + "value": " vs. ", + "position": { + "start": { "line": 834, "column": 35, "offset": 24370 }, + "end": { "line": 834, "column": 40, "offset": 24375 } + } + }, + { + "type": "inlineCode", + "value": "Buffer.allocUnsafe(size).fill(fill)", + "position": { + "start": { "line": 834, "column": 40, "offset": 24375 }, + "end": { "line": 834, "column": 77, "offset": 24412 } + } + }, + { + "type": "text", + "value": ".\nSpecifically, ", + "position": { + "start": { "line": 834, "column": 77, "offset": 24412 }, + "end": { "line": 835, "column": 15, "offset": 24428 } + } + }, + { + "type": "inlineCode", + "value": "Buffer.alloc(size, fill)", + "position": { + "start": { "line": 835, "column": 15, "offset": 24428 }, + "end": { "line": 835, "column": 41, "offset": 24454 } + } + }, + { + "type": "text", + "value": " will ", + "position": { + "start": { "line": 835, "column": 41, "offset": 24454 }, + "end": { "line": 835, "column": 47, "offset": 24460 } + } + }, + { + "type": "emphasis", + "children": [ + { + "type": "text", + "value": "never", + "position": { + "start": { "line": 835, "column": 48, "offset": 24461 }, + "end": { "line": 835, "column": 53, "offset": 24466 } + } + } + ], + "position": { + "start": { "line": 835, "column": 47, "offset": 24460 }, + "end": { "line": 835, "column": 54, "offset": 24467 } + } + }, + { + "type": "text", + "value": " use the internal ", + "position": { + "start": { "line": 835, "column": 54, "offset": 24467 }, + "end": { "line": 835, "column": 72, "offset": 24485 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 835, "column": 72, "offset": 24485 }, + "end": { "line": 835, "column": 80, "offset": 24493 } + } + }, + { + "type": "text", + "value": "\npool, while ", + "position": { + "start": { "line": 835, "column": 80, "offset": 24493 }, + "end": { "line": 836, "column": 13, "offset": 24506 } + } + }, + { + "type": "inlineCode", + "value": "Buffer.allocUnsafe(size).fill(fill)", + "position": { + "start": { "line": 836, "column": 13, "offset": 24506 }, + "end": { "line": 836, "column": 50, "offset": 24543 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 836, "column": 50, "offset": 24543 }, + "end": { "line": 836, "column": 51, "offset": 24544 } + } + }, + { + "type": "emphasis", + "children": [ + { + "type": "text", + "value": "will", + "position": { + "start": { "line": 836, "column": 52, "offset": 24545 }, + "end": { "line": 836, "column": 56, "offset": 24549 } + } + } + ], + "position": { + "start": { "line": 836, "column": 51, "offset": 24544 }, + "end": { "line": 836, "column": 57, "offset": 24550 } + } + }, + { + "type": "text", + "value": " use the internal\n", + "position": { + "start": { "line": 836, "column": 57, "offset": 24550 }, + "end": { "line": 837, "column": 1, "offset": 24568 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 837, "column": 1, "offset": 24568 }, + "end": { "line": 837, "column": 9, "offset": 24576 } + } + }, + { + "type": "text", + "value": " pool if ", + "position": { + "start": { "line": 837, "column": 9, "offset": 24576 }, + "end": { "line": 837, "column": 18, "offset": 24585 } + } + }, + { + "type": "inlineCode", + "value": "size", + "position": { + "start": { "line": 837, "column": 18, "offset": 24585 }, + "end": { "line": 837, "column": 24, "offset": 24591 } + } + }, + { + "type": "text", + "value": " is less than or equal to half ", + "position": { + "start": { "line": 837, "column": 24, "offset": 24591 }, + "end": { "line": 837, "column": 55, "offset": 24622 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "Buffer.poolSize", + "position": { + "start": { "line": 837, "column": 56, "offset": 24623 }, + "end": { "line": 837, "column": 73, "offset": 24640 } + } + } + ], + "position": { + "start": { "line": 837, "column": 55, "offset": 24622 }, + "end": { "line": 837, "column": 76, "offset": 24643 } + }, + "label": "`Buffer.poolSize`", + "identifier": "`buffer.poolsize`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": ". The\ndifference is subtle but can be important when an application requires the\nadditional performance that ", + "position": { + "start": { "line": 837, "column": 76, "offset": 24643 }, + "end": { "line": 839, "column": 29, "offset": 24752 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "Buffer.allocUnsafe()", + "position": { + "start": { "line": 839, "column": 30, "offset": 24753 }, + "end": { "line": 839, "column": 52, "offset": 24775 } + } + } + ], + "position": { + "start": { "line": 839, "column": 29, "offset": 24752 }, + "end": { "line": 839, "column": 55, "offset": 24778 } + }, + "label": "`Buffer.allocUnsafe()`", + "identifier": "`buffer.allocunsafe()`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": " provides.", + "position": { + "start": { "line": 839, "column": 55, "offset": 24778 }, + "end": { "line": 839, "column": 65, "offset": 24788 } + } + } + ], + "position": { + "start": { "line": 833, "column": 1, "offset": 24261 }, + "end": { "line": 839, "column": 65, "offset": 24788 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "text", + "value": "Static method: ", + "position": { + "start": { "line": 841, "column": 5, "offset": 24794 }, + "end": { "line": 841, "column": 20, "offset": 24809 } + } + }, + { + "type": "inlineCode", + "value": "Buffer.allocUnsafeSlow(size)", + "position": { + "start": { "line": 841, "column": 20, "offset": 24809 }, + "end": { "line": 841, "column": 50, "offset": 24839 } + } + } + ], + "position": { + "start": { "line": 841, "column": 1, "offset": 24790 }, + "end": { "line": 841, "column": 50, "offset": 24839 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 843, "column": 1, "offset": 24841 }, + "end": { "line": 854, "column": 4, "offset": 25295 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "size", + "position": { + "start": { "line": 856, "column": 3, "offset": 25299 }, + "end": { "line": 856, "column": 9, "offset": 25305 } + } + }, + { + "type": "text", + "value": " {integer} The desired length of the new ", + "position": { + "start": { "line": 856, "column": 9, "offset": 25305 }, + "end": { "line": 856, "column": 50, "offset": 25346 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 856, "column": 50, "offset": 25346 }, + "end": { "line": 856, "column": 58, "offset": 25354 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 856, "column": 58, "offset": 25354 }, + "end": { "line": 856, "column": 59, "offset": 25355 } + } + } + ], + "position": { + "start": { "line": 856, "column": 3, "offset": 25299 }, + "end": { "line": 856, "column": 59, "offset": 25355 } + } + } + ], + "position": { + "start": { "line": 856, "column": 1, "offset": 25297 }, + "end": { "line": 856, "column": 59, "offset": 25355 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {Buffer}", + "position": { + "start": { "line": 857, "column": 3, "offset": 25358 }, + "end": { "line": 857, "column": 20, "offset": 25375 } + } + } + ], + "position": { + "start": { "line": 857, "column": 3, "offset": 25358 }, + "end": { "line": 857, "column": 20, "offset": 25375 } + } + } + ], + "position": { + "start": { "line": 857, "column": 1, "offset": 25356 }, + "end": { "line": 857, "column": 20, "offset": 25375 } + } + } + ], + "position": { + "start": { "line": 856, "column": 1, "offset": 25297 }, + "end": { "line": 857, "column": 20, "offset": 25375 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Allocates a new ", + "position": { + "start": { "line": 859, "column": 1, "offset": 25377 }, + "end": { "line": 859, "column": 17, "offset": 25393 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 859, "column": 17, "offset": 25393 }, + "end": { "line": 859, "column": 25, "offset": 25401 } + } + }, + { + "type": "text", + "value": " of ", + "position": { + "start": { "line": 859, "column": 25, "offset": 25401 }, + "end": { "line": 859, "column": 29, "offset": 25405 } + } + }, + { + "type": "inlineCode", + "value": "size", + "position": { + "start": { "line": 859, "column": 29, "offset": 25405 }, + "end": { "line": 859, "column": 35, "offset": 25411 } + } + }, + { + "type": "text", + "value": " bytes. If ", + "position": { + "start": { "line": 859, "column": 35, "offset": 25411 }, + "end": { "line": 859, "column": 46, "offset": 25422 } + } + }, + { + "type": "inlineCode", + "value": "size", + "position": { + "start": { "line": 859, "column": 46, "offset": 25422 }, + "end": { "line": 859, "column": 52, "offset": 25428 } + } + }, + { + "type": "text", + "value": " is larger than\n", + "position": { + "start": { "line": 859, "column": 52, "offset": 25428 }, + "end": { "line": 860, "column": 1, "offset": 25444 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "buffer.constants.MAX_LENGTH", + "position": { + "start": { "line": 860, "column": 2, "offset": 25445 }, + "end": { "line": 860, "column": 31, "offset": 25474 } + } + } + ], + "position": { + "start": { "line": 860, "column": 1, "offset": 25444 }, + "end": { "line": 860, "column": 34, "offset": 25477 } + }, + "label": "`buffer.constants.MAX_LENGTH`", + "identifier": "`buffer.constants.max_length`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": " or smaller than 0, ", + "position": { + "start": { "line": 860, "column": 34, "offset": 25477 }, + "end": { "line": 860, "column": 54, "offset": 25497 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "ERR_OUT_OF_RANGE", + "position": { + "start": { "line": 860, "column": 55, "offset": 25498 }, + "end": { "line": 860, "column": 73, "offset": 25516 } + } + } + ], + "position": { + "start": { "line": 860, "column": 54, "offset": 25497 }, + "end": { "line": 860, "column": 76, "offset": 25519 } + }, + "label": "`ERR_OUT_OF_RANGE`", + "identifier": "`err_out_of_range`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": "\nis thrown. A zero-length ", + "position": { + "start": { "line": 860, "column": 76, "offset": 25519 }, + "end": { "line": 861, "column": 26, "offset": 25545 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 861, "column": 26, "offset": 25545 }, + "end": { "line": 861, "column": 34, "offset": 25553 } + } + }, + { + "type": "text", + "value": " is created if ", + "position": { + "start": { "line": 861, "column": 34, "offset": 25553 }, + "end": { "line": 861, "column": 49, "offset": 25568 } + } + }, + { + "type": "inlineCode", + "value": "size", + "position": { + "start": { "line": 861, "column": 49, "offset": 25568 }, + "end": { "line": 861, "column": 55, "offset": 25574 } + } + }, + { + "type": "text", + "value": " is 0.", + "position": { + "start": { "line": 861, "column": 55, "offset": 25574 }, + "end": { "line": 861, "column": 61, "offset": 25580 } + } + } + ], + "position": { + "start": { "line": 859, "column": 1, "offset": 25377 }, + "end": { "line": 861, "column": 61, "offset": 25580 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "The underlying memory for ", + "position": { + "start": { "line": 863, "column": 1, "offset": 25582 }, + "end": { "line": 863, "column": 27, "offset": 25608 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 863, "column": 27, "offset": 25608 }, + "end": { "line": 863, "column": 35, "offset": 25616 } + } + }, + { + "type": "text", + "value": " instances created in this way is ", + "position": { + "start": { "line": 863, "column": 35, "offset": 25616 }, + "end": { "line": 863, "column": 69, "offset": 25650 } + } + }, + { + "type": "emphasis", + "children": [ + { + "type": "text", + "value": "not\ninitialized", + "position": { + "start": { "line": 863, "column": 70, "offset": 25651 }, + "end": { "line": 864, "column": 12, "offset": 25666 } + } + } + ], + "position": { + "start": { "line": 863, "column": 69, "offset": 25650 }, + "end": { "line": 864, "column": 13, "offset": 25667 } + } + }, + { + "type": "text", + "value": ". The contents of the newly created ", + "position": { + "start": { "line": 864, "column": 13, "offset": 25667 }, + "end": { "line": 864, "column": 49, "offset": 25703 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 864, "column": 49, "offset": 25703 }, + "end": { "line": 864, "column": 57, "offset": 25711 } + } + }, + { + "type": "text", + "value": " are unknown and\n", + "position": { + "start": { "line": 864, "column": 57, "offset": 25711 }, + "end": { "line": 865, "column": 1, "offset": 25728 } + } + }, + { + "type": "emphasis", + "children": [ + { + "type": "text", + "value": "may contain sensitive data", + "position": { + "start": { "line": 865, "column": 2, "offset": 25729 }, + "end": { "line": 865, "column": 28, "offset": 25755 } + } + } + ], + "position": { + "start": { "line": 865, "column": 1, "offset": 25728 }, + "end": { "line": 865, "column": 29, "offset": 25756 } + } + }, + { + "type": "text", + "value": ". Use ", + "position": { + "start": { "line": 865, "column": 29, "offset": 25756 }, + "end": { "line": 865, "column": 35, "offset": 25762 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "buf.fill(0)", + "position": { + "start": { "line": 865, "column": 36, "offset": 25763 }, + "end": { "line": 865, "column": 49, "offset": 25776 } + } + } + ], + "position": { + "start": { "line": 865, "column": 35, "offset": 25762 }, + "end": { "line": 865, "column": 64, "offset": 25791 } + }, + "label": "`buf.fill()`", + "identifier": "`buf.fill()`", + "referenceType": "full" + }, + { + "type": "text", + "value": " to initialize\nsuch ", + "position": { + "start": { "line": 865, "column": 64, "offset": 25791 }, + "end": { "line": 866, "column": 6, "offset": 25811 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 866, "column": 6, "offset": 25811 }, + "end": { "line": 866, "column": 14, "offset": 25819 } + } + }, + { + "type": "text", + "value": " instances with zeroes.", + "position": { + "start": { "line": 866, "column": 14, "offset": 25819 }, + "end": { "line": 866, "column": 37, "offset": 25842 } + } + } + ], + "position": { + "start": { "line": 863, "column": 1, "offset": 25582 }, + "end": { "line": 866, "column": 37, "offset": 25842 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "When using ", + "position": { + "start": { "line": 868, "column": 1, "offset": 25844 }, + "end": { "line": 868, "column": 12, "offset": 25855 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "Buffer.allocUnsafe()", + "position": { + "start": { "line": 868, "column": 13, "offset": 25856 }, + "end": { "line": 868, "column": 35, "offset": 25878 } + } + } + ], + "position": { + "start": { "line": 868, "column": 12, "offset": 25855 }, + "end": { "line": 868, "column": 38, "offset": 25881 } + }, + "label": "`Buffer.allocUnsafe()`", + "identifier": "`buffer.allocunsafe()`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": " to allocate new ", + "position": { + "start": { "line": 868, "column": 38, "offset": 25881 }, + "end": { "line": 868, "column": 55, "offset": 25898 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 868, "column": 55, "offset": 25898 }, + "end": { "line": 868, "column": 63, "offset": 25906 } + } + }, + { + "type": "text", + "value": " instances,\nallocations less than ", + "position": { + "start": { "line": 868, "column": 63, "offset": 25906 }, + "end": { "line": 869, "column": 23, "offset": 25940 } + } + }, + { + "type": "inlineCode", + "value": "Buffer.poolSize >>> 1", + "position": { + "start": { "line": 869, "column": 23, "offset": 25940 }, + "end": { "line": 869, "column": 46, "offset": 25963 } + } + }, + { + "type": "text", + "value": " (4KiB when default poolSize is used) are sliced\nfrom a single pre-allocated ", + "position": { + "start": { "line": 869, "column": 46, "offset": 25963 }, + "end": { "line": 870, "column": 29, "offset": 26040 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 870, "column": 29, "offset": 26040 }, + "end": { "line": 870, "column": 37, "offset": 26048 } + } + }, + { + "type": "text", + "value": ". This allows applications to avoid the\ngarbage collection overhead of creating many individually allocated ", + "position": { + "start": { "line": 870, "column": 37, "offset": 26048 }, + "end": { "line": 871, "column": 69, "offset": 26156 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 871, "column": 69, "offset": 26156 }, + "end": { "line": 871, "column": 77, "offset": 26164 } + } + }, + { + "type": "text", + "value": "\ninstances. This approach improves both performance and memory usage by\neliminating the need to track and clean up as many individual ", + "position": { + "start": { "line": 871, "column": 77, "offset": 26164 }, + "end": { "line": 873, "column": 63, "offset": 26298 } + } + }, + { + "type": "inlineCode", + "value": "ArrayBuffer", + "position": { + "start": { "line": 873, "column": 63, "offset": 26298 }, + "end": { "line": 873, "column": 76, "offset": 26311 } + } + }, + { + "type": "text", + "value": " objects.", + "position": { + "start": { "line": 873, "column": 76, "offset": 26311 }, + "end": { "line": 873, "column": 85, "offset": 26320 } + } + } + ], + "position": { + "start": { "line": 868, "column": 1, "offset": 25844 }, + "end": { "line": 873, "column": 85, "offset": 26320 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "However, in the case where a developer may need to retain a small chunk of\nmemory from a pool for an indeterminate amount of time, it may be appropriate\nto create an un-pooled ", + "position": { + "start": { "line": 875, "column": 1, "offset": 26322 }, + "end": { "line": 877, "column": 24, "offset": 26498 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 877, "column": 24, "offset": 26498 }, + "end": { "line": 877, "column": 32, "offset": 26506 } + } + }, + { + "type": "text", + "value": " instance using ", + "position": { + "start": { "line": 877, "column": 32, "offset": 26506 }, + "end": { "line": 877, "column": 48, "offset": 26522 } + } + }, + { + "type": "inlineCode", + "value": "Buffer.allocUnsafeSlow()", + "position": { + "start": { "line": 877, "column": 48, "offset": 26522 }, + "end": { "line": 877, "column": 74, "offset": 26548 } + } + }, + { + "type": "text", + "value": " and\nthen copying out the relevant bits.", + "position": { + "start": { "line": 877, "column": 74, "offset": 26548 }, + "end": { "line": 878, "column": 36, "offset": 26588 } + } + } + ], + "position": { + "start": { "line": 875, "column": 1, "offset": 26322 }, + "end": { "line": 878, "column": 36, "offset": 26588 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\n// Need to keep around a few small chunks of memory.\nconst store = [];\n\nsocket.on('readable', () => {\n let data;\n while (null !== (data = readable.read())) {\n // Allocate for retained data.\n const sb = Buffer.allocUnsafeSlow(10);\n\n // Copy the data into the new allocation.\n data.copy(sb, 0, 0, 10);\n\n store.push(sb);\n }\n});", + "position": { + "start": { "line": 880, "column": 1, "offset": 26590 }, + "end": { "line": 898, "column": 4, "offset": 26982 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\n// Need to keep around a few small chunks of memory.\nconst store = [];\n\nsocket.on('readable', () => {\n let data;\n while (null !== (data = readable.read())) {\n // Allocate for retained data.\n const sb = Buffer.allocUnsafeSlow(10);\n\n // Copy the data into the new allocation.\n data.copy(sb, 0, 0, 10);\n\n store.push(sb);\n }\n});", + "position": { + "start": { "line": 900, "column": 1, "offset": 26984 }, + "end": { "line": 918, "column": 4, "offset": 27381 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "A ", + "position": { + "start": { "line": 920, "column": 1, "offset": 27383 }, + "end": { "line": 920, "column": 3, "offset": 27385 } + } + }, + { + "type": "inlineCode", + "value": "TypeError", + "position": { + "start": { "line": 920, "column": 3, "offset": 27385 }, + "end": { "line": 920, "column": 14, "offset": 27396 } + } + }, + { + "type": "text", + "value": " will be thrown if ", + "position": { + "start": { "line": 920, "column": 14, "offset": 27396 }, + "end": { "line": 920, "column": 33, "offset": 27415 } + } + }, + { + "type": "inlineCode", + "value": "size", + "position": { + "start": { "line": 920, "column": 33, "offset": 27415 }, + "end": { "line": 920, "column": 39, "offset": 27421 } + } + }, + { + "type": "text", + "value": " is not a number.", + "position": { + "start": { "line": 920, "column": 39, "offset": 27421 }, + "end": { "line": 920, "column": 56, "offset": 27438 } + } + } + ], + "position": { + "start": { "line": 920, "column": 1, "offset": 27383 }, + "end": { "line": 920, "column": 56, "offset": 27438 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "text", + "value": "Static method: ", + "position": { + "start": { "line": 922, "column": 5, "offset": 27444 }, + "end": { "line": 922, "column": 20, "offset": 27459 } + } + }, + { + "type": "inlineCode", + "value": "Buffer.byteLength(string[, encoding])", + "position": { + "start": { "line": 922, "column": 20, "offset": 27459 }, + "end": { "line": 922, "column": 59, "offset": 27498 } + } + } + ], + "position": { + "start": { "line": 922, "column": 1, "offset": 27440 }, + "end": { "line": 922, "column": 59, "offset": 27498 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 924, "column": 1, "offset": 27500 }, + "end": { "line": 934, "column": 4, "offset": 27863 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "string", + "position": { + "start": { "line": 936, "column": 3, "offset": 27867 }, + "end": { "line": 936, "column": 11, "offset": 27875 } + } + }, + { + "type": "text", + "value": " {string|Buffer|TypedArray|DataView|ArrayBuffer|SharedArrayBuffer} A\nvalue to calculate the length of.", + "position": { + "start": { "line": 936, "column": 11, "offset": 27875 }, + "end": { "line": 937, "column": 36, "offset": 27979 } + } + } + ], + "position": { + "start": { "line": 936, "column": 3, "offset": 27867 }, + "end": { "line": 937, "column": 36, "offset": 27979 } + } + } + ], + "position": { + "start": { "line": 936, "column": 1, "offset": 27865 }, + "end": { "line": 937, "column": 36, "offset": 27979 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "encoding", + "position": { + "start": { "line": 938, "column": 3, "offset": 27982 }, + "end": { "line": 938, "column": 13, "offset": 27992 } + } + }, + { + "type": "text", + "value": " {string} If ", + "position": { + "start": { "line": 938, "column": 13, "offset": 27992 }, + "end": { "line": 938, "column": 26, "offset": 28005 } + } + }, + { + "type": "inlineCode", + "value": "string", + "position": { + "start": { "line": 938, "column": 26, "offset": 28005 }, + "end": { "line": 938, "column": 34, "offset": 28013 } + } + }, + { + "type": "text", + "value": " is a string, this is its encoding.\n", + "position": { + "start": { "line": 938, "column": 34, "offset": 28013 }, + "end": { "line": 939, "column": 1, "offset": 28049 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { "line": 939, "column": 5, "offset": 28053 }, + "end": { "line": 939, "column": 13, "offset": 28061 } + } + } + ], + "position": { + "start": { "line": 939, "column": 3, "offset": 28051 }, + "end": { "line": 939, "column": 15, "offset": 28063 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 939, "column": 15, "offset": 28063 }, + "end": { "line": 939, "column": 16, "offset": 28064 } + } + }, + { + "type": "inlineCode", + "value": "'utf8'", + "position": { + "start": { "line": 939, "column": 16, "offset": 28064 }, + "end": { "line": 939, "column": 24, "offset": 28072 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 939, "column": 24, "offset": 28072 }, + "end": { "line": 939, "column": 25, "offset": 28073 } + } + } + ], + "position": { + "start": { "line": 938, "column": 3, "offset": 27982 }, + "end": { "line": 939, "column": 25, "offset": 28073 } + } + } + ], + "position": { + "start": { "line": 938, "column": 1, "offset": 27980 }, + "end": { "line": 939, "column": 25, "offset": 28073 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {integer} The number of bytes contained within ", + "position": { + "start": { "line": 940, "column": 3, "offset": 28076 }, + "end": { "line": 940, "column": 59, "offset": 28132 } + } + }, + { + "type": "inlineCode", + "value": "string", + "position": { + "start": { "line": 940, "column": 59, "offset": 28132 }, + "end": { "line": 940, "column": 67, "offset": 28140 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 940, "column": 67, "offset": 28140 }, + "end": { "line": 940, "column": 68, "offset": 28141 } + } + } + ], + "position": { + "start": { "line": 940, "column": 3, "offset": 28076 }, + "end": { "line": 940, "column": 68, "offset": 28141 } + } + } + ], + "position": { + "start": { "line": 940, "column": 1, "offset": 28074 }, + "end": { "line": 940, "column": 68, "offset": 28141 } + } + } + ], + "position": { + "start": { "line": 936, "column": 1, "offset": 27865 }, + "end": { "line": 940, "column": 68, "offset": 28141 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns the byte length of a string when encoded using ", + "position": { + "start": { "line": 942, "column": 1, "offset": 28143 }, + "end": { "line": 942, "column": 56, "offset": 28198 } + } + }, + { + "type": "inlineCode", + "value": "encoding", + "position": { + "start": { "line": 942, "column": 56, "offset": 28198 }, + "end": { "line": 942, "column": 66, "offset": 28208 } + } + }, + { + "type": "text", + "value": ".\nThis is not the same as ", + "position": { + "start": { "line": 942, "column": 66, "offset": 28208 }, + "end": { "line": 943, "column": 25, "offset": 28234 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "String.prototype.length", + "position": { + "start": { "line": 943, "column": 26, "offset": 28235 }, + "end": { "line": 943, "column": 51, "offset": 28260 } + } + } + ], + "position": { + "start": { "line": 943, "column": 25, "offset": 28234 }, + "end": { "line": 943, "column": 54, "offset": 28263 } + }, + "label": "`String.prototype.length`", + "identifier": "`string.prototype.length`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": ", which does not account\nfor the encoding that is used to convert the string into bytes.", + "position": { + "start": { "line": 943, "column": 54, "offset": 28263 }, + "end": { "line": 944, "column": 64, "offset": 28351 } + } + } + ], + "position": { + "start": { "line": 942, "column": 1, "offset": 28143 }, + "end": { "line": 944, "column": 64, "offset": 28351 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "For ", + "position": { + "start": { "line": 946, "column": 1, "offset": 28353 }, + "end": { "line": 946, "column": 5, "offset": 28357 } + } + }, + { + "type": "inlineCode", + "value": "'base64'", + "position": { + "start": { "line": 946, "column": 5, "offset": 28357 }, + "end": { "line": 946, "column": 15, "offset": 28367 } + } + }, + { + "type": "text", + "value": ", ", + "position": { + "start": { "line": 946, "column": 15, "offset": 28367 }, + "end": { "line": 946, "column": 17, "offset": 28369 } + } + }, + { + "type": "inlineCode", + "value": "'base64url'", + "position": { + "start": { "line": 946, "column": 17, "offset": 28369 }, + "end": { "line": 946, "column": 30, "offset": 28382 } + } + }, + { + "type": "text", + "value": ", and ", + "position": { + "start": { "line": 946, "column": 30, "offset": 28382 }, + "end": { "line": 946, "column": 36, "offset": 28388 } + } + }, + { + "type": "inlineCode", + "value": "'hex'", + "position": { + "start": { "line": 946, "column": 36, "offset": 28388 }, + "end": { "line": 946, "column": 43, "offset": 28395 } + } + }, + { + "type": "text", + "value": ", this function assumes valid input.\nFor strings that contain non-base64/hex-encoded data (e.g. whitespace), the\nreturn value might be greater than the length of a ", + "position": { + "start": { "line": 946, "column": 43, "offset": 28395 }, + "end": { "line": 948, "column": 52, "offset": 28559 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 948, "column": 52, "offset": 28559 }, + "end": { "line": 948, "column": 60, "offset": 28567 } + } + }, + { + "type": "text", + "value": " created from the\nstring.", + "position": { + "start": { "line": 948, "column": 60, "offset": 28567 }, + "end": { "line": 949, "column": 8, "offset": 28592 } + } + } + ], + "position": { + "start": { "line": 946, "column": 1, "offset": 28353 }, + "end": { "line": 949, "column": 8, "offset": 28592 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst str = '\\u00bd + \\u00bc = \\u00be';\n\nconsole.log(`${str}: ${str.length} characters, ` +\n `${Buffer.byteLength(str, 'utf8')} bytes`);\n// Prints: ½ + ¼ = ¾: 9 characters, 12 bytes", + "position": { + "start": { "line": 951, "column": 1, "offset": 28594 }, + "end": { "line": 959, "column": 4, "offset": 28836 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst str = '\\u00bd + \\u00bc = \\u00be';\n\nconsole.log(`${str}: ${str.length} characters, ` +\n `${Buffer.byteLength(str, 'utf8')} bytes`);\n// Prints: ½ + ¼ = ¾: 9 characters, 12 bytes", + "position": { + "start": { "line": 961, "column": 1, "offset": 28838 }, + "end": { "line": 969, "column": 4, "offset": 29085 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "When ", + "position": { + "start": { "line": 971, "column": 1, "offset": 29087 }, + "end": { "line": 971, "column": 6, "offset": 29092 } + } + }, + { + "type": "inlineCode", + "value": "string", + "position": { + "start": { "line": 971, "column": 6, "offset": 29092 }, + "end": { "line": 971, "column": 14, "offset": 29100 } + } + }, + { + "type": "text", + "value": " is a {Buffer|DataView|TypedArray|ArrayBuffer|SharedArrayBuffer},\nthe byte length as reported by ", + "position": { + "start": { "line": 971, "column": 14, "offset": 29100 }, + "end": { "line": 972, "column": 32, "offset": 29197 } + } + }, + { + "type": "inlineCode", + "value": ".byteLength", + "position": { + "start": { "line": 972, "column": 32, "offset": 29197 }, + "end": { "line": 972, "column": 45, "offset": 29210 } + } + }, + { + "type": "text", + "value": " is returned.", + "position": { + "start": { "line": 972, "column": 45, "offset": 29210 }, + "end": { "line": 972, "column": 58, "offset": 29223 } + } + } + ], + "position": { + "start": { "line": 971, "column": 1, "offset": 29087 }, + "end": { "line": 972, "column": 58, "offset": 29223 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "text", + "value": "Static method: ", + "position": { + "start": { "line": 974, "column": 5, "offset": 29229 }, + "end": { "line": 974, "column": 20, "offset": 29244 } + } + }, + { + "type": "inlineCode", + "value": "Buffer.compare(buf1, buf2)", + "position": { + "start": { "line": 974, "column": 20, "offset": 29244 }, + "end": { "line": 974, "column": 48, "offset": 29272 } + } + } + ], + "position": { + "start": { "line": 974, "column": 1, "offset": 29225 }, + "end": { "line": 974, "column": 48, "offset": 29272 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 976, "column": 1, "offset": 29274 }, + "end": { "line": 982, "column": 4, "offset": 29443 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "buf1", + "position": { + "start": { "line": 984, "column": 3, "offset": 29447 }, + "end": { "line": 984, "column": 9, "offset": 29453 } + } + }, + { + "type": "text", + "value": " {Buffer|Uint8Array}", + "position": { + "start": { "line": 984, "column": 9, "offset": 29453 }, + "end": { "line": 984, "column": 29, "offset": 29473 } + } + } + ], + "position": { + "start": { "line": 984, "column": 3, "offset": 29447 }, + "end": { "line": 984, "column": 29, "offset": 29473 } + } + } + ], + "position": { + "start": { "line": 984, "column": 1, "offset": 29445 }, + "end": { "line": 984, "column": 29, "offset": 29473 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "buf2", + "position": { + "start": { "line": 985, "column": 3, "offset": 29476 }, + "end": { "line": 985, "column": 9, "offset": 29482 } + } + }, + { + "type": "text", + "value": " {Buffer|Uint8Array}", + "position": { + "start": { "line": 985, "column": 9, "offset": 29482 }, + "end": { "line": 985, "column": 29, "offset": 29502 } + } + } + ], + "position": { + "start": { "line": 985, "column": 3, "offset": 29476 }, + "end": { "line": 985, "column": 29, "offset": 29502 } + } + } + ], + "position": { + "start": { "line": 985, "column": 1, "offset": 29474 }, + "end": { "line": 985, "column": 29, "offset": 29502 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {integer} Either ", + "position": { + "start": { "line": 986, "column": 3, "offset": 29505 }, + "end": { "line": 986, "column": 29, "offset": 29531 } + } + }, + { + "type": "inlineCode", + "value": "-1", + "position": { + "start": { "line": 986, "column": 29, "offset": 29531 }, + "end": { "line": 986, "column": 33, "offset": 29535 } + } + }, + { + "type": "text", + "value": ", ", + "position": { + "start": { "line": 986, "column": 33, "offset": 29535 }, + "end": { "line": 986, "column": 35, "offset": 29537 } + } + }, + { + "type": "inlineCode", + "value": "0", + "position": { + "start": { "line": 986, "column": 35, "offset": 29537 }, + "end": { "line": 986, "column": 38, "offset": 29540 } + } + }, + { + "type": "text", + "value": ", or ", + "position": { + "start": { "line": 986, "column": 38, "offset": 29540 }, + "end": { "line": 986, "column": 43, "offset": 29545 } + } + }, + { + "type": "inlineCode", + "value": "1", + "position": { + "start": { "line": 986, "column": 43, "offset": 29545 }, + "end": { "line": 986, "column": 46, "offset": 29548 } + } + }, + { + "type": "text", + "value": ", depending on the result of the\ncomparison. See ", + "position": { + "start": { "line": 986, "column": 46, "offset": 29548 }, + "end": { "line": 987, "column": 19, "offset": 29599 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "buf.compare()", + "position": { + "start": { "line": 987, "column": 20, "offset": 29600 }, + "end": { "line": 987, "column": 35, "offset": 29615 } + } + } + ], + "position": { + "start": { "line": 987, "column": 19, "offset": 29599 }, + "end": { "line": 987, "column": 38, "offset": 29618 } + }, + "label": "`buf.compare()`", + "identifier": "`buf.compare()`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": " for details.", + "position": { + "start": { "line": 987, "column": 38, "offset": 29618 }, + "end": { "line": 987, "column": 51, "offset": 29631 } + } + } + ], + "position": { + "start": { "line": 986, "column": 3, "offset": 29505 }, + "end": { "line": 987, "column": 51, "offset": 29631 } + } + } + ], + "position": { + "start": { "line": 986, "column": 1, "offset": 29503 }, + "end": { "line": 987, "column": 51, "offset": 29631 } + } + } + ], + "position": { + "start": { "line": 984, "column": 1, "offset": 29445 }, + "end": { "line": 987, "column": 51, "offset": 29631 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Compares ", + "position": { + "start": { "line": 989, "column": 1, "offset": 29633 }, + "end": { "line": 989, "column": 10, "offset": 29642 } + } + }, + { + "type": "inlineCode", + "value": "buf1", + "position": { + "start": { "line": 989, "column": 10, "offset": 29642 }, + "end": { "line": 989, "column": 16, "offset": 29648 } + } + }, + { + "type": "text", + "value": " to ", + "position": { + "start": { "line": 989, "column": 16, "offset": 29648 }, + "end": { "line": 989, "column": 20, "offset": 29652 } + } + }, + { + "type": "inlineCode", + "value": "buf2", + "position": { + "start": { "line": 989, "column": 20, "offset": 29652 }, + "end": { "line": 989, "column": 26, "offset": 29658 } + } + }, + { + "type": "text", + "value": ", typically for the purpose of sorting arrays of\n", + "position": { + "start": { "line": 989, "column": 26, "offset": 29658 }, + "end": { "line": 990, "column": 1, "offset": 29707 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 990, "column": 1, "offset": 29707 }, + "end": { "line": 990, "column": 9, "offset": 29715 } + } + }, + { + "type": "text", + "value": " instances. This is equivalent to calling\n", + "position": { + "start": { "line": 990, "column": 9, "offset": 29715 }, + "end": { "line": 991, "column": 1, "offset": 29757 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "buf1.compare(buf2)", + "position": { + "start": { "line": 991, "column": 2, "offset": 29758 }, + "end": { "line": 991, "column": 22, "offset": 29778 } + } + } + ], + "position": { + "start": { "line": 991, "column": 1, "offset": 29757 }, + "end": { "line": 991, "column": 40, "offset": 29796 } + }, + "label": "`buf.compare()`", + "identifier": "`buf.compare()`", + "referenceType": "full" + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 991, "column": 40, "offset": 29796 }, + "end": { "line": 991, "column": 41, "offset": 29797 } + } + } + ], + "position": { + "start": { "line": 989, "column": 1, "offset": 29633 }, + "end": { "line": 991, "column": 41, "offset": 29797 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf1 = Buffer.from('1234');\nconst buf2 = Buffer.from('0123');\nconst arr = [buf1, buf2];\n\nconsole.log(arr.sort(Buffer.compare));\n// Prints: [ , ]\n// (This result is equal to: [buf2, buf1].)", + "position": { + "start": { "line": 993, "column": 1, "offset": 29799 }, + "end": { "line": 1003, "column": 4, "offset": 30084 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf1 = Buffer.from('1234');\nconst buf2 = Buffer.from('0123');\nconst arr = [buf1, buf2];\n\nconsole.log(arr.sort(Buffer.compare));\n// Prints: [ , ]\n// (This result is equal to: [buf2, buf1].)", + "position": { + "start": { "line": 1005, "column": 1, "offset": 30086 }, + "end": { "line": 1015, "column": 4, "offset": 30376 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "text", + "value": "Static method: ", + "position": { + "start": { "line": 1017, "column": 5, "offset": 30382 }, + "end": { "line": 1017, "column": 20, "offset": 30397 } + } + }, + { + "type": "inlineCode", + "value": "Buffer.concat(list[, totalLength])", + "position": { + "start": { "line": 1017, "column": 20, "offset": 30397 }, + "end": { "line": 1017, "column": 56, "offset": 30433 } + } + } + ], + "position": { + "start": { "line": 1017, "column": 1, "offset": 30378 }, + "end": { "line": 1017, "column": 56, "offset": 30433 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 1019, "column": 1, "offset": 30435 }, + "end": { "line": 1025, "column": 4, "offset": 30612 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "list", + "position": { + "start": { "line": 1027, "column": 3, "offset": 30616 }, + "end": { "line": 1027, "column": 9, "offset": 30622 } + } + }, + { + "type": "text", + "value": " {Buffer[] | Uint8Array[]} List of ", + "position": { + "start": { "line": 1027, "column": 9, "offset": 30622 }, + "end": { "line": 1027, "column": 46, "offset": 30659 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 1027, "column": 46, "offset": 30659 }, + "end": { "line": 1027, "column": 54, "offset": 30667 } + } + }, + { + "type": "text", + "value": " or {Uint8Array}\ninstances to concatenate.", + "position": { + "start": { "line": 1027, "column": 54, "offset": 30667 }, + "end": { "line": 1028, "column": 28, "offset": 30711 } + } + } + ], + "position": { + "start": { "line": 1027, "column": 3, "offset": 30616 }, + "end": { "line": 1028, "column": 28, "offset": 30711 } + } + } + ], + "position": { + "start": { "line": 1027, "column": 1, "offset": 30614 }, + "end": { "line": 1028, "column": 28, "offset": 30711 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "totalLength", + "position": { + "start": { "line": 1029, "column": 3, "offset": 30714 }, + "end": { "line": 1029, "column": 16, "offset": 30727 } + } + }, + { + "type": "text", + "value": " {integer} Total length of the ", + "position": { + "start": { "line": 1029, "column": 16, "offset": 30727 }, + "end": { "line": 1029, "column": 47, "offset": 30758 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 1029, "column": 47, "offset": 30758 }, + "end": { "line": 1029, "column": 55, "offset": 30766 } + } + }, + { + "type": "text", + "value": " instances in ", + "position": { + "start": { "line": 1029, "column": 55, "offset": 30766 }, + "end": { "line": 1029, "column": 69, "offset": 30780 } + } + }, + { + "type": "inlineCode", + "value": "list", + "position": { + "start": { "line": 1029, "column": 69, "offset": 30780 }, + "end": { "line": 1029, "column": 75, "offset": 30786 } + } + }, + { + "type": "text", + "value": "\nwhen concatenated.", + "position": { + "start": { "line": 1029, "column": 75, "offset": 30786 }, + "end": { "line": 1030, "column": 21, "offset": 30807 } + } + } + ], + "position": { + "start": { "line": 1029, "column": 3, "offset": 30714 }, + "end": { "line": 1030, "column": 21, "offset": 30807 } + } + } + ], + "position": { + "start": { "line": 1029, "column": 1, "offset": 30712 }, + "end": { "line": 1030, "column": 21, "offset": 30807 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {Buffer}", + "position": { + "start": { "line": 1031, "column": 3, "offset": 30810 }, + "end": { "line": 1031, "column": 20, "offset": 30827 } + } + } + ], + "position": { + "start": { "line": 1031, "column": 3, "offset": 30810 }, + "end": { "line": 1031, "column": 20, "offset": 30827 } + } + } + ], + "position": { + "start": { "line": 1031, "column": 1, "offset": 30808 }, + "end": { "line": 1031, "column": 20, "offset": 30827 } + } + } + ], + "position": { + "start": { "line": 1027, "column": 1, "offset": 30614 }, + "end": { "line": 1031, "column": 20, "offset": 30827 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns a new ", + "position": { + "start": { "line": 1033, "column": 1, "offset": 30829 }, + "end": { "line": 1033, "column": 15, "offset": 30843 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 1033, "column": 15, "offset": 30843 }, + "end": { "line": 1033, "column": 23, "offset": 30851 } + } + }, + { + "type": "text", + "value": " which is the result of concatenating all the ", + "position": { + "start": { "line": 1033, "column": 23, "offset": 30851 }, + "end": { "line": 1033, "column": 69, "offset": 30897 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 1033, "column": 69, "offset": 30897 }, + "end": { "line": 1033, "column": 77, "offset": 30905 } + } + }, + { + "type": "text", + "value": "\ninstances in the ", + "position": { + "start": { "line": 1033, "column": 77, "offset": 30905 }, + "end": { "line": 1034, "column": 18, "offset": 30923 } + } + }, + { + "type": "inlineCode", + "value": "list", + "position": { + "start": { "line": 1034, "column": 18, "offset": 30923 }, + "end": { "line": 1034, "column": 24, "offset": 30929 } + } + }, + { + "type": "text", + "value": " together.", + "position": { + "start": { "line": 1034, "column": 24, "offset": 30929 }, + "end": { "line": 1034, "column": 34, "offset": 30939 } + } + } + ], + "position": { + "start": { "line": 1033, "column": 1, "offset": 30829 }, + "end": { "line": 1034, "column": 34, "offset": 30939 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "If the list has no items, or if the ", + "position": { + "start": { "line": 1036, "column": 1, "offset": 30941 }, + "end": { "line": 1036, "column": 37, "offset": 30977 } + } + }, + { + "type": "inlineCode", + "value": "totalLength", + "position": { + "start": { "line": 1036, "column": 37, "offset": 30977 }, + "end": { "line": 1036, "column": 50, "offset": 30990 } + } + }, + { + "type": "text", + "value": " is 0, then a new zero-length\n", + "position": { + "start": { "line": 1036, "column": 50, "offset": 30990 }, + "end": { "line": 1037, "column": 1, "offset": 31020 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 1037, "column": 1, "offset": 31020 }, + "end": { "line": 1037, "column": 9, "offset": 31028 } + } + }, + { + "type": "text", + "value": " is returned.", + "position": { + "start": { "line": 1037, "column": 9, "offset": 31028 }, + "end": { "line": 1037, "column": 22, "offset": 31041 } + } + } + ], + "position": { + "start": { "line": 1036, "column": 1, "offset": 30941 }, + "end": { "line": 1037, "column": 22, "offset": 31041 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "If ", + "position": { + "start": { "line": 1039, "column": 1, "offset": 31043 }, + "end": { "line": 1039, "column": 4, "offset": 31046 } + } + }, + { + "type": "inlineCode", + "value": "totalLength", + "position": { + "start": { "line": 1039, "column": 4, "offset": 31046 }, + "end": { "line": 1039, "column": 17, "offset": 31059 } + } + }, + { + "type": "text", + "value": " is not provided, it is calculated from the ", + "position": { + "start": { "line": 1039, "column": 17, "offset": 31059 }, + "end": { "line": 1039, "column": 61, "offset": 31103 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 1039, "column": 61, "offset": 31103 }, + "end": { "line": 1039, "column": 69, "offset": 31111 } + } + }, + { + "type": "text", + "value": " instances\nin ", + "position": { + "start": { "line": 1039, "column": 69, "offset": 31111 }, + "end": { "line": 1040, "column": 4, "offset": 31125 } + } + }, + { + "type": "inlineCode", + "value": "list", + "position": { + "start": { "line": 1040, "column": 4, "offset": 31125 }, + "end": { "line": 1040, "column": 10, "offset": 31131 } + } + }, + { + "type": "text", + "value": " by adding their lengths.", + "position": { + "start": { "line": 1040, "column": 10, "offset": 31131 }, + "end": { "line": 1040, "column": 35, "offset": 31156 } + } + } + ], + "position": { + "start": { "line": 1039, "column": 1, "offset": 31043 }, + "end": { "line": 1040, "column": 35, "offset": 31156 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "If ", + "position": { + "start": { "line": 1042, "column": 1, "offset": 31158 }, + "end": { "line": 1042, "column": 4, "offset": 31161 } + } + }, + { + "type": "inlineCode", + "value": "totalLength", + "position": { + "start": { "line": 1042, "column": 4, "offset": 31161 }, + "end": { "line": 1042, "column": 17, "offset": 31174 } + } + }, + { + "type": "text", + "value": " is provided, it is coerced to an unsigned integer. If the\ncombined length of the ", + "position": { + "start": { "line": 1042, "column": 17, "offset": 31174 }, + "end": { "line": 1043, "column": 24, "offset": 31256 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 1043, "column": 24, "offset": 31256 }, + "end": { "line": 1043, "column": 32, "offset": 31264 } + } + }, + { + "type": "text", + "value": "s in ", + "position": { + "start": { "line": 1043, "column": 32, "offset": 31264 }, + "end": { "line": 1043, "column": 37, "offset": 31269 } + } + }, + { + "type": "inlineCode", + "value": "list", + "position": { + "start": { "line": 1043, "column": 37, "offset": 31269 }, + "end": { "line": 1043, "column": 43, "offset": 31275 } + } + }, + { + "type": "text", + "value": " exceeds ", + "position": { + "start": { "line": 1043, "column": 43, "offset": 31275 }, + "end": { "line": 1043, "column": 52, "offset": 31284 } + } + }, + { + "type": "inlineCode", + "value": "totalLength", + "position": { + "start": { "line": 1043, "column": 52, "offset": 31284 }, + "end": { "line": 1043, "column": 65, "offset": 31297 } + } + }, + { + "type": "text", + "value": ", the result is\ntruncated to ", + "position": { + "start": { "line": 1043, "column": 65, "offset": 31297 }, + "end": { "line": 1044, "column": 14, "offset": 31326 } + } + }, + { + "type": "inlineCode", + "value": "totalLength", + "position": { + "start": { "line": 1044, "column": 14, "offset": 31326 }, + "end": { "line": 1044, "column": 27, "offset": 31339 } + } + }, + { + "type": "text", + "value": ". If the combined length of the ", + "position": { + "start": { "line": 1044, "column": 27, "offset": 31339 }, + "end": { "line": 1044, "column": 59, "offset": 31371 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 1044, "column": 59, "offset": 31371 }, + "end": { "line": 1044, "column": 67, "offset": 31379 } + } + }, + { + "type": "text", + "value": "s in ", + "position": { + "start": { "line": 1044, "column": 67, "offset": 31379 }, + "end": { "line": 1044, "column": 72, "offset": 31384 } + } + }, + { + "type": "inlineCode", + "value": "list", + "position": { + "start": { "line": 1044, "column": 72, "offset": 31384 }, + "end": { "line": 1044, "column": 78, "offset": 31390 } + } + }, + { + "type": "text", + "value": " is\nless than ", + "position": { + "start": { "line": 1044, "column": 78, "offset": 31390 }, + "end": { "line": 1045, "column": 11, "offset": 31404 } + } + }, + { + "type": "inlineCode", + "value": "totalLength", + "position": { + "start": { "line": 1045, "column": 11, "offset": 31404 }, + "end": { "line": 1045, "column": 24, "offset": 31417 } + } + }, + { + "type": "text", + "value": ", the remaining space is filled with zeros.", + "position": { + "start": { "line": 1045, "column": 24, "offset": 31417 }, + "end": { "line": 1045, "column": 67, "offset": 31460 } + } + } + ], + "position": { + "start": { "line": 1042, "column": 1, "offset": 31158 }, + "end": { "line": 1045, "column": 67, "offset": 31460 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\n// Create a single `Buffer` from a list of three `Buffer` instances.\n\nconst buf1 = Buffer.alloc(10);\nconst buf2 = Buffer.alloc(14);\nconst buf3 = Buffer.alloc(18);\nconst totalLength = buf1.length + buf2.length + buf3.length;\n\nconsole.log(totalLength);\n// Prints: 42\n\nconst bufA = Buffer.concat([buf1, buf2, buf3], totalLength);\n\nconsole.log(bufA);\n// Prints: \nconsole.log(bufA.length);\n// Prints: 42", + "position": { + "start": { "line": 1047, "column": 1, "offset": 31462 }, + "end": { "line": 1066, "column": 4, "offset": 31934 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\n// Create a single `Buffer` from a list of three `Buffer` instances.\n\nconst buf1 = Buffer.alloc(10);\nconst buf2 = Buffer.alloc(14);\nconst buf3 = Buffer.alloc(18);\nconst totalLength = buf1.length + buf2.length + buf3.length;\n\nconsole.log(totalLength);\n// Prints: 42\n\nconst bufA = Buffer.concat([buf1, buf2, buf3], totalLength);\n\nconsole.log(bufA);\n// Prints: \nconsole.log(bufA.length);\n// Prints: 42", + "position": { + "start": { "line": 1068, "column": 1, "offset": 31936 }, + "end": { "line": 1087, "column": 4, "offset": 32413 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "Buffer.concat()", + "position": { + "start": { "line": 1089, "column": 1, "offset": 32415 }, + "end": { "line": 1089, "column": 18, "offset": 32432 } + } + }, + { + "type": "text", + "value": " may also use the internal ", + "position": { + "start": { "line": 1089, "column": 18, "offset": 32432 }, + "end": { "line": 1089, "column": 45, "offset": 32459 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 1089, "column": 45, "offset": 32459 }, + "end": { "line": 1089, "column": 53, "offset": 32467 } + } + }, + { + "type": "text", + "value": " pool like\n", + "position": { + "start": { "line": 1089, "column": 53, "offset": 32467 }, + "end": { "line": 1090, "column": 1, "offset": 32478 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "Buffer.allocUnsafe()", + "position": { + "start": { "line": 1090, "column": 2, "offset": 32479 }, + "end": { "line": 1090, "column": 24, "offset": 32501 } + } + } + ], + "position": { + "start": { "line": 1090, "column": 1, "offset": 32478 }, + "end": { "line": 1090, "column": 27, "offset": 32504 } + }, + "label": "`Buffer.allocUnsafe()`", + "identifier": "`buffer.allocunsafe()`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": " does.", + "position": { + "start": { "line": 1090, "column": 27, "offset": 32504 }, + "end": { "line": 1090, "column": 33, "offset": 32510 } + } + } + ], + "position": { + "start": { "line": 1089, "column": 1, "offset": 32415 }, + "end": { "line": 1090, "column": 33, "offset": 32510 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "text", + "value": "Static method: ", + "position": { + "start": { "line": 1092, "column": 5, "offset": 32516 }, + "end": { "line": 1092, "column": 20, "offset": 32531 } + } + }, + { + "type": "inlineCode", + "value": "Buffer.copyBytesFrom(view[, offset[, length]])", + "position": { + "start": { "line": 1092, "column": 20, "offset": 32531 }, + "end": { "line": 1092, "column": 68, "offset": 32579 } + } + } + ], + "position": { + "start": { "line": 1092, "column": 1, "offset": 32512 }, + "end": { "line": 1092, "column": 68, "offset": 32579 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 1094, "column": 1, "offset": 32581 }, + "end": { "line": 1098, "column": 4, "offset": 32624 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "view", + "position": { + "start": { "line": 1100, "column": 3, "offset": 32628 }, + "end": { "line": 1100, "column": 9, "offset": 32634 } + } + }, + { + "type": "text", + "value": " {TypedArray} The {TypedArray} to copy.", + "position": { + "start": { "line": 1100, "column": 9, "offset": 32634 }, + "end": { "line": 1100, "column": 48, "offset": 32673 } + } + } + ], + "position": { + "start": { "line": 1100, "column": 3, "offset": 32628 }, + "end": { "line": 1100, "column": 48, "offset": 32673 } + } + } + ], + "position": { + "start": { "line": 1100, "column": 1, "offset": 32626 }, + "end": { "line": 1100, "column": 48, "offset": 32673 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 1101, "column": 3, "offset": 32676 }, + "end": { "line": 1101, "column": 11, "offset": 32684 } + } + }, + { + "type": "text", + "value": " {integer} The starting offset within ", + "position": { + "start": { "line": 1101, "column": 11, "offset": 32684 }, + "end": { "line": 1101, "column": 49, "offset": 32722 } + } + }, + { + "type": "inlineCode", + "value": "view", + "position": { + "start": { "line": 1101, "column": 49, "offset": 32722 }, + "end": { "line": 1101, "column": 55, "offset": 32728 } + } + }, + { + "type": "text", + "value": ". ", + "position": { + "start": { "line": 1101, "column": 55, "offset": 32728 }, + "end": { "line": 1101, "column": 57, "offset": 32730 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { + "line": 1101, + "column": 59, + "offset": 32732 + }, + "end": { "line": 1101, "column": 67, "offset": 32740 } + } + } + ], + "position": { + "start": { "line": 1101, "column": 57, "offset": 32730 }, + "end": { "line": 1101, "column": 69, "offset": 32742 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 1101, "column": 69, "offset": 32742 }, + "end": { "line": 1101, "column": 70, "offset": 32743 } + } + }, + { + "type": "inlineCode", + "value": "0", + "position": { + "start": { "line": 1101, "column": 70, "offset": 32743 }, + "end": { "line": 1101, "column": 73, "offset": 32746 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 1101, "column": 73, "offset": 32746 }, + "end": { "line": 1101, "column": 74, "offset": 32747 } + } + } + ], + "position": { + "start": { "line": 1101, "column": 3, "offset": 32676 }, + "end": { "line": 1101, "column": 74, "offset": 32747 } + } + } + ], + "position": { + "start": { "line": 1101, "column": 1, "offset": 32674 }, + "end": { "line": 1101, "column": 74, "offset": 32747 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "length", + "position": { + "start": { "line": 1102, "column": 3, "offset": 32750 }, + "end": { "line": 1102, "column": 11, "offset": 32758 } + } + }, + { + "type": "text", + "value": " {integer} The number of elements from ", + "position": { + "start": { "line": 1102, "column": 11, "offset": 32758 }, + "end": { "line": 1102, "column": 50, "offset": 32797 } + } + }, + { + "type": "inlineCode", + "value": "view", + "position": { + "start": { "line": 1102, "column": 50, "offset": 32797 }, + "end": { "line": 1102, "column": 56, "offset": 32803 } + } + }, + { + "type": "text", + "value": " to copy.\n", + "position": { + "start": { "line": 1102, "column": 56, "offset": 32803 }, + "end": { "line": 1103, "column": 1, "offset": 32813 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { "line": 1103, "column": 5, "offset": 32817 }, + "end": { "line": 1103, "column": 13, "offset": 32825 } + } + } + ], + "position": { + "start": { "line": 1103, "column": 3, "offset": 32815 }, + "end": { "line": 1103, "column": 15, "offset": 32827 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 1103, "column": 15, "offset": 32827 }, + "end": { "line": 1103, "column": 16, "offset": 32828 } + } + }, + { + "type": "inlineCode", + "value": "view.length - offset", + "position": { + "start": { "line": 1103, "column": 16, "offset": 32828 }, + "end": { "line": 1103, "column": 38, "offset": 32850 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 1103, "column": 38, "offset": 32850 }, + "end": { "line": 1103, "column": 39, "offset": 32851 } + } + } + ], + "position": { + "start": { "line": 1102, "column": 3, "offset": 32750 }, + "end": { "line": 1103, "column": 39, "offset": 32851 } + } + } + ], + "position": { + "start": { "line": 1102, "column": 1, "offset": 32748 }, + "end": { "line": 1103, "column": 39, "offset": 32851 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {Buffer}", + "position": { + "start": { "line": 1104, "column": 3, "offset": 32854 }, + "end": { "line": 1104, "column": 20, "offset": 32871 } + } + } + ], + "position": { + "start": { "line": 1104, "column": 3, "offset": 32854 }, + "end": { "line": 1104, "column": 20, "offset": 32871 } + } + } + ], + "position": { + "start": { "line": 1104, "column": 1, "offset": 32852 }, + "end": { "line": 1104, "column": 20, "offset": 32871 } + } + } + ], + "position": { + "start": { "line": 1100, "column": 1, "offset": 32626 }, + "end": { "line": 1104, "column": 20, "offset": 32871 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Copies the underlying memory of ", + "position": { + "start": { "line": 1106, "column": 1, "offset": 32873 }, + "end": { "line": 1106, "column": 33, "offset": 32905 } + } + }, + { + "type": "inlineCode", + "value": "view", + "position": { + "start": { "line": 1106, "column": 33, "offset": 32905 }, + "end": { "line": 1106, "column": 39, "offset": 32911 } + } + }, + { + "type": "text", + "value": " into a new ", + "position": { + "start": { "line": 1106, "column": 39, "offset": 32911 }, + "end": { "line": 1106, "column": 51, "offset": 32923 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 1106, "column": 51, "offset": 32923 }, + "end": { "line": 1106, "column": 59, "offset": 32931 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 1106, "column": 59, "offset": 32931 }, + "end": { "line": 1106, "column": 60, "offset": 32932 } + } + } + ], + "position": { + "start": { "line": 1106, "column": 1, "offset": 32873 }, + "end": { "line": 1106, "column": 60, "offset": 32932 } + } + }, + { + "type": "code", + "lang": "js", + "meta": null, + "value": "const u16 = new Uint16Array([0, 0xffff]);\nconst buf = Buffer.copyBytesFrom(u16, 1, 1);\nu16[1] = 0;\nconsole.log(buf.length); // 2\nconsole.log(buf[0]); // 255\nconsole.log(buf[1]); // 255", + "position": { + "start": { "line": 1108, "column": 1, "offset": 32934 }, + "end": { "line": 1115, "column": 4, "offset": 33128 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "text", + "value": "Static method: ", + "position": { + "start": { "line": 1117, "column": 5, "offset": 33134 }, + "end": { "line": 1117, "column": 20, "offset": 33149 } + } + }, + { + "type": "inlineCode", + "value": "Buffer.from(array)", + "position": { + "start": { "line": 1117, "column": 20, "offset": 33149 }, + "end": { "line": 1117, "column": 40, "offset": 33169 } + } + } + ], + "position": { + "start": { "line": 1117, "column": 1, "offset": 33130 }, + "end": { "line": 1117, "column": 40, "offset": 33169 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 1119, "column": 1, "offset": 33171 }, + "end": { "line": 1121, "column": 4, "offset": 33199 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "array", + "position": { + "start": { "line": 1123, "column": 3, "offset": 33203 }, + "end": { "line": 1123, "column": 10, "offset": 33210 } + } + }, + { + "type": "text", + "value": " {integer[]}", + "position": { + "start": { "line": 1123, "column": 10, "offset": 33210 }, + "end": { "line": 1123, "column": 23, "offset": 33223 } + } + } + ], + "position": { + "start": { "line": 1123, "column": 3, "offset": 33203 }, + "end": { "line": 1123, "column": 23, "offset": 33223 } + } + } + ], + "position": { + "start": { "line": 1123, "column": 1, "offset": 33201 }, + "end": { "line": 1123, "column": 23, "offset": 33223 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {Buffer}", + "position": { + "start": { "line": 1124, "column": 3, "offset": 33226 }, + "end": { "line": 1124, "column": 20, "offset": 33243 } + } + } + ], + "position": { + "start": { "line": 1124, "column": 3, "offset": 33226 }, + "end": { "line": 1124, "column": 20, "offset": 33243 } + } + } + ], + "position": { + "start": { "line": 1124, "column": 1, "offset": 33224 }, + "end": { "line": 1124, "column": 20, "offset": 33243 } + } + } + ], + "position": { + "start": { "line": 1123, "column": 1, "offset": 33201 }, + "end": { "line": 1124, "column": 20, "offset": 33243 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Allocates a new ", + "position": { + "start": { "line": 1126, "column": 1, "offset": 33245 }, + "end": { "line": 1126, "column": 17, "offset": 33261 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 1126, "column": 17, "offset": 33261 }, + "end": { "line": 1126, "column": 25, "offset": 33269 } + } + }, + { + "type": "text", + "value": " using an ", + "position": { + "start": { "line": 1126, "column": 25, "offset": 33269 }, + "end": { "line": 1126, "column": 35, "offset": 33279 } + } + }, + { + "type": "inlineCode", + "value": "array", + "position": { + "start": { "line": 1126, "column": 35, "offset": 33279 }, + "end": { "line": 1126, "column": 42, "offset": 33286 } + } + }, + { + "type": "text", + "value": " of bytes in the range ", + "position": { + "start": { "line": 1126, "column": 42, "offset": 33286 }, + "end": { "line": 1126, "column": 65, "offset": 33309 } + } + }, + { + "type": "inlineCode", + "value": "0", + "position": { + "start": { "line": 1126, "column": 65, "offset": 33309 }, + "end": { "line": 1126, "column": 68, "offset": 33312 } + } + }, + { + "type": "text", + "value": " – ", + "position": { + "start": { "line": 1126, "column": 68, "offset": 33312 }, + "end": { "line": 1126, "column": 71, "offset": 33315 } + } + }, + { + "type": "inlineCode", + "value": "255", + "position": { + "start": { "line": 1126, "column": 71, "offset": 33315 }, + "end": { "line": 1126, "column": 76, "offset": 33320 } + } + }, + { + "type": "text", + "value": ".\nArray entries outside that range will be truncated to fit into it.", + "position": { + "start": { "line": 1126, "column": 76, "offset": 33320 }, + "end": { "line": 1127, "column": 67, "offset": 33388 } + } + } + ], + "position": { + "start": { "line": 1126, "column": 1, "offset": 33245 }, + "end": { "line": 1127, "column": 67, "offset": 33388 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\n// Creates a new Buffer containing the UTF-8 bytes of the string 'buffer'.\nconst buf = Buffer.from([0x62, 0x75, 0x66, 0x66, 0x65, 0x72]);", + "position": { + "start": { "line": 1129, "column": 1, "offset": 33390 }, + "end": { "line": 1134, "column": 4, "offset": 33577 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\n// Creates a new Buffer containing the UTF-8 bytes of the string 'buffer'.\nconst buf = Buffer.from([0x62, 0x75, 0x66, 0x66, 0x65, 0x72]);", + "position": { + "start": { "line": 1136, "column": 1, "offset": 33579 }, + "end": { "line": 1141, "column": 4, "offset": 33771 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "If ", + "position": { + "start": { "line": 1143, "column": 1, "offset": 33773 }, + "end": { "line": 1143, "column": 4, "offset": 33776 } + } + }, + { + "type": "inlineCode", + "value": "array", + "position": { + "start": { "line": 1143, "column": 4, "offset": 33776 }, + "end": { "line": 1143, "column": 11, "offset": 33783 } + } + }, + { + "type": "text", + "value": " is an ", + "position": { + "start": { "line": 1143, "column": 11, "offset": 33783 }, + "end": { "line": 1143, "column": 18, "offset": 33790 } + } + }, + { + "type": "inlineCode", + "value": "Array", + "position": { + "start": { "line": 1143, "column": 18, "offset": 33790 }, + "end": { "line": 1143, "column": 25, "offset": 33797 } + } + }, + { + "type": "text", + "value": "-like object (that is, one with a ", + "position": { + "start": { "line": 1143, "column": 25, "offset": 33797 }, + "end": { "line": 1143, "column": 59, "offset": 33831 } + } + }, + { + "type": "inlineCode", + "value": "length", + "position": { + "start": { "line": 1143, "column": 59, "offset": 33831 }, + "end": { "line": 1143, "column": 67, "offset": 33839 } + } + }, + { + "type": "text", + "value": " property of\ntype ", + "position": { + "start": { "line": 1143, "column": 67, "offset": 33839 }, + "end": { "line": 1144, "column": 6, "offset": 33857 } + } + }, + { + "type": "inlineCode", + "value": "number", + "position": { + "start": { "line": 1144, "column": 6, "offset": 33857 }, + "end": { "line": 1144, "column": 14, "offset": 33865 } + } + }, + { + "type": "text", + "value": "), it is treated as if it is an array, unless it is a ", + "position": { + "start": { "line": 1144, "column": 14, "offset": 33865 }, + "end": { "line": 1144, "column": 68, "offset": 33919 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 1144, "column": 68, "offset": 33919 }, + "end": { "line": 1144, "column": 76, "offset": 33927 } + } + }, + { + "type": "text", + "value": " or\na ", + "position": { + "start": { "line": 1144, "column": 76, "offset": 33927 }, + "end": { "line": 1145, "column": 3, "offset": 33933 } + } + }, + { + "type": "inlineCode", + "value": "Uint8Array", + "position": { + "start": { "line": 1145, "column": 3, "offset": 33933 }, + "end": { "line": 1145, "column": 15, "offset": 33945 } + } + }, + { + "type": "text", + "value": ". This means all other ", + "position": { + "start": { "line": 1145, "column": 15, "offset": 33945 }, + "end": { "line": 1145, "column": 38, "offset": 33968 } + } + }, + { + "type": "inlineCode", + "value": "TypedArray", + "position": { + "start": { "line": 1145, "column": 38, "offset": 33968 }, + "end": { "line": 1145, "column": 50, "offset": 33980 } + } + }, + { + "type": "text", + "value": " variants get treated as an\n", + "position": { + "start": { "line": 1145, "column": 50, "offset": 33980 }, + "end": { "line": 1146, "column": 1, "offset": 34008 } + } + }, + { + "type": "inlineCode", + "value": "Array", + "position": { + "start": { "line": 1146, "column": 1, "offset": 34008 }, + "end": { "line": 1146, "column": 8, "offset": 34015 } + } + }, + { + "type": "text", + "value": ". To create a ", + "position": { + "start": { "line": 1146, "column": 8, "offset": 34015 }, + "end": { "line": 1146, "column": 22, "offset": 34029 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 1146, "column": 22, "offset": 34029 }, + "end": { "line": 1146, "column": 30, "offset": 34037 } + } + }, + { + "type": "text", + "value": " from the bytes backing a ", + "position": { + "start": { "line": 1146, "column": 30, "offset": 34037 }, + "end": { "line": 1146, "column": 56, "offset": 34063 } + } + }, + { + "type": "inlineCode", + "value": "TypedArray", + "position": { + "start": { "line": 1146, "column": 56, "offset": 34063 }, + "end": { "line": 1146, "column": 68, "offset": 34075 } + } + }, + { + "type": "text", + "value": ", use\n", + "position": { + "start": { "line": 1146, "column": 68, "offset": 34075 }, + "end": { "line": 1147, "column": 1, "offset": 34081 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "Buffer.copyBytesFrom()", + "position": { + "start": { "line": 1147, "column": 2, "offset": 34082 }, + "end": { "line": 1147, "column": 26, "offset": 34106 } + } + } + ], + "position": { + "start": { "line": 1147, "column": 1, "offset": 34081 }, + "end": { "line": 1147, "column": 29, "offset": 34109 } + }, + "label": "`Buffer.copyBytesFrom()`", + "identifier": "`buffer.copybytesfrom()`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 1147, "column": 29, "offset": 34109 }, + "end": { "line": 1147, "column": 30, "offset": 34110 } + } + } + ], + "position": { + "start": { "line": 1143, "column": 1, "offset": 33773 }, + "end": { "line": 1147, "column": 30, "offset": 34110 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "A ", + "position": { + "start": { "line": 1149, "column": 1, "offset": 34112 }, + "end": { "line": 1149, "column": 3, "offset": 34114 } + } + }, + { + "type": "inlineCode", + "value": "TypeError", + "position": { + "start": { "line": 1149, "column": 3, "offset": 34114 }, + "end": { "line": 1149, "column": 14, "offset": 34125 } + } + }, + { + "type": "text", + "value": " will be thrown if ", + "position": { + "start": { "line": 1149, "column": 14, "offset": 34125 }, + "end": { "line": 1149, "column": 33, "offset": 34144 } + } + }, + { + "type": "inlineCode", + "value": "array", + "position": { + "start": { "line": 1149, "column": 33, "offset": 34144 }, + "end": { "line": 1149, "column": 40, "offset": 34151 } + } + }, + { + "type": "text", + "value": " is not an ", + "position": { + "start": { "line": 1149, "column": 40, "offset": 34151 }, + "end": { "line": 1149, "column": 51, "offset": 34162 } + } + }, + { + "type": "inlineCode", + "value": "Array", + "position": { + "start": { "line": 1149, "column": 51, "offset": 34162 }, + "end": { "line": 1149, "column": 58, "offset": 34169 } + } + }, + { + "type": "text", + "value": " or another type\nappropriate for ", + "position": { + "start": { "line": 1149, "column": 58, "offset": 34169 }, + "end": { "line": 1150, "column": 17, "offset": 34202 } + } + }, + { + "type": "inlineCode", + "value": "Buffer.from()", + "position": { + "start": { "line": 1150, "column": 17, "offset": 34202 }, + "end": { "line": 1150, "column": 32, "offset": 34217 } + } + }, + { + "type": "text", + "value": " variants.", + "position": { + "start": { "line": 1150, "column": 32, "offset": 34217 }, + "end": { "line": 1150, "column": 42, "offset": 34227 } + } + } + ], + "position": { + "start": { "line": 1149, "column": 1, "offset": 34112 }, + "end": { "line": 1150, "column": 42, "offset": 34227 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "Buffer.from(array)", + "position": { + "start": { "line": 1152, "column": 1, "offset": 34229 }, + "end": { "line": 1152, "column": 21, "offset": 34249 } + } + }, + { + "type": "text", + "value": " and ", + "position": { + "start": { "line": 1152, "column": 21, "offset": 34249 }, + "end": { "line": 1152, "column": 26, "offset": 34254 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "Buffer.from(string)", + "position": { + "start": { "line": 1152, "column": 27, "offset": 34255 }, + "end": { "line": 1152, "column": 48, "offset": 34276 } + } + } + ], + "position": { + "start": { "line": 1152, "column": 26, "offset": 34254 }, + "end": { "line": 1152, "column": 51, "offset": 34279 } + }, + "label": "`Buffer.from(string)`", + "identifier": "`buffer.from(string)`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": " may also use the internal\n", + "position": { + "start": { "line": 1152, "column": 51, "offset": 34279 }, + "end": { "line": 1153, "column": 1, "offset": 34306 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 1153, "column": 1, "offset": 34306 }, + "end": { "line": 1153, "column": 9, "offset": 34314 } + } + }, + { + "type": "text", + "value": " pool like ", + "position": { + "start": { "line": 1153, "column": 9, "offset": 34314 }, + "end": { "line": 1153, "column": 20, "offset": 34325 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "Buffer.allocUnsafe()", + "position": { + "start": { "line": 1153, "column": 21, "offset": 34326 }, + "end": { "line": 1153, "column": 43, "offset": 34348 } + } + } + ], + "position": { + "start": { "line": 1153, "column": 20, "offset": 34325 }, + "end": { "line": 1153, "column": 46, "offset": 34351 } + }, + "label": "`Buffer.allocUnsafe()`", + "identifier": "`buffer.allocunsafe()`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": " does.", + "position": { + "start": { "line": 1153, "column": 46, "offset": 34351 }, + "end": { "line": 1153, "column": 52, "offset": 34357 } + } + } + ], + "position": { + "start": { "line": 1152, "column": 1, "offset": 34229 }, + "end": { "line": 1153, "column": 52, "offset": 34357 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "text", + "value": "Static method: ", + "position": { + "start": { "line": 1155, "column": 5, "offset": 34363 }, + "end": { "line": 1155, "column": 20, "offset": 34378 } + } + }, + { + "type": "inlineCode", + "value": "Buffer.from(arrayBuffer[, byteOffset[, length]])", + "position": { + "start": { "line": 1155, "column": 20, "offset": 34378 }, + "end": { "line": 1155, "column": 70, "offset": 34428 } + } + } + ], + "position": { + "start": { "line": 1155, "column": 1, "offset": 34359 }, + "end": { "line": 1155, "column": 70, "offset": 34428 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 1157, "column": 1, "offset": 34430 }, + "end": { "line": 1159, "column": 4, "offset": 34458 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "arrayBuffer", + "position": { + "start": { "line": 1161, "column": 3, "offset": 34462 }, + "end": { "line": 1161, "column": 16, "offset": 34475 } + } + }, + { + "type": "text", + "value": " {ArrayBuffer|SharedArrayBuffer} An {ArrayBuffer},\n{SharedArrayBuffer}, for example the ", + "position": { + "start": { "line": 1161, "column": 16, "offset": 34475 }, + "end": { "line": 1162, "column": 40, "offset": 34565 } + } + }, + { + "type": "inlineCode", + "value": ".buffer", + "position": { + "start": { "line": 1162, "column": 40, "offset": 34565 }, + "end": { "line": 1162, "column": 49, "offset": 34574 } + } + }, + { + "type": "text", + "value": " property of a\n{TypedArray}.", + "position": { + "start": { "line": 1162, "column": 49, "offset": 34574 }, + "end": { "line": 1163, "column": 16, "offset": 34604 } + } + } + ], + "position": { + "start": { "line": 1161, "column": 3, "offset": 34462 }, + "end": { "line": 1163, "column": 16, "offset": 34604 } + } + } + ], + "position": { + "start": { "line": 1161, "column": 1, "offset": 34460 }, + "end": { "line": 1163, "column": 16, "offset": 34604 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "byteOffset", + "position": { + "start": { "line": 1164, "column": 3, "offset": 34607 }, + "end": { "line": 1164, "column": 15, "offset": 34619 } + } + }, + { + "type": "text", + "value": " {integer} Index of first byte to expose. ", + "position": { + "start": { "line": 1164, "column": 15, "offset": 34619 }, + "end": { "line": 1164, "column": 57, "offset": 34661 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { + "line": 1164, + "column": 59, + "offset": 34663 + }, + "end": { "line": 1164, "column": 67, "offset": 34671 } + } + } + ], + "position": { + "start": { "line": 1164, "column": 57, "offset": 34661 }, + "end": { "line": 1164, "column": 69, "offset": 34673 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 1164, "column": 69, "offset": 34673 }, + "end": { "line": 1164, "column": 70, "offset": 34674 } + } + }, + { + "type": "inlineCode", + "value": "0", + "position": { + "start": { "line": 1164, "column": 70, "offset": 34674 }, + "end": { "line": 1164, "column": 73, "offset": 34677 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 1164, "column": 73, "offset": 34677 }, + "end": { "line": 1164, "column": 74, "offset": 34678 } + } + } + ], + "position": { + "start": { "line": 1164, "column": 3, "offset": 34607 }, + "end": { "line": 1164, "column": 74, "offset": 34678 } + } + } + ], + "position": { + "start": { "line": 1164, "column": 1, "offset": 34605 }, + "end": { "line": 1164, "column": 74, "offset": 34678 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "length", + "position": { + "start": { "line": 1165, "column": 3, "offset": 34681 }, + "end": { "line": 1165, "column": 11, "offset": 34689 } + } + }, + { + "type": "text", + "value": " {integer} Number of bytes to expose.\n", + "position": { + "start": { "line": 1165, "column": 11, "offset": 34689 }, + "end": { "line": 1166, "column": 1, "offset": 34727 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { "line": 1166, "column": 5, "offset": 34731 }, + "end": { "line": 1166, "column": 13, "offset": 34739 } + } + } + ], + "position": { + "start": { "line": 1166, "column": 3, "offset": 34729 }, + "end": { "line": 1166, "column": 15, "offset": 34741 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 1166, "column": 15, "offset": 34741 }, + "end": { "line": 1166, "column": 16, "offset": 34742 } + } + }, + { + "type": "inlineCode", + "value": "arrayBuffer.byteLength - byteOffset", + "position": { + "start": { "line": 1166, "column": 16, "offset": 34742 }, + "end": { "line": 1166, "column": 53, "offset": 34779 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 1166, "column": 53, "offset": 34779 }, + "end": { "line": 1166, "column": 54, "offset": 34780 } + } + } + ], + "position": { + "start": { "line": 1165, "column": 3, "offset": 34681 }, + "end": { "line": 1166, "column": 54, "offset": 34780 } + } + } + ], + "position": { + "start": { "line": 1165, "column": 1, "offset": 34679 }, + "end": { "line": 1166, "column": 54, "offset": 34780 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {Buffer}", + "position": { + "start": { "line": 1167, "column": 3, "offset": 34783 }, + "end": { "line": 1167, "column": 20, "offset": 34800 } + } + } + ], + "position": { + "start": { "line": 1167, "column": 3, "offset": 34783 }, + "end": { "line": 1167, "column": 20, "offset": 34800 } + } + } + ], + "position": { + "start": { "line": 1167, "column": 1, "offset": 34781 }, + "end": { "line": 1167, "column": 20, "offset": 34800 } + } + } + ], + "position": { + "start": { "line": 1161, "column": 1, "offset": 34460 }, + "end": { "line": 1167, "column": 20, "offset": 34800 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "This creates a view of the {ArrayBuffer} without copying the underlying\nmemory. For example, when passed a reference to the ", + "position": { + "start": { "line": 1169, "column": 1, "offset": 34802 }, + "end": { "line": 1170, "column": 53, "offset": 34926 } + } + }, + { + "type": "inlineCode", + "value": ".buffer", + "position": { + "start": { "line": 1170, "column": 53, "offset": 34926 }, + "end": { "line": 1170, "column": 62, "offset": 34935 } + } + }, + { + "type": "text", + "value": " property of a\n{TypedArray} instance, the newly created ", + "position": { + "start": { "line": 1170, "column": 62, "offset": 34935 }, + "end": { "line": 1171, "column": 42, "offset": 34991 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 1171, "column": 42, "offset": 34991 }, + "end": { "line": 1171, "column": 50, "offset": 34999 } + } + }, + { + "type": "text", + "value": " will share the same\nallocated memory as the {TypedArray}'s underlying ", + "position": { + "start": { "line": 1171, "column": 50, "offset": 34999 }, + "end": { "line": 1172, "column": 51, "offset": 35070 } + } + }, + { + "type": "inlineCode", + "value": "ArrayBuffer", + "position": { + "start": { "line": 1172, "column": 51, "offset": 35070 }, + "end": { "line": 1172, "column": 64, "offset": 35083 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 1172, "column": 64, "offset": 35083 }, + "end": { "line": 1172, "column": 65, "offset": 35084 } + } + } + ], + "position": { + "start": { "line": 1169, "column": 1, "offset": 34802 }, + "end": { "line": 1172, "column": 65, "offset": 35084 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst arr = new Uint16Array(2);\n\narr[0] = 5000;\narr[1] = 4000;\n\n// Shares memory with `arr`.\nconst buf = Buffer.from(arr.buffer);\n\nconsole.log(buf);\n// Prints: \n\n// Changing the original Uint16Array changes the Buffer also.\narr[1] = 6000;\n\nconsole.log(buf);\n// Prints: ", + "position": { + "start": { "line": 1174, "column": 1, "offset": 35086 }, + "end": { "line": 1193, "column": 4, "offset": 35445 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst arr = new Uint16Array(2);\n\narr[0] = 5000;\narr[1] = 4000;\n\n// Shares memory with `arr`.\nconst buf = Buffer.from(arr.buffer);\n\nconsole.log(buf);\n// Prints: \n\n// Changing the original Uint16Array changes the Buffer also.\narr[1] = 6000;\n\nconsole.log(buf);\n// Prints: ", + "position": { + "start": { "line": 1195, "column": 1, "offset": 35447 }, + "end": { "line": 1214, "column": 4, "offset": 35811 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "The optional ", + "position": { + "start": { "line": 1216, "column": 1, "offset": 35813 }, + "end": { "line": 1216, "column": 14, "offset": 35826 } + } + }, + { + "type": "inlineCode", + "value": "byteOffset", + "position": { + "start": { "line": 1216, "column": 14, "offset": 35826 }, + "end": { "line": 1216, "column": 26, "offset": 35838 } + } + }, + { + "type": "text", + "value": " and ", + "position": { + "start": { "line": 1216, "column": 26, "offset": 35838 }, + "end": { "line": 1216, "column": 31, "offset": 35843 } + } + }, + { + "type": "inlineCode", + "value": "length", + "position": { + "start": { "line": 1216, "column": 31, "offset": 35843 }, + "end": { "line": 1216, "column": 39, "offset": 35851 } + } + }, + { + "type": "text", + "value": " arguments specify a memory range within\nthe ", + "position": { + "start": { "line": 1216, "column": 39, "offset": 35851 }, + "end": { "line": 1217, "column": 5, "offset": 35896 } + } + }, + { + "type": "inlineCode", + "value": "arrayBuffer", + "position": { + "start": { "line": 1217, "column": 5, "offset": 35896 }, + "end": { "line": 1217, "column": 18, "offset": 35909 } + } + }, + { + "type": "text", + "value": " that will be shared by the ", + "position": { + "start": { "line": 1217, "column": 18, "offset": 35909 }, + "end": { "line": 1217, "column": 46, "offset": 35937 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 1217, "column": 46, "offset": 35937 }, + "end": { "line": 1217, "column": 54, "offset": 35945 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 1217, "column": 54, "offset": 35945 }, + "end": { "line": 1217, "column": 55, "offset": 35946 } + } + } + ], + "position": { + "start": { "line": 1216, "column": 1, "offset": 35813 }, + "end": { "line": 1217, "column": 55, "offset": 35946 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst ab = new ArrayBuffer(10);\nconst buf = Buffer.from(ab, 0, 2);\n\nconsole.log(buf.length);\n// Prints: 2", + "position": { + "start": { "line": 1219, "column": 1, "offset": 35948 }, + "end": { "line": 1227, "column": 4, "offset": 36103 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst ab = new ArrayBuffer(10);\nconst buf = Buffer.from(ab, 0, 2);\n\nconsole.log(buf.length);\n// Prints: 2", + "position": { + "start": { "line": 1229, "column": 1, "offset": 36105 }, + "end": { "line": 1237, "column": 4, "offset": 36265 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "A ", + "position": { + "start": { "line": 1239, "column": 1, "offset": 36267 }, + "end": { "line": 1239, "column": 3, "offset": 36269 } + } + }, + { + "type": "inlineCode", + "value": "TypeError", + "position": { + "start": { "line": 1239, "column": 3, "offset": 36269 }, + "end": { "line": 1239, "column": 14, "offset": 36280 } + } + }, + { + "type": "text", + "value": " will be thrown if ", + "position": { + "start": { "line": 1239, "column": 14, "offset": 36280 }, + "end": { "line": 1239, "column": 33, "offset": 36299 } + } + }, + { + "type": "inlineCode", + "value": "arrayBuffer", + "position": { + "start": { "line": 1239, "column": 33, "offset": 36299 }, + "end": { "line": 1239, "column": 46, "offset": 36312 } + } + }, + { + "type": "text", + "value": " is not an {ArrayBuffer} or a\n{SharedArrayBuffer} or another type appropriate for ", + "position": { + "start": { "line": 1239, "column": 46, "offset": 36312 }, + "end": { "line": 1240, "column": 53, "offset": 36394 } + } + }, + { + "type": "inlineCode", + "value": "Buffer.from()", + "position": { + "start": { "line": 1240, "column": 53, "offset": 36394 }, + "end": { "line": 1240, "column": 68, "offset": 36409 } + } + }, + { + "type": "text", + "value": "\nvariants.", + "position": { + "start": { "line": 1240, "column": 68, "offset": 36409 }, + "end": { "line": 1241, "column": 10, "offset": 36419 } + } + } + ], + "position": { + "start": { "line": 1239, "column": 1, "offset": 36267 }, + "end": { "line": 1241, "column": 10, "offset": 36419 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "It is important to remember that a backing ", + "position": { + "start": { "line": 1243, "column": 1, "offset": 36421 }, + "end": { "line": 1243, "column": 44, "offset": 36464 } + } + }, + { + "type": "inlineCode", + "value": "ArrayBuffer", + "position": { + "start": { "line": 1243, "column": 44, "offset": 36464 }, + "end": { "line": 1243, "column": 57, "offset": 36477 } + } + }, + { + "type": "text", + "value": " can cover a range\nof memory that extends beyond the bounds of a ", + "position": { + "start": { "line": 1243, "column": 57, "offset": 36477 }, + "end": { "line": 1244, "column": 47, "offset": 36542 } + } + }, + { + "type": "inlineCode", + "value": "TypedArray", + "position": { + "start": { "line": 1244, "column": 47, "offset": 36542 }, + "end": { "line": 1244, "column": 59, "offset": 36554 } + } + }, + { + "type": "text", + "value": " view. A new\n", + "position": { + "start": { "line": 1244, "column": 59, "offset": 36554 }, + "end": { "line": 1245, "column": 1, "offset": 36567 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 1245, "column": 1, "offset": 36567 }, + "end": { "line": 1245, "column": 9, "offset": 36575 } + } + }, + { + "type": "text", + "value": " created using the ", + "position": { + "start": { "line": 1245, "column": 9, "offset": 36575 }, + "end": { "line": 1245, "column": 28, "offset": 36594 } + } + }, + { + "type": "inlineCode", + "value": "buffer", + "position": { + "start": { "line": 1245, "column": 28, "offset": 36594 }, + "end": { "line": 1245, "column": 36, "offset": 36602 } + } + }, + { + "type": "text", + "value": " property of a ", + "position": { + "start": { "line": 1245, "column": 36, "offset": 36602 }, + "end": { "line": 1245, "column": 51, "offset": 36617 } + } + }, + { + "type": "inlineCode", + "value": "TypedArray", + "position": { + "start": { "line": 1245, "column": 51, "offset": 36617 }, + "end": { "line": 1245, "column": 63, "offset": 36629 } + } + }, + { + "type": "text", + "value": " may extend\nbeyond the range of the ", + "position": { + "start": { "line": 1245, "column": 63, "offset": 36629 }, + "end": { "line": 1246, "column": 25, "offset": 36665 } + } + }, + { + "type": "inlineCode", + "value": "TypedArray", + "position": { + "start": { "line": 1246, "column": 25, "offset": 36665 }, + "end": { "line": 1246, "column": 37, "offset": 36677 } + } + }, + { + "type": "text", + "value": ":", + "position": { + "start": { "line": 1246, "column": 37, "offset": 36677 }, + "end": { "line": 1246, "column": 38, "offset": 36678 } + } + } + ], + "position": { + "start": { "line": 1243, "column": 1, "offset": 36421 }, + "end": { "line": 1246, "column": 38, "offset": 36678 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst arrA = Uint8Array.from([0x63, 0x64, 0x65, 0x66]); // 4 elements\nconst arrB = new Uint8Array(arrA.buffer, 1, 2); // 2 elements\nconsole.log(arrA.buffer === arrB.buffer); // true\n\nconst buf = Buffer.from(arrB.buffer);\nconsole.log(buf);\n// Prints: ", + "position": { + "start": { "line": 1248, "column": 1, "offset": 36680 }, + "end": { "line": 1258, "column": 4, "offset": 37000 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst arrA = Uint8Array.from([0x63, 0x64, 0x65, 0x66]); // 4 elements\nconst arrB = new Uint8Array(arrA.buffer, 1, 2); // 2 elements\nconsole.log(arrA.buffer === arrB.buffer); // true\n\nconst buf = Buffer.from(arrB.buffer);\nconsole.log(buf);\n// Prints: ", + "position": { + "start": { "line": 1260, "column": 1, "offset": 37002 }, + "end": { "line": 1270, "column": 4, "offset": 37327 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "text", + "value": "Static method: ", + "position": { + "start": { "line": 1272, "column": 5, "offset": 37333 }, + "end": { "line": 1272, "column": 20, "offset": 37348 } + } + }, + { + "type": "inlineCode", + "value": "Buffer.from(buffer)", + "position": { + "start": { "line": 1272, "column": 20, "offset": 37348 }, + "end": { "line": 1272, "column": 41, "offset": 37369 } + } + } + ], + "position": { + "start": { "line": 1272, "column": 1, "offset": 37329 }, + "end": { "line": 1272, "column": 41, "offset": 37369 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 1274, "column": 1, "offset": 37371 }, + "end": { "line": 1276, "column": 4, "offset": 37399 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "buffer", + "position": { + "start": { "line": 1278, "column": 3, "offset": 37403 }, + "end": { "line": 1278, "column": 11, "offset": 37411 } + } + }, + { + "type": "text", + "value": " {Buffer|Uint8Array} An existing ", + "position": { + "start": { "line": 1278, "column": 11, "offset": 37411 }, + "end": { "line": 1278, "column": 44, "offset": 37444 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 1278, "column": 44, "offset": 37444 }, + "end": { "line": 1278, "column": 52, "offset": 37452 } + } + }, + { + "type": "text", + "value": " or {Uint8Array} from\nwhich to copy data.", + "position": { + "start": { "line": 1278, "column": 52, "offset": 37452 }, + "end": { "line": 1279, "column": 22, "offset": 37495 } + } + } + ], + "position": { + "start": { "line": 1278, "column": 3, "offset": 37403 }, + "end": { "line": 1279, "column": 22, "offset": 37495 } + } + } + ], + "position": { + "start": { "line": 1278, "column": 1, "offset": 37401 }, + "end": { "line": 1279, "column": 22, "offset": 37495 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {Buffer}", + "position": { + "start": { "line": 1280, "column": 3, "offset": 37498 }, + "end": { "line": 1280, "column": 20, "offset": 37515 } + } + } + ], + "position": { + "start": { "line": 1280, "column": 3, "offset": 37498 }, + "end": { "line": 1280, "column": 20, "offset": 37515 } + } + } + ], + "position": { + "start": { "line": 1280, "column": 1, "offset": 37496 }, + "end": { "line": 1280, "column": 20, "offset": 37515 } + } + } + ], + "position": { + "start": { "line": 1278, "column": 1, "offset": 37401 }, + "end": { "line": 1280, "column": 20, "offset": 37515 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Copies the passed ", + "position": { + "start": { "line": 1282, "column": 1, "offset": 37517 }, + "end": { "line": 1282, "column": 19, "offset": 37535 } + } + }, + { + "type": "inlineCode", + "value": "buffer", + "position": { + "start": { "line": 1282, "column": 19, "offset": 37535 }, + "end": { "line": 1282, "column": 27, "offset": 37543 } + } + }, + { + "type": "text", + "value": " data onto a new ", + "position": { + "start": { "line": 1282, "column": 27, "offset": 37543 }, + "end": { "line": 1282, "column": 44, "offset": 37560 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 1282, "column": 44, "offset": 37560 }, + "end": { "line": 1282, "column": 52, "offset": 37568 } + } + }, + { + "type": "text", + "value": " instance.", + "position": { + "start": { "line": 1282, "column": 52, "offset": 37568 }, + "end": { "line": 1282, "column": 62, "offset": 37578 } + } + } + ], + "position": { + "start": { "line": 1282, "column": 1, "offset": 37517 }, + "end": { "line": 1282, "column": 62, "offset": 37578 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf1 = Buffer.from('buffer');\nconst buf2 = Buffer.from(buf1);\n\nbuf1[0] = 0x61;\n\nconsole.log(buf1.toString());\n// Prints: auffer\nconsole.log(buf2.toString());\n// Prints: buffer", + "position": { + "start": { "line": 1284, "column": 1, "offset": 37580 }, + "end": { "line": 1296, "column": 4, "offset": 37811 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf1 = Buffer.from('buffer');\nconst buf2 = Buffer.from(buf1);\n\nbuf1[0] = 0x61;\n\nconsole.log(buf1.toString());\n// Prints: auffer\nconsole.log(buf2.toString());\n// Prints: buffer", + "position": { + "start": { "line": 1298, "column": 1, "offset": 37813 }, + "end": { "line": 1310, "column": 4, "offset": 38049 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "A ", + "position": { + "start": { "line": 1312, "column": 1, "offset": 38051 }, + "end": { "line": 1312, "column": 3, "offset": 38053 } + } + }, + { + "type": "inlineCode", + "value": "TypeError", + "position": { + "start": { "line": 1312, "column": 3, "offset": 38053 }, + "end": { "line": 1312, "column": 14, "offset": 38064 } + } + }, + { + "type": "text", + "value": " will be thrown if ", + "position": { + "start": { "line": 1312, "column": 14, "offset": 38064 }, + "end": { "line": 1312, "column": 33, "offset": 38083 } + } + }, + { + "type": "inlineCode", + "value": "buffer", + "position": { + "start": { "line": 1312, "column": 33, "offset": 38083 }, + "end": { "line": 1312, "column": 41, "offset": 38091 } + } + }, + { + "type": "text", + "value": " is not a ", + "position": { + "start": { "line": 1312, "column": 41, "offset": 38091 }, + "end": { "line": 1312, "column": 51, "offset": 38101 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 1312, "column": 51, "offset": 38101 }, + "end": { "line": 1312, "column": 59, "offset": 38109 } + } + }, + { + "type": "text", + "value": " or another type\nappropriate for ", + "position": { + "start": { "line": 1312, "column": 59, "offset": 38109 }, + "end": { "line": 1313, "column": 17, "offset": 38142 } + } + }, + { + "type": "inlineCode", + "value": "Buffer.from()", + "position": { + "start": { "line": 1313, "column": 17, "offset": 38142 }, + "end": { "line": 1313, "column": 32, "offset": 38157 } + } + }, + { + "type": "text", + "value": " variants.", + "position": { + "start": { "line": 1313, "column": 32, "offset": 38157 }, + "end": { "line": 1313, "column": 42, "offset": 38167 } + } + } + ], + "position": { + "start": { "line": 1312, "column": 1, "offset": 38051 }, + "end": { "line": 1313, "column": 42, "offset": 38167 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "text", + "value": "Static method: ", + "position": { + "start": { "line": 1315, "column": 5, "offset": 38173 }, + "end": { "line": 1315, "column": 20, "offset": 38188 } + } + }, + { + "type": "inlineCode", + "value": "Buffer.from(object[, offsetOrEncoding[, length]])", + "position": { + "start": { "line": 1315, "column": 20, "offset": 38188 }, + "end": { "line": 1315, "column": 71, "offset": 38239 } + } + } + ], + "position": { + "start": { "line": 1315, "column": 1, "offset": 38169 }, + "end": { "line": 1315, "column": 71, "offset": 38239 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 1317, "column": 1, "offset": 38241 }, + "end": { "line": 1319, "column": 4, "offset": 38268 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "object", + "position": { + "start": { "line": 1321, "column": 3, "offset": 38272 }, + "end": { "line": 1321, "column": 11, "offset": 38280 } + } + }, + { + "type": "text", + "value": " {Object} An object supporting ", + "position": { + "start": { "line": 1321, "column": 11, "offset": 38280 }, + "end": { "line": 1321, "column": 42, "offset": 38311 } + } + }, + { + "type": "inlineCode", + "value": "Symbol.toPrimitive", + "position": { + "start": { "line": 1321, "column": 42, "offset": 38311 }, + "end": { "line": 1321, "column": 62, "offset": 38331 } + } + }, + { + "type": "text", + "value": " or ", + "position": { + "start": { "line": 1321, "column": 62, "offset": 38331 }, + "end": { "line": 1321, "column": 66, "offset": 38335 } + } + }, + { + "type": "inlineCode", + "value": "valueOf()", + "position": { + "start": { "line": 1321, "column": 66, "offset": 38335 }, + "end": { "line": 1321, "column": 77, "offset": 38346 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 1321, "column": 77, "offset": 38346 }, + "end": { "line": 1321, "column": 78, "offset": 38347 } + } + } + ], + "position": { + "start": { "line": 1321, "column": 3, "offset": 38272 }, + "end": { "line": 1321, "column": 78, "offset": 38347 } + } + } + ], + "position": { + "start": { "line": 1321, "column": 1, "offset": 38270 }, + "end": { "line": 1321, "column": 78, "offset": 38347 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "offsetOrEncoding", + "position": { + "start": { "line": 1322, "column": 3, "offset": 38350 }, + "end": { "line": 1322, "column": 21, "offset": 38368 } + } + }, + { + "type": "text", + "value": " {integer|string} A byte-offset or encoding.", + "position": { + "start": { "line": 1322, "column": 21, "offset": 38368 }, + "end": { "line": 1322, "column": 65, "offset": 38412 } + } + } + ], + "position": { + "start": { "line": 1322, "column": 3, "offset": 38350 }, + "end": { "line": 1322, "column": 65, "offset": 38412 } + } + } + ], + "position": { + "start": { "line": 1322, "column": 1, "offset": 38348 }, + "end": { "line": 1322, "column": 65, "offset": 38412 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "length", + "position": { + "start": { "line": 1323, "column": 3, "offset": 38415 }, + "end": { "line": 1323, "column": 11, "offset": 38423 } + } + }, + { + "type": "text", + "value": " {integer} A length.", + "position": { + "start": { "line": 1323, "column": 11, "offset": 38423 }, + "end": { "line": 1323, "column": 31, "offset": 38443 } + } + } + ], + "position": { + "start": { "line": 1323, "column": 3, "offset": 38415 }, + "end": { "line": 1323, "column": 31, "offset": 38443 } + } + } + ], + "position": { + "start": { "line": 1323, "column": 1, "offset": 38413 }, + "end": { "line": 1323, "column": 31, "offset": 38443 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {Buffer}", + "position": { + "start": { "line": 1324, "column": 3, "offset": 38446 }, + "end": { "line": 1324, "column": 20, "offset": 38463 } + } + } + ], + "position": { + "start": { "line": 1324, "column": 3, "offset": 38446 }, + "end": { "line": 1324, "column": 20, "offset": 38463 } + } + } + ], + "position": { + "start": { "line": 1324, "column": 1, "offset": 38444 }, + "end": { "line": 1324, "column": 20, "offset": 38463 } + } + } + ], + "position": { + "start": { "line": 1321, "column": 1, "offset": 38270 }, + "end": { "line": 1324, "column": 20, "offset": 38463 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "For objects whose ", + "position": { + "start": { "line": 1326, "column": 1, "offset": 38465 }, + "end": { "line": 1326, "column": 19, "offset": 38483 } + } + }, + { + "type": "inlineCode", + "value": "valueOf()", + "position": { + "start": { "line": 1326, "column": 19, "offset": 38483 }, + "end": { "line": 1326, "column": 30, "offset": 38494 } + } + }, + { + "type": "text", + "value": " function returns a value not strictly equal to\n", + "position": { + "start": { "line": 1326, "column": 30, "offset": 38494 }, + "end": { "line": 1327, "column": 1, "offset": 38542 } + } + }, + { + "type": "inlineCode", + "value": "object", + "position": { + "start": { "line": 1327, "column": 1, "offset": 38542 }, + "end": { "line": 1327, "column": 9, "offset": 38550 } + } + }, + { + "type": "text", + "value": ", returns ", + "position": { + "start": { "line": 1327, "column": 9, "offset": 38550 }, + "end": { "line": 1327, "column": 19, "offset": 38560 } + } + }, + { + "type": "inlineCode", + "value": "Buffer.from(object.valueOf(), offsetOrEncoding, length)", + "position": { + "start": { "line": 1327, "column": 19, "offset": 38560 }, + "end": { "line": 1327, "column": 76, "offset": 38617 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 1327, "column": 76, "offset": 38617 }, + "end": { "line": 1327, "column": 77, "offset": 38618 } + } + } + ], + "position": { + "start": { "line": 1326, "column": 1, "offset": 38465 }, + "end": { "line": 1327, "column": 77, "offset": 38618 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from(new String('this is a test'));\n// Prints: ", + "position": { + "start": { "line": 1329, "column": 1, "offset": 38620 }, + "end": { "line": 1334, "column": 4, "offset": 38786 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from(new String('this is a test'));\n// Prints: ", + "position": { + "start": { "line": 1336, "column": 1, "offset": 38788 }, + "end": { "line": 1341, "column": 4, "offset": 38959 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "For objects that support ", + "position": { + "start": { "line": 1343, "column": 1, "offset": 38961 }, + "end": { "line": 1343, "column": 26, "offset": 38986 } + } + }, + { + "type": "inlineCode", + "value": "Symbol.toPrimitive", + "position": { + "start": { "line": 1343, "column": 26, "offset": 38986 }, + "end": { "line": 1343, "column": 46, "offset": 39006 } + } + }, + { + "type": "text", + "value": ", returns\n", + "position": { + "start": { "line": 1343, "column": 46, "offset": 39006 }, + "end": { "line": 1344, "column": 1, "offset": 39016 } + } + }, + { + "type": "inlineCode", + "value": "Buffer.from(object[Symbol.toPrimitive]('string'), offsetOrEncoding)", + "position": { + "start": { "line": 1344, "column": 1, "offset": 39016 }, + "end": { "line": 1344, "column": 70, "offset": 39085 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 1344, "column": 70, "offset": 39085 }, + "end": { "line": 1344, "column": 71, "offset": 39086 } + } + } + ], + "position": { + "start": { "line": 1343, "column": 1, "offset": 38961 }, + "end": { "line": 1344, "column": 71, "offset": 39086 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nclass Foo {\n [Symbol.toPrimitive]() {\n return 'this is a test';\n }\n}\n\nconst buf = Buffer.from(new Foo(), 'utf8');\n// Prints: ", + "position": { + "start": { "line": 1346, "column": 1, "offset": 39088 }, + "end": { "line": 1357, "column": 4, "offset": 39318 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nclass Foo {\n [Symbol.toPrimitive]() {\n return 'this is a test';\n }\n}\n\nconst buf = Buffer.from(new Foo(), 'utf8');\n// Prints: ", + "position": { + "start": { "line": 1359, "column": 1, "offset": 39320 }, + "end": { "line": 1370, "column": 4, "offset": 39555 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "A ", + "position": { + "start": { "line": 1372, "column": 1, "offset": 39557 }, + "end": { "line": 1372, "column": 3, "offset": 39559 } + } + }, + { + "type": "inlineCode", + "value": "TypeError", + "position": { + "start": { "line": 1372, "column": 3, "offset": 39559 }, + "end": { "line": 1372, "column": 14, "offset": 39570 } + } + }, + { + "type": "text", + "value": " will be thrown if ", + "position": { + "start": { "line": 1372, "column": 14, "offset": 39570 }, + "end": { "line": 1372, "column": 33, "offset": 39589 } + } + }, + { + "type": "inlineCode", + "value": "object", + "position": { + "start": { "line": 1372, "column": 33, "offset": 39589 }, + "end": { "line": 1372, "column": 41, "offset": 39597 } + } + }, + { + "type": "text", + "value": " does not have the mentioned methods or\nis not of another type appropriate for ", + "position": { + "start": { "line": 1372, "column": 41, "offset": 39597 }, + "end": { "line": 1373, "column": 40, "offset": 39676 } + } + }, + { + "type": "inlineCode", + "value": "Buffer.from()", + "position": { + "start": { "line": 1373, "column": 40, "offset": 39676 }, + "end": { "line": 1373, "column": 55, "offset": 39691 } + } + }, + { + "type": "text", + "value": " variants.", + "position": { + "start": { "line": 1373, "column": 55, "offset": 39691 }, + "end": { "line": 1373, "column": 65, "offset": 39701 } + } + } + ], + "position": { + "start": { "line": 1372, "column": 1, "offset": 39557 }, + "end": { "line": 1373, "column": 65, "offset": 39701 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "text", + "value": "Static method: ", + "position": { + "start": { "line": 1375, "column": 5, "offset": 39707 }, + "end": { "line": 1375, "column": 20, "offset": 39722 } + } + }, + { + "type": "inlineCode", + "value": "Buffer.from(string[, encoding])", + "position": { + "start": { "line": 1375, "column": 20, "offset": 39722 }, + "end": { "line": 1375, "column": 53, "offset": 39755 } + } + } + ], + "position": { + "start": { "line": 1375, "column": 1, "offset": 39703 }, + "end": { "line": 1375, "column": 53, "offset": 39755 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 1377, "column": 1, "offset": 39757 }, + "end": { "line": 1379, "column": 4, "offset": 39785 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "string", + "position": { + "start": { "line": 1381, "column": 3, "offset": 39789 }, + "end": { "line": 1381, "column": 11, "offset": 39797 } + } + }, + { + "type": "text", + "value": " {string} A string to encode.", + "position": { + "start": { "line": 1381, "column": 11, "offset": 39797 }, + "end": { "line": 1381, "column": 40, "offset": 39826 } + } + } + ], + "position": { + "start": { "line": 1381, "column": 3, "offset": 39789 }, + "end": { "line": 1381, "column": 40, "offset": 39826 } + } + } + ], + "position": { + "start": { "line": 1381, "column": 1, "offset": 39787 }, + "end": { "line": 1381, "column": 40, "offset": 39826 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "encoding", + "position": { + "start": { "line": 1382, "column": 3, "offset": 39829 }, + "end": { "line": 1382, "column": 13, "offset": 39839 } + } + }, + { + "type": "text", + "value": " {string} The encoding of ", + "position": { + "start": { "line": 1382, "column": 13, "offset": 39839 }, + "end": { "line": 1382, "column": 39, "offset": 39865 } + } + }, + { + "type": "inlineCode", + "value": "string", + "position": { + "start": { "line": 1382, "column": 39, "offset": 39865 }, + "end": { "line": 1382, "column": 47, "offset": 39873 } + } + }, + { + "type": "text", + "value": ". ", + "position": { + "start": { "line": 1382, "column": 47, "offset": 39873 }, + "end": { "line": 1382, "column": 49, "offset": 39875 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { + "line": 1382, + "column": 51, + "offset": 39877 + }, + "end": { "line": 1382, "column": 59, "offset": 39885 } + } + } + ], + "position": { + "start": { "line": 1382, "column": 49, "offset": 39875 }, + "end": { "line": 1382, "column": 61, "offset": 39887 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 1382, "column": 61, "offset": 39887 }, + "end": { "line": 1382, "column": 62, "offset": 39888 } + } + }, + { + "type": "inlineCode", + "value": "'utf8'", + "position": { + "start": { "line": 1382, "column": 62, "offset": 39888 }, + "end": { "line": 1382, "column": 70, "offset": 39896 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 1382, "column": 70, "offset": 39896 }, + "end": { "line": 1382, "column": 71, "offset": 39897 } + } + } + ], + "position": { + "start": { "line": 1382, "column": 3, "offset": 39829 }, + "end": { "line": 1382, "column": 71, "offset": 39897 } + } + } + ], + "position": { + "start": { "line": 1382, "column": 1, "offset": 39827 }, + "end": { "line": 1382, "column": 71, "offset": 39897 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {Buffer}", + "position": { + "start": { "line": 1383, "column": 3, "offset": 39900 }, + "end": { "line": 1383, "column": 20, "offset": 39917 } + } + } + ], + "position": { + "start": { "line": 1383, "column": 3, "offset": 39900 }, + "end": { "line": 1383, "column": 20, "offset": 39917 } + } + } + ], + "position": { + "start": { "line": 1383, "column": 1, "offset": 39898 }, + "end": { "line": 1383, "column": 20, "offset": 39917 } + } + } + ], + "position": { + "start": { "line": 1381, "column": 1, "offset": 39787 }, + "end": { "line": 1383, "column": 20, "offset": 39917 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Creates a new ", + "position": { + "start": { "line": 1385, "column": 1, "offset": 39919 }, + "end": { "line": 1385, "column": 15, "offset": 39933 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 1385, "column": 15, "offset": 39933 }, + "end": { "line": 1385, "column": 23, "offset": 39941 } + } + }, + { + "type": "text", + "value": " containing ", + "position": { + "start": { "line": 1385, "column": 23, "offset": 39941 }, + "end": { "line": 1385, "column": 35, "offset": 39953 } + } + }, + { + "type": "inlineCode", + "value": "string", + "position": { + "start": { "line": 1385, "column": 35, "offset": 39953 }, + "end": { "line": 1385, "column": 43, "offset": 39961 } + } + }, + { + "type": "text", + "value": ". The ", + "position": { + "start": { "line": 1385, "column": 43, "offset": 39961 }, + "end": { "line": 1385, "column": 49, "offset": 39967 } + } + }, + { + "type": "inlineCode", + "value": "encoding", + "position": { + "start": { "line": 1385, "column": 49, "offset": 39967 }, + "end": { "line": 1385, "column": 59, "offset": 39977 } + } + }, + { + "type": "text", + "value": " parameter identifies\nthe character encoding to be used when converting ", + "position": { + "start": { "line": 1385, "column": 59, "offset": 39977 }, + "end": { "line": 1386, "column": 51, "offset": 40049 } + } + }, + { + "type": "inlineCode", + "value": "string", + "position": { + "start": { "line": 1386, "column": 51, "offset": 40049 }, + "end": { "line": 1386, "column": 59, "offset": 40057 } + } + }, + { + "type": "text", + "value": " into bytes.", + "position": { + "start": { "line": 1386, "column": 59, "offset": 40057 }, + "end": { "line": 1386, "column": 71, "offset": 40069 } + } + } + ], + "position": { + "start": { "line": 1385, "column": 1, "offset": 39919 }, + "end": { "line": 1386, "column": 71, "offset": 40069 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf1 = Buffer.from('this is a tést');\nconst buf2 = Buffer.from('7468697320697320612074c3a97374', 'hex');\n\nconsole.log(buf1.toString());\n// Prints: this is a tést\nconsole.log(buf2.toString());\n// Prints: this is a tést\nconsole.log(buf1.toString('latin1'));\n// Prints: this is a tést", + "position": { + "start": { "line": 1388, "column": 1, "offset": 40071 }, + "end": { "line": 1400, "column": 4, "offset": 40409 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf1 = Buffer.from('this is a tést');\nconst buf2 = Buffer.from('7468697320697320612074c3a97374', 'hex');\n\nconsole.log(buf1.toString());\n// Prints: this is a tést\nconsole.log(buf2.toString());\n// Prints: this is a tést\nconsole.log(buf1.toString('latin1'));\n// Prints: this is a tést", + "position": { + "start": { "line": 1402, "column": 1, "offset": 40411 }, + "end": { "line": 1414, "column": 4, "offset": 40754 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "A ", + "position": { + "start": { "line": 1416, "column": 1, "offset": 40756 }, + "end": { "line": 1416, "column": 3, "offset": 40758 } + } + }, + { + "type": "inlineCode", + "value": "TypeError", + "position": { + "start": { "line": 1416, "column": 3, "offset": 40758 }, + "end": { "line": 1416, "column": 14, "offset": 40769 } + } + }, + { + "type": "text", + "value": " will be thrown if ", + "position": { + "start": { "line": 1416, "column": 14, "offset": 40769 }, + "end": { "line": 1416, "column": 33, "offset": 40788 } + } + }, + { + "type": "inlineCode", + "value": "string", + "position": { + "start": { "line": 1416, "column": 33, "offset": 40788 }, + "end": { "line": 1416, "column": 41, "offset": 40796 } + } + }, + { + "type": "text", + "value": " is not a string or another type\nappropriate for ", + "position": { + "start": { "line": 1416, "column": 41, "offset": 40796 }, + "end": { "line": 1417, "column": 17, "offset": 40845 } + } + }, + { + "type": "inlineCode", + "value": "Buffer.from()", + "position": { + "start": { "line": 1417, "column": 17, "offset": 40845 }, + "end": { "line": 1417, "column": 32, "offset": 40860 } + } + }, + { + "type": "text", + "value": " variants.", + "position": { + "start": { "line": 1417, "column": 32, "offset": 40860 }, + "end": { "line": 1417, "column": 42, "offset": 40870 } + } + } + ], + "position": { + "start": { "line": 1416, "column": 1, "offset": 40756 }, + "end": { "line": 1417, "column": 42, "offset": 40870 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "Buffer.from(string)", + "position": { + "start": { "line": 1419, "column": 2, "offset": 40873 }, + "end": { "line": 1419, "column": 23, "offset": 40894 } + } + } + ], + "position": { + "start": { "line": 1419, "column": 1, "offset": 40872 }, + "end": { "line": 1419, "column": 26, "offset": 40897 } + }, + "label": "`Buffer.from(string)`", + "identifier": "`buffer.from(string)`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": " may also use the internal ", + "position": { + "start": { "line": 1419, "column": 26, "offset": 40897 }, + "end": { "line": 1419, "column": 53, "offset": 40924 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 1419, "column": 53, "offset": 40924 }, + "end": { "line": 1419, "column": 61, "offset": 40932 } + } + }, + { + "type": "text", + "value": " pool like\n", + "position": { + "start": { "line": 1419, "column": 61, "offset": 40932 }, + "end": { "line": 1420, "column": 1, "offset": 40943 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "Buffer.allocUnsafe()", + "position": { + "start": { "line": 1420, "column": 2, "offset": 40944 }, + "end": { "line": 1420, "column": 24, "offset": 40966 } + } + } + ], + "position": { + "start": { "line": 1420, "column": 1, "offset": 40943 }, + "end": { "line": 1420, "column": 27, "offset": 40969 } + }, + "label": "`Buffer.allocUnsafe()`", + "identifier": "`buffer.allocunsafe()`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": " does.", + "position": { + "start": { "line": 1420, "column": 27, "offset": 40969 }, + "end": { "line": 1420, "column": 33, "offset": 40975 } + } + } + ], + "position": { + "start": { "line": 1419, "column": 1, "offset": 40872 }, + "end": { "line": 1420, "column": 33, "offset": 40975 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "text", + "value": "Static method: ", + "position": { + "start": { "line": 1422, "column": 5, "offset": 40981 }, + "end": { "line": 1422, "column": 20, "offset": 40996 } + } + }, + { + "type": "inlineCode", + "value": "Buffer.isBuffer(obj)", + "position": { + "start": { "line": 1422, "column": 20, "offset": 40996 }, + "end": { "line": 1422, "column": 42, "offset": 41018 } + } + } + ], + "position": { + "start": { "line": 1422, "column": 1, "offset": 40977 }, + "end": { "line": 1422, "column": 42, "offset": 41018 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 1424, "column": 1, "offset": 41020 }, + "end": { "line": 1426, "column": 4, "offset": 41049 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "obj", + "position": { + "start": { "line": 1428, "column": 3, "offset": 41053 }, + "end": { "line": 1428, "column": 8, "offset": 41058 } + } + }, + { + "type": "text", + "value": " {Object}", + "position": { + "start": { "line": 1428, "column": 8, "offset": 41058 }, + "end": { "line": 1428, "column": 17, "offset": 41067 } + } + } + ], + "position": { + "start": { "line": 1428, "column": 3, "offset": 41053 }, + "end": { "line": 1428, "column": 17, "offset": 41067 } + } + } + ], + "position": { + "start": { "line": 1428, "column": 1, "offset": 41051 }, + "end": { "line": 1428, "column": 17, "offset": 41067 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {boolean}", + "position": { + "start": { "line": 1429, "column": 3, "offset": 41070 }, + "end": { "line": 1429, "column": 21, "offset": 41088 } + } + } + ], + "position": { + "start": { "line": 1429, "column": 3, "offset": 41070 }, + "end": { "line": 1429, "column": 21, "offset": 41088 } + } + } + ], + "position": { + "start": { "line": 1429, "column": 1, "offset": 41068 }, + "end": { "line": 1429, "column": 21, "offset": 41088 } + } + } + ], + "position": { + "start": { "line": 1428, "column": 1, "offset": 41051 }, + "end": { "line": 1429, "column": 21, "offset": 41088 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns ", + "position": { + "start": { "line": 1431, "column": 1, "offset": 41090 }, + "end": { "line": 1431, "column": 9, "offset": 41098 } + } + }, + { + "type": "inlineCode", + "value": "true", + "position": { + "start": { "line": 1431, "column": 9, "offset": 41098 }, + "end": { "line": 1431, "column": 15, "offset": 41104 } + } + }, + { + "type": "text", + "value": " if ", + "position": { + "start": { "line": 1431, "column": 15, "offset": 41104 }, + "end": { "line": 1431, "column": 19, "offset": 41108 } + } + }, + { + "type": "inlineCode", + "value": "obj", + "position": { + "start": { "line": 1431, "column": 19, "offset": 41108 }, + "end": { "line": 1431, "column": 24, "offset": 41113 } + } + }, + { + "type": "text", + "value": " is a ", + "position": { + "start": { "line": 1431, "column": 24, "offset": 41113 }, + "end": { "line": 1431, "column": 30, "offset": 41119 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 1431, "column": 30, "offset": 41119 }, + "end": { "line": 1431, "column": 38, "offset": 41127 } + } + }, + { + "type": "text", + "value": ", ", + "position": { + "start": { "line": 1431, "column": 38, "offset": 41127 }, + "end": { "line": 1431, "column": 40, "offset": 41129 } + } + }, + { + "type": "inlineCode", + "value": "false", + "position": { + "start": { "line": 1431, "column": 40, "offset": 41129 }, + "end": { "line": 1431, "column": 47, "offset": 41136 } + } + }, + { + "type": "text", + "value": " otherwise.", + "position": { + "start": { "line": 1431, "column": 47, "offset": 41136 }, + "end": { "line": 1431, "column": 58, "offset": 41147 } + } + } + ], + "position": { + "start": { "line": 1431, "column": 1, "offset": 41090 }, + "end": { "line": 1431, "column": 58, "offset": 41147 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nBuffer.isBuffer(Buffer.alloc(10)); // true\nBuffer.isBuffer(Buffer.from('foo')); // true\nBuffer.isBuffer('a string'); // false\nBuffer.isBuffer([]); // false\nBuffer.isBuffer(new Uint8Array(1024)); // false", + "position": { + "start": { "line": 1433, "column": 1, "offset": 41149 }, + "end": { "line": 1441, "column": 4, "offset": 41402 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nBuffer.isBuffer(Buffer.alloc(10)); // true\nBuffer.isBuffer(Buffer.from('foo')); // true\nBuffer.isBuffer('a string'); // false\nBuffer.isBuffer([]); // false\nBuffer.isBuffer(new Uint8Array(1024)); // false", + "position": { + "start": { "line": 1443, "column": 1, "offset": 41404 }, + "end": { "line": 1451, "column": 4, "offset": 41662 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "text", + "value": "Static method: ", + "position": { + "start": { "line": 1453, "column": 5, "offset": 41668 }, + "end": { "line": 1453, "column": 20, "offset": 41683 } + } + }, + { + "type": "inlineCode", + "value": "Buffer.isEncoding(encoding)", + "position": { + "start": { "line": 1453, "column": 20, "offset": 41683 }, + "end": { "line": 1453, "column": 49, "offset": 41712 } + } + } + ], + "position": { + "start": { "line": 1453, "column": 1, "offset": 41664 }, + "end": { "line": 1453, "column": 49, "offset": 41712 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 1455, "column": 1, "offset": 41714 }, + "end": { "line": 1457, "column": 4, "offset": 41741 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "encoding", + "position": { + "start": { "line": 1459, "column": 3, "offset": 41745 }, + "end": { "line": 1459, "column": 13, "offset": 41755 } + } + }, + { + "type": "text", + "value": " {string} A character encoding name to check.", + "position": { + "start": { "line": 1459, "column": 13, "offset": 41755 }, + "end": { "line": 1459, "column": 58, "offset": 41800 } + } + } + ], + "position": { + "start": { "line": 1459, "column": 3, "offset": 41745 }, + "end": { "line": 1459, "column": 58, "offset": 41800 } + } + } + ], + "position": { + "start": { "line": 1459, "column": 1, "offset": 41743 }, + "end": { "line": 1459, "column": 58, "offset": 41800 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {boolean}", + "position": { + "start": { "line": 1460, "column": 3, "offset": 41803 }, + "end": { "line": 1460, "column": 21, "offset": 41821 } + } + } + ], + "position": { + "start": { "line": 1460, "column": 3, "offset": 41803 }, + "end": { "line": 1460, "column": 21, "offset": 41821 } + } + } + ], + "position": { + "start": { "line": 1460, "column": 1, "offset": 41801 }, + "end": { "line": 1460, "column": 21, "offset": 41821 } + } + } + ], + "position": { + "start": { "line": 1459, "column": 1, "offset": 41743 }, + "end": { "line": 1460, "column": 21, "offset": 41821 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns ", + "position": { + "start": { "line": 1462, "column": 1, "offset": 41823 }, + "end": { "line": 1462, "column": 9, "offset": 41831 } + } + }, + { + "type": "inlineCode", + "value": "true", + "position": { + "start": { "line": 1462, "column": 9, "offset": 41831 }, + "end": { "line": 1462, "column": 15, "offset": 41837 } + } + }, + { + "type": "text", + "value": " if ", + "position": { + "start": { "line": 1462, "column": 15, "offset": 41837 }, + "end": { "line": 1462, "column": 19, "offset": 41841 } + } + }, + { + "type": "inlineCode", + "value": "encoding", + "position": { + "start": { "line": 1462, "column": 19, "offset": 41841 }, + "end": { "line": 1462, "column": 29, "offset": 41851 } + } + }, + { + "type": "text", + "value": " is the name of a supported character encoding,\nor ", + "position": { + "start": { "line": 1462, "column": 29, "offset": 41851 }, + "end": { "line": 1463, "column": 4, "offset": 41902 } + } + }, + { + "type": "inlineCode", + "value": "false", + "position": { + "start": { "line": 1463, "column": 4, "offset": 41902 }, + "end": { "line": 1463, "column": 11, "offset": 41909 } + } + }, + { + "type": "text", + "value": " otherwise.", + "position": { + "start": { "line": 1463, "column": 11, "offset": 41909 }, + "end": { "line": 1463, "column": 22, "offset": 41920 } + } + } + ], + "position": { + "start": { "line": 1462, "column": 1, "offset": 41823 }, + "end": { "line": 1463, "column": 22, "offset": 41920 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconsole.log(Buffer.isEncoding('utf8'));\n// Prints: true\n\nconsole.log(Buffer.isEncoding('hex'));\n// Prints: true\n\nconsole.log(Buffer.isEncoding('utf/8'));\n// Prints: false\n\nconsole.log(Buffer.isEncoding(''));\n// Prints: false", + "position": { + "start": { "line": 1465, "column": 1, "offset": 41922 }, + "end": { "line": 1479, "column": 4, "offset": 42196 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconsole.log(Buffer.isEncoding('utf8'));\n// Prints: true\n\nconsole.log(Buffer.isEncoding('hex'));\n// Prints: true\n\nconsole.log(Buffer.isEncoding('utf/8'));\n// Prints: false\n\nconsole.log(Buffer.isEncoding(''));\n// Prints: false", + "position": { + "start": { "line": 1481, "column": 1, "offset": 42198 }, + "end": { "line": 1495, "column": 4, "offset": 42477 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "text", + "value": "Class property: ", + "position": { + "start": { "line": 1497, "column": 5, "offset": 42483 }, + "end": { "line": 1497, "column": 21, "offset": 42499 } + } + }, + { + "type": "inlineCode", + "value": "Buffer.poolSize", + "position": { + "start": { "line": 1497, "column": 21, "offset": 42499 }, + "end": { "line": 1497, "column": 38, "offset": 42516 } + } + } + ], + "position": { + "start": { "line": 1497, "column": 1, "offset": 42479 }, + "end": { "line": 1497, "column": 38, "offset": 42516 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 1499, "column": 1, "offset": 42518 }, + "end": { "line": 1501, "column": 4, "offset": 42546 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "{integer} ", + "position": { + "start": { "line": 1503, "column": 3, "offset": 42550 }, + "end": { "line": 1503, "column": 13, "offset": 42560 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { + "line": 1503, + "column": 15, + "offset": 42562 + }, + "end": { "line": 1503, "column": 23, "offset": 42570 } + } + } + ], + "position": { + "start": { "line": 1503, "column": 13, "offset": 42560 }, + "end": { "line": 1503, "column": 25, "offset": 42572 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 1503, "column": 25, "offset": 42572 }, + "end": { "line": 1503, "column": 26, "offset": 42573 } + } + }, + { + "type": "inlineCode", + "value": "8192", + "position": { + "start": { "line": 1503, "column": 26, "offset": 42573 }, + "end": { "line": 1503, "column": 32, "offset": 42579 } + } + } + ], + "position": { + "start": { "line": 1503, "column": 3, "offset": 42550 }, + "end": { "line": 1503, "column": 32, "offset": 42579 } + } + } + ], + "position": { + "start": { "line": 1503, "column": 1, "offset": 42548 }, + "end": { "line": 1503, "column": 32, "offset": 42579 } + } + } + ], + "position": { + "start": { "line": 1503, "column": 1, "offset": 42548 }, + "end": { "line": 1503, "column": 32, "offset": 42579 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "This is the size (in bytes) of pre-allocated internal ", + "position": { + "start": { "line": 1505, "column": 1, "offset": 42581 }, + "end": { "line": 1505, "column": 55, "offset": 42635 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 1505, "column": 55, "offset": 42635 }, + "end": { "line": 1505, "column": 63, "offset": 42643 } + } + }, + { + "type": "text", + "value": " instances used\nfor pooling. This value may be modified.", + "position": { + "start": { "line": 1505, "column": 63, "offset": 42643 }, + "end": { "line": 1506, "column": 41, "offset": 42699 } + } + } + ], + "position": { + "start": { "line": 1505, "column": 1, "offset": 42581 }, + "end": { "line": 1506, "column": 41, "offset": 42699 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf[index]", + "position": { + "start": { "line": 1508, "column": 5, "offset": 42705 }, + "end": { "line": 1508, "column": 17, "offset": 42717 } + } + } + ], + "position": { + "start": { "line": 1508, "column": 1, "offset": 42701 }, + "end": { "line": 1508, "column": 17, "offset": 42717 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "index", + "position": { + "start": { "line": 1510, "column": 3, "offset": 42721 }, + "end": { "line": 1510, "column": 10, "offset": 42728 } + } + }, + { + "type": "text", + "value": " {integer}", + "position": { + "start": { "line": 1510, "column": 10, "offset": 42728 }, + "end": { "line": 1510, "column": 20, "offset": 42738 } + } + } + ], + "position": { + "start": { "line": 1510, "column": 3, "offset": 42721 }, + "end": { "line": 1510, "column": 20, "offset": 42738 } + } + } + ], + "position": { + "start": { "line": 1510, "column": 1, "offset": 42719 }, + "end": { "line": 1510, "column": 20, "offset": 42738 } + } + } + ], + "position": { + "start": { "line": 1510, "column": 1, "offset": 42719 }, + "end": { "line": 1510, "column": 20, "offset": 42738 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "The index operator ", + "position": { + "start": { "line": 1512, "column": 1, "offset": 42740 }, + "end": { "line": 1512, "column": 20, "offset": 42759 } + } + }, + { + "type": "inlineCode", + "value": "[index]", + "position": { + "start": { "line": 1512, "column": 20, "offset": 42759 }, + "end": { "line": 1512, "column": 29, "offset": 42768 } + } + }, + { + "type": "text", + "value": " can be used to get and set the octet at position\n", + "position": { + "start": { "line": 1512, "column": 29, "offset": 42768 }, + "end": { "line": 1513, "column": 1, "offset": 42818 } + } + }, + { + "type": "inlineCode", + "value": "index", + "position": { + "start": { "line": 1513, "column": 1, "offset": 42818 }, + "end": { "line": 1513, "column": 8, "offset": 42825 } + } + }, + { + "type": "text", + "value": " in ", + "position": { + "start": { "line": 1513, "column": 8, "offset": 42825 }, + "end": { "line": 1513, "column": 12, "offset": 42829 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 1513, "column": 12, "offset": 42829 }, + "end": { "line": 1513, "column": 17, "offset": 42834 } + } + }, + { + "type": "text", + "value": ". The values refer to individual bytes, so the legal value\nrange is between ", + "position": { + "start": { "line": 1513, "column": 17, "offset": 42834 }, + "end": { "line": 1514, "column": 18, "offset": 42910 } + } + }, + { + "type": "inlineCode", + "value": "0x00", + "position": { + "start": { "line": 1514, "column": 18, "offset": 42910 }, + "end": { "line": 1514, "column": 24, "offset": 42916 } + } + }, + { + "type": "text", + "value": " and ", + "position": { + "start": { "line": 1514, "column": 24, "offset": 42916 }, + "end": { "line": 1514, "column": 29, "offset": 42921 } + } + }, + { + "type": "inlineCode", + "value": "0xFF", + "position": { + "start": { "line": 1514, "column": 29, "offset": 42921 }, + "end": { "line": 1514, "column": 35, "offset": 42927 } + } + }, + { + "type": "text", + "value": " (hex) or ", + "position": { + "start": { "line": 1514, "column": 35, "offset": 42927 }, + "end": { "line": 1514, "column": 45, "offset": 42937 } + } + }, + { + "type": "inlineCode", + "value": "0", + "position": { + "start": { "line": 1514, "column": 45, "offset": 42937 }, + "end": { "line": 1514, "column": 48, "offset": 42940 } + } + }, + { + "type": "text", + "value": " and ", + "position": { + "start": { "line": 1514, "column": 48, "offset": 42940 }, + "end": { "line": 1514, "column": 53, "offset": 42945 } + } + }, + { + "type": "inlineCode", + "value": "255", + "position": { + "start": { "line": 1514, "column": 53, "offset": 42945 }, + "end": { "line": 1514, "column": 58, "offset": 42950 } + } + }, + { + "type": "text", + "value": " (decimal).", + "position": { + "start": { "line": 1514, "column": 58, "offset": 42950 }, + "end": { "line": 1514, "column": 69, "offset": 42961 } + } + } + ], + "position": { + "start": { "line": 1512, "column": 1, "offset": 42740 }, + "end": { "line": 1514, "column": 69, "offset": 42961 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "This operator is inherited from ", + "position": { + "start": { "line": 1516, "column": 1, "offset": 42963 }, + "end": { "line": 1516, "column": 33, "offset": 42995 } + } + }, + { + "type": "inlineCode", + "value": "Uint8Array", + "position": { + "start": { "line": 1516, "column": 33, "offset": 42995 }, + "end": { "line": 1516, "column": 45, "offset": 43007 } + } + }, + { + "type": "text", + "value": ", so its behavior on out-of-bounds\naccess is the same as ", + "position": { + "start": { "line": 1516, "column": 45, "offset": 43007 }, + "end": { "line": 1517, "column": 23, "offset": 43064 } + } + }, + { + "type": "inlineCode", + "value": "Uint8Array", + "position": { + "start": { "line": 1517, "column": 23, "offset": 43064 }, + "end": { "line": 1517, "column": 35, "offset": 43076 } + } + }, + { + "type": "text", + "value": ". In other words, ", + "position": { + "start": { "line": 1517, "column": 35, "offset": 43076 }, + "end": { "line": 1517, "column": 53, "offset": 43094 } + } + }, + { + "type": "inlineCode", + "value": "buf[index]", + "position": { + "start": { "line": 1517, "column": 53, "offset": 43094 }, + "end": { "line": 1517, "column": 65, "offset": 43106 } + } + }, + { + "type": "text", + "value": " returns\n", + "position": { + "start": { "line": 1517, "column": 65, "offset": 43106 }, + "end": { "line": 1518, "column": 1, "offset": 43115 } + } + }, + { + "type": "inlineCode", + "value": "undefined", + "position": { + "start": { "line": 1518, "column": 1, "offset": 43115 }, + "end": { "line": 1518, "column": 12, "offset": 43126 } + } + }, + { + "type": "text", + "value": " when ", + "position": { + "start": { "line": 1518, "column": 12, "offset": 43126 }, + "end": { "line": 1518, "column": 18, "offset": 43132 } + } + }, + { + "type": "inlineCode", + "value": "index", + "position": { + "start": { "line": 1518, "column": 18, "offset": 43132 }, + "end": { "line": 1518, "column": 25, "offset": 43139 } + } + }, + { + "type": "text", + "value": " is negative or greater or equal to ", + "position": { + "start": { "line": 1518, "column": 25, "offset": 43139 }, + "end": { "line": 1518, "column": 61, "offset": 43175 } + } + }, + { + "type": "inlineCode", + "value": "buf.length", + "position": { + "start": { "line": 1518, "column": 61, "offset": 43175 }, + "end": { "line": 1518, "column": 73, "offset": 43187 } + } + }, + { + "type": "text", + "value": ", and\n", + "position": { + "start": { "line": 1518, "column": 73, "offset": 43187 }, + "end": { "line": 1519, "column": 1, "offset": 43193 } + } + }, + { + "type": "inlineCode", + "value": "buf[index] = value", + "position": { + "start": { "line": 1519, "column": 1, "offset": 43193 }, + "end": { "line": 1519, "column": 21, "offset": 43213 } + } + }, + { + "type": "text", + "value": " does not modify the buffer if ", + "position": { + "start": { "line": 1519, "column": 21, "offset": 43213 }, + "end": { "line": 1519, "column": 52, "offset": 43244 } + } + }, + { + "type": "inlineCode", + "value": "index", + "position": { + "start": { "line": 1519, "column": 52, "offset": 43244 }, + "end": { "line": 1519, "column": 59, "offset": 43251 } + } + }, + { + "type": "text", + "value": " is negative or\n", + "position": { + "start": { "line": 1519, "column": 59, "offset": 43251 }, + "end": { "line": 1520, "column": 1, "offset": 43267 } + } + }, + { + "type": "inlineCode", + "value": ">= buf.length", + "position": { + "start": { "line": 1520, "column": 1, "offset": 43267 }, + "end": { "line": 1520, "column": 16, "offset": 43282 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 1520, "column": 16, "offset": 43282 }, + "end": { "line": 1520, "column": 17, "offset": 43283 } + } + } + ], + "position": { + "start": { "line": 1516, "column": 1, "offset": 42963 }, + "end": { "line": 1520, "column": 17, "offset": 43283 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\n// Copy an ASCII string into a `Buffer` one byte at a time.\n// (This only works for ASCII-only strings. In general, one should use\n// `Buffer.from()` to perform this conversion.)\n\nconst str = 'Node.js';\nconst buf = Buffer.allocUnsafe(str.length);\n\nfor (let i = 0; i < str.length; i++) {\n buf[i] = str.charCodeAt(i);\n}\n\nconsole.log(buf.toString('utf8'));\n// Prints: Node.js", + "position": { + "start": { "line": 1522, "column": 1, "offset": 43285 }, + "end": { "line": 1538, "column": 4, "offset": 43708 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\n// Copy an ASCII string into a `Buffer` one byte at a time.\n// (This only works for ASCII-only strings. In general, one should use\n// `Buffer.from()` to perform this conversion.)\n\nconst str = 'Node.js';\nconst buf = Buffer.allocUnsafe(str.length);\n\nfor (let i = 0; i < str.length; i++) {\n buf[i] = str.charCodeAt(i);\n}\n\nconsole.log(buf.toString('utf8'));\n// Prints: Node.js", + "position": { + "start": { "line": 1540, "column": 1, "offset": 43710 }, + "end": { "line": 1556, "column": 4, "offset": 44138 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.buffer", + "position": { + "start": { "line": 1558, "column": 5, "offset": 44144 }, + "end": { "line": 1558, "column": 17, "offset": 44156 } + } + } + ], + "position": { + "start": { "line": 1558, "column": 1, "offset": 44140 }, + "end": { "line": 1558, "column": 17, "offset": 44156 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "{ArrayBuffer} The underlying ", + "position": { + "start": { "line": 1560, "column": 3, "offset": 44160 }, + "end": { "line": 1560, "column": 32, "offset": 44189 } + } + }, + { + "type": "inlineCode", + "value": "ArrayBuffer", + "position": { + "start": { "line": 1560, "column": 32, "offset": 44189 }, + "end": { "line": 1560, "column": 45, "offset": 44202 } + } + }, + { + "type": "text", + "value": " object based on which this ", + "position": { + "start": { "line": 1560, "column": 45, "offset": 44202 }, + "end": { "line": 1560, "column": 73, "offset": 44230 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 1560, "column": 73, "offset": 44230 }, + "end": { "line": 1560, "column": 81, "offset": 44238 } + } + }, + { + "type": "text", + "value": "\nobject is created.", + "position": { + "start": { "line": 1560, "column": 81, "offset": 44238 }, + "end": { "line": 1561, "column": 21, "offset": 44259 } + } + } + ], + "position": { + "start": { "line": 1560, "column": 3, "offset": 44160 }, + "end": { "line": 1561, "column": 21, "offset": 44259 } + } + } + ], + "position": { + "start": { "line": 1560, "column": 1, "offset": 44158 }, + "end": { "line": 1561, "column": 21, "offset": 44259 } + } + } + ], + "position": { + "start": { "line": 1560, "column": 1, "offset": 44158 }, + "end": { "line": 1561, "column": 21, "offset": 44259 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "This ", + "position": { + "start": { "line": 1563, "column": 1, "offset": 44261 }, + "end": { "line": 1563, "column": 6, "offset": 44266 } + } + }, + { + "type": "inlineCode", + "value": "ArrayBuffer", + "position": { + "start": { "line": 1563, "column": 6, "offset": 44266 }, + "end": { "line": 1563, "column": 19, "offset": 44279 } + } + }, + { + "type": "text", + "value": " is not guaranteed to correspond exactly to the original\n", + "position": { + "start": { "line": 1563, "column": 19, "offset": 44279 }, + "end": { "line": 1564, "column": 1, "offset": 44336 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 1564, "column": 1, "offset": 44336 }, + "end": { "line": 1564, "column": 9, "offset": 44344 } + } + }, + { + "type": "text", + "value": ". See the notes on ", + "position": { + "start": { "line": 1564, "column": 9, "offset": 44344 }, + "end": { "line": 1564, "column": 28, "offset": 44363 } + } + }, + { + "type": "inlineCode", + "value": "buf.byteOffset", + "position": { + "start": { "line": 1564, "column": 28, "offset": 44363 }, + "end": { "line": 1564, "column": 44, "offset": 44379 } + } + }, + { + "type": "text", + "value": " for details.", + "position": { + "start": { "line": 1564, "column": 44, "offset": 44379 }, + "end": { "line": 1564, "column": 57, "offset": 44392 } + } + } + ], + "position": { + "start": { "line": 1563, "column": 1, "offset": 44261 }, + "end": { "line": 1564, "column": 57, "offset": 44392 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst arrayBuffer = new ArrayBuffer(16);\nconst buffer = Buffer.from(arrayBuffer);\n\nconsole.log(buffer.buffer === arrayBuffer);\n// Prints: true", + "position": { + "start": { "line": 1566, "column": 1, "offset": 44394 }, + "end": { "line": 1574, "column": 4, "offset": 44586 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst arrayBuffer = new ArrayBuffer(16);\nconst buffer = Buffer.from(arrayBuffer);\n\nconsole.log(buffer.buffer === arrayBuffer);\n// Prints: true", + "position": { + "start": { "line": 1576, "column": 1, "offset": 44588 }, + "end": { "line": 1584, "column": 4, "offset": 44785 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.byteOffset", + "position": { + "start": { "line": 1586, "column": 5, "offset": 44791 }, + "end": { "line": 1586, "column": 21, "offset": 44807 } + } + } + ], + "position": { + "start": { "line": 1586, "column": 1, "offset": 44787 }, + "end": { "line": 1586, "column": 21, "offset": 44807 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "{integer} The ", + "position": { + "start": { "line": 1588, "column": 3, "offset": 44811 }, + "end": { "line": 1588, "column": 17, "offset": 44825 } + } + }, + { + "type": "inlineCode", + "value": "byteOffset", + "position": { + "start": { "line": 1588, "column": 17, "offset": 44825 }, + "end": { "line": 1588, "column": 29, "offset": 44837 } + } + }, + { + "type": "text", + "value": " of the ", + "position": { + "start": { "line": 1588, "column": 29, "offset": 44837 }, + "end": { "line": 1588, "column": 37, "offset": 44845 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 1588, "column": 37, "offset": 44845 }, + "end": { "line": 1588, "column": 45, "offset": 44853 } + } + }, + { + "type": "text", + "value": "'s underlying ", + "position": { + "start": { "line": 1588, "column": 45, "offset": 44853 }, + "end": { "line": 1588, "column": 59, "offset": 44867 } + } + }, + { + "type": "inlineCode", + "value": "ArrayBuffer", + "position": { + "start": { "line": 1588, "column": 59, "offset": 44867 }, + "end": { "line": 1588, "column": 72, "offset": 44880 } + } + }, + { + "type": "text", + "value": " object.", + "position": { + "start": { "line": 1588, "column": 72, "offset": 44880 }, + "end": { "line": 1588, "column": 80, "offset": 44888 } + } + } + ], + "position": { + "start": { "line": 1588, "column": 3, "offset": 44811 }, + "end": { "line": 1588, "column": 80, "offset": 44888 } + } + } + ], + "position": { + "start": { "line": 1588, "column": 1, "offset": 44809 }, + "end": { "line": 1588, "column": 80, "offset": 44888 } + } + } + ], + "position": { + "start": { "line": 1588, "column": 1, "offset": 44809 }, + "end": { "line": 1588, "column": 80, "offset": 44888 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "When setting ", + "position": { + "start": { "line": 1590, "column": 1, "offset": 44890 }, + "end": { "line": 1590, "column": 14, "offset": 44903 } + } + }, + { + "type": "inlineCode", + "value": "byteOffset", + "position": { + "start": { "line": 1590, "column": 14, "offset": 44903 }, + "end": { "line": 1590, "column": 26, "offset": 44915 } + } + }, + { + "type": "text", + "value": " in ", + "position": { + "start": { "line": 1590, "column": 26, "offset": 44915 }, + "end": { "line": 1590, "column": 30, "offset": 44919 } + } + }, + { + "type": "inlineCode", + "value": "Buffer.from(ArrayBuffer, byteOffset, length)", + "position": { + "start": { "line": 1590, "column": 30, "offset": 44919 }, + "end": { "line": 1590, "column": 76, "offset": 44965 } + } + }, + { + "type": "text", + "value": ",\nor sometimes when allocating a ", + "position": { + "start": { "line": 1590, "column": 76, "offset": 44965 }, + "end": { "line": 1591, "column": 32, "offset": 44998 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 1591, "column": 32, "offset": 44998 }, + "end": { "line": 1591, "column": 40, "offset": 45006 } + } + }, + { + "type": "text", + "value": " smaller than ", + "position": { + "start": { "line": 1591, "column": 40, "offset": 45006 }, + "end": { "line": 1591, "column": 54, "offset": 45020 } + } + }, + { + "type": "inlineCode", + "value": "Buffer.poolSize", + "position": { + "start": { "line": 1591, "column": 54, "offset": 45020 }, + "end": { "line": 1591, "column": 71, "offset": 45037 } + } + }, + { + "type": "text", + "value": ", the\nbuffer does not start from a zero offset on the underlying ", + "position": { + "start": { "line": 1591, "column": 71, "offset": 45037 }, + "end": { "line": 1592, "column": 60, "offset": 45102 } + } + }, + { + "type": "inlineCode", + "value": "ArrayBuffer", + "position": { + "start": { "line": 1592, "column": 60, "offset": 45102 }, + "end": { "line": 1592, "column": 73, "offset": 45115 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 1592, "column": 73, "offset": 45115 }, + "end": { "line": 1592, "column": 74, "offset": 45116 } + } + } + ], + "position": { + "start": { "line": 1590, "column": 1, "offset": 44890 }, + "end": { "line": 1592, "column": 74, "offset": 45116 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "This can cause problems when accessing the underlying ", + "position": { + "start": { "line": 1594, "column": 1, "offset": 45118 }, + "end": { "line": 1594, "column": 55, "offset": 45172 } + } + }, + { + "type": "inlineCode", + "value": "ArrayBuffer", + "position": { + "start": { "line": 1594, "column": 55, "offset": 45172 }, + "end": { "line": 1594, "column": 68, "offset": 45185 } + } + }, + { + "type": "text", + "value": " directly\nusing ", + "position": { + "start": { "line": 1594, "column": 68, "offset": 45185 }, + "end": { "line": 1595, "column": 7, "offset": 45201 } + } + }, + { + "type": "inlineCode", + "value": "buf.buffer", + "position": { + "start": { "line": 1595, "column": 7, "offset": 45201 }, + "end": { "line": 1595, "column": 19, "offset": 45213 } + } + }, + { + "type": "text", + "value": ", as other parts of the ", + "position": { + "start": { "line": 1595, "column": 19, "offset": 45213 }, + "end": { "line": 1595, "column": 43, "offset": 45237 } + } + }, + { + "type": "inlineCode", + "value": "ArrayBuffer", + "position": { + "start": { "line": 1595, "column": 43, "offset": 45237 }, + "end": { "line": 1595, "column": 56, "offset": 45250 } + } + }, + { + "type": "text", + "value": " may be unrelated\nto the ", + "position": { + "start": { "line": 1595, "column": 56, "offset": 45250 }, + "end": { "line": 1596, "column": 8, "offset": 45275 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 1596, "column": 8, "offset": 45275 }, + "end": { "line": 1596, "column": 16, "offset": 45283 } + } + }, + { + "type": "text", + "value": " object itself.", + "position": { + "start": { "line": 1596, "column": 16, "offset": 45283 }, + "end": { "line": 1596, "column": 31, "offset": 45298 } + } + } + ], + "position": { + "start": { "line": 1594, "column": 1, "offset": 45118 }, + "end": { "line": 1596, "column": 31, "offset": 45298 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "A common issue when creating a ", + "position": { + "start": { "line": 1598, "column": 1, "offset": 45300 }, + "end": { "line": 1598, "column": 32, "offset": 45331 } + } + }, + { + "type": "inlineCode", + "value": "TypedArray", + "position": { + "start": { "line": 1598, "column": 32, "offset": 45331 }, + "end": { "line": 1598, "column": 44, "offset": 45343 } + } + }, + { + "type": "text", + "value": " object that shares its memory with\na ", + "position": { + "start": { "line": 1598, "column": 44, "offset": 45343 }, + "end": { "line": 1599, "column": 3, "offset": 45381 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 1599, "column": 3, "offset": 45381 }, + "end": { "line": 1599, "column": 11, "offset": 45389 } + } + }, + { + "type": "text", + "value": " is that in this case one needs to specify the ", + "position": { + "start": { "line": 1599, "column": 11, "offset": 45389 }, + "end": { "line": 1599, "column": 58, "offset": 45436 } + } + }, + { + "type": "inlineCode", + "value": "byteOffset", + "position": { + "start": { "line": 1599, "column": 58, "offset": 45436 }, + "end": { "line": 1599, "column": 70, "offset": 45448 } + } + }, + { + "type": "text", + "value": " correctly:", + "position": { + "start": { "line": 1599, "column": 70, "offset": 45448 }, + "end": { "line": 1599, "column": 81, "offset": 45459 } + } + } + ], + "position": { + "start": { "line": 1598, "column": 1, "offset": 45300 }, + "end": { "line": 1599, "column": 81, "offset": 45459 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\n// Create a buffer smaller than `Buffer.poolSize`.\nconst nodeBuffer = Buffer.from([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);\n\n// When casting the Node.js Buffer to an Int8Array, use the byteOffset\n// to refer only to the part of `nodeBuffer.buffer` that contains the memory\n// for `nodeBuffer`.\nnew Int8Array(nodeBuffer.buffer, nodeBuffer.byteOffset, nodeBuffer.length);", + "position": { + "start": { "line": 1601, "column": 1, "offset": 45461 }, + "end": { "line": 1611, "column": 4, "offset": 45871 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\n// Create a buffer smaller than `Buffer.poolSize`.\nconst nodeBuffer = Buffer.from([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);\n\n// When casting the Node.js Buffer to an Int8Array, use the byteOffset\n// to refer only to the part of `nodeBuffer.buffer` that contains the memory\n// for `nodeBuffer`.\nnew Int8Array(nodeBuffer.buffer, nodeBuffer.byteOffset, nodeBuffer.length);", + "position": { + "start": { "line": 1613, "column": 1, "offset": 45873 }, + "end": { "line": 1623, "column": 4, "offset": 46288 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.compare(target[, targetStart[, targetEnd[, sourceStart[, sourceEnd]]]])", + "position": { + "start": { "line": 1625, "column": 5, "offset": 46294 }, + "end": { "line": 1625, "column": 82, "offset": 46371 } + } + } + ], + "position": { + "start": { "line": 1625, "column": 1, "offset": 46290 }, + "end": { "line": 1625, "column": 82, "offset": 46371 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 1627, "column": 1, "offset": 46373 }, + "end": { "line": 1636, "column": 4, "offset": 46707 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "target", + "position": { + "start": { "line": 1638, "column": 3, "offset": 46711 }, + "end": { "line": 1638, "column": 11, "offset": 46719 } + } + }, + { + "type": "text", + "value": " {Buffer|Uint8Array} A ", + "position": { + "start": { "line": 1638, "column": 11, "offset": 46719 }, + "end": { "line": 1638, "column": 34, "offset": 46742 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 1638, "column": 34, "offset": 46742 }, + "end": { "line": 1638, "column": 42, "offset": 46750 } + } + }, + { + "type": "text", + "value": " or {Uint8Array} with which to\ncompare ", + "position": { + "start": { "line": 1638, "column": 42, "offset": 46750 }, + "end": { "line": 1639, "column": 11, "offset": 46791 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 1639, "column": 11, "offset": 46791 }, + "end": { "line": 1639, "column": 16, "offset": 46796 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 1639, "column": 16, "offset": 46796 }, + "end": { "line": 1639, "column": 17, "offset": 46797 } + } + } + ], + "position": { + "start": { "line": 1638, "column": 3, "offset": 46711 }, + "end": { "line": 1639, "column": 17, "offset": 46797 } + } + } + ], + "position": { + "start": { "line": 1638, "column": 1, "offset": 46709 }, + "end": { "line": 1639, "column": 17, "offset": 46797 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "targetStart", + "position": { + "start": { "line": 1640, "column": 3, "offset": 46800 }, + "end": { "line": 1640, "column": 16, "offset": 46813 } + } + }, + { + "type": "text", + "value": " {integer} The offset within ", + "position": { + "start": { "line": 1640, "column": 16, "offset": 46813 }, + "end": { "line": 1640, "column": 45, "offset": 46842 } + } + }, + { + "type": "inlineCode", + "value": "target", + "position": { + "start": { "line": 1640, "column": 45, "offset": 46842 }, + "end": { "line": 1640, "column": 53, "offset": 46850 } + } + }, + { + "type": "text", + "value": " at which to begin\ncomparison. ", + "position": { + "start": { "line": 1640, "column": 53, "offset": 46850 }, + "end": { "line": 1641, "column": 15, "offset": 46883 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { + "line": 1641, + "column": 17, + "offset": 46885 + }, + "end": { "line": 1641, "column": 25, "offset": 46893 } + } + } + ], + "position": { + "start": { "line": 1641, "column": 15, "offset": 46883 }, + "end": { "line": 1641, "column": 27, "offset": 46895 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 1641, "column": 27, "offset": 46895 }, + "end": { "line": 1641, "column": 28, "offset": 46896 } + } + }, + { + "type": "inlineCode", + "value": "0", + "position": { + "start": { "line": 1641, "column": 28, "offset": 46896 }, + "end": { "line": 1641, "column": 31, "offset": 46899 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 1641, "column": 31, "offset": 46899 }, + "end": { "line": 1641, "column": 32, "offset": 46900 } + } + } + ], + "position": { + "start": { "line": 1640, "column": 3, "offset": 46800 }, + "end": { "line": 1641, "column": 32, "offset": 46900 } + } + } + ], + "position": { + "start": { "line": 1640, "column": 1, "offset": 46798 }, + "end": { "line": 1641, "column": 32, "offset": 46900 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "targetEnd", + "position": { + "start": { "line": 1642, "column": 3, "offset": 46903 }, + "end": { "line": 1642, "column": 14, "offset": 46914 } + } + }, + { + "type": "text", + "value": " {integer} The offset within ", + "position": { + "start": { "line": 1642, "column": 14, "offset": 46914 }, + "end": { "line": 1642, "column": 43, "offset": 46943 } + } + }, + { + "type": "inlineCode", + "value": "target", + "position": { + "start": { "line": 1642, "column": 43, "offset": 46943 }, + "end": { "line": 1642, "column": 51, "offset": 46951 } + } + }, + { + "type": "text", + "value": " at which to end comparison\n(not inclusive). ", + "position": { + "start": { "line": 1642, "column": 51, "offset": 46951 }, + "end": { "line": 1643, "column": 20, "offset": 46998 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { + "line": 1643, + "column": 22, + "offset": 47000 + }, + "end": { "line": 1643, "column": 30, "offset": 47008 } + } + } + ], + "position": { + "start": { "line": 1643, "column": 20, "offset": 46998 }, + "end": { "line": 1643, "column": 32, "offset": 47010 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 1643, "column": 32, "offset": 47010 }, + "end": { "line": 1643, "column": 33, "offset": 47011 } + } + }, + { + "type": "inlineCode", + "value": "target.length", + "position": { + "start": { "line": 1643, "column": 33, "offset": 47011 }, + "end": { "line": 1643, "column": 48, "offset": 47026 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 1643, "column": 48, "offset": 47026 }, + "end": { "line": 1643, "column": 49, "offset": 47027 } + } + } + ], + "position": { + "start": { "line": 1642, "column": 3, "offset": 46903 }, + "end": { "line": 1643, "column": 49, "offset": 47027 } + } + } + ], + "position": { + "start": { "line": 1642, "column": 1, "offset": 46901 }, + "end": { "line": 1643, "column": 49, "offset": 47027 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "sourceStart", + "position": { + "start": { "line": 1644, "column": 3, "offset": 47030 }, + "end": { "line": 1644, "column": 16, "offset": 47043 } + } + }, + { + "type": "text", + "value": " {integer} The offset within ", + "position": { + "start": { "line": 1644, "column": 16, "offset": 47043 }, + "end": { "line": 1644, "column": 45, "offset": 47072 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 1644, "column": 45, "offset": 47072 }, + "end": { "line": 1644, "column": 50, "offset": 47077 } + } + }, + { + "type": "text", + "value": " at which to begin comparison.\n", + "position": { + "start": { "line": 1644, "column": 50, "offset": 47077 }, + "end": { "line": 1645, "column": 1, "offset": 47108 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { "line": 1645, "column": 5, "offset": 47112 }, + "end": { "line": 1645, "column": 13, "offset": 47120 } + } + } + ], + "position": { + "start": { "line": 1645, "column": 3, "offset": 47110 }, + "end": { "line": 1645, "column": 15, "offset": 47122 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 1645, "column": 15, "offset": 47122 }, + "end": { "line": 1645, "column": 16, "offset": 47123 } + } + }, + { + "type": "inlineCode", + "value": "0", + "position": { + "start": { "line": 1645, "column": 16, "offset": 47123 }, + "end": { "line": 1645, "column": 19, "offset": 47126 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 1645, "column": 19, "offset": 47126 }, + "end": { "line": 1645, "column": 20, "offset": 47127 } + } + } + ], + "position": { + "start": { "line": 1644, "column": 3, "offset": 47030 }, + "end": { "line": 1645, "column": 20, "offset": 47127 } + } + } + ], + "position": { + "start": { "line": 1644, "column": 1, "offset": 47028 }, + "end": { "line": 1645, "column": 20, "offset": 47127 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "sourceEnd", + "position": { + "start": { "line": 1646, "column": 3, "offset": 47130 }, + "end": { "line": 1646, "column": 14, "offset": 47141 } + } + }, + { + "type": "text", + "value": " {integer} The offset within ", + "position": { + "start": { "line": 1646, "column": 14, "offset": 47141 }, + "end": { "line": 1646, "column": 43, "offset": 47170 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 1646, "column": 43, "offset": 47170 }, + "end": { "line": 1646, "column": 48, "offset": 47175 } + } + }, + { + "type": "text", + "value": " at which to end comparison\n(not inclusive). ", + "position": { + "start": { "line": 1646, "column": 48, "offset": 47175 }, + "end": { "line": 1647, "column": 20, "offset": 47222 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { + "line": 1647, + "column": 22, + "offset": 47224 + }, + "end": { "line": 1647, "column": 30, "offset": 47232 } + } + } + ], + "position": { + "start": { "line": 1647, "column": 20, "offset": 47222 }, + "end": { "line": 1647, "column": 32, "offset": 47234 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 1647, "column": 32, "offset": 47234 }, + "end": { "line": 1647, "column": 33, "offset": 47235 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "buf.length", + "position": { + "start": { + "line": 1647, + "column": 34, + "offset": 47236 + }, + "end": { "line": 1647, "column": 46, "offset": 47248 } + } + } + ], + "position": { + "start": { "line": 1647, "column": 33, "offset": 47235 }, + "end": { "line": 1647, "column": 49, "offset": 47251 } + }, + "label": "`buf.length`", + "identifier": "`buf.length`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 1647, "column": 49, "offset": 47251 }, + "end": { "line": 1647, "column": 50, "offset": 47252 } + } + } + ], + "position": { + "start": { "line": 1646, "column": 3, "offset": 47130 }, + "end": { "line": 1647, "column": 50, "offset": 47252 } + } + } + ], + "position": { + "start": { "line": 1646, "column": 1, "offset": 47128 }, + "end": { "line": 1647, "column": 50, "offset": 47252 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {integer}", + "position": { + "start": { "line": 1648, "column": 3, "offset": 47255 }, + "end": { "line": 1648, "column": 21, "offset": 47273 } + } + } + ], + "position": { + "start": { "line": 1648, "column": 3, "offset": 47255 }, + "end": { "line": 1648, "column": 21, "offset": 47273 } + } + } + ], + "position": { + "start": { "line": 1648, "column": 1, "offset": 47253 }, + "end": { "line": 1648, "column": 21, "offset": 47273 } + } + } + ], + "position": { + "start": { "line": 1638, "column": 1, "offset": 46709 }, + "end": { "line": 1648, "column": 21, "offset": 47273 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Compares ", + "position": { + "start": { "line": 1650, "column": 1, "offset": 47275 }, + "end": { "line": 1650, "column": 10, "offset": 47284 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 1650, "column": 10, "offset": 47284 }, + "end": { "line": 1650, "column": 15, "offset": 47289 } + } + }, + { + "type": "text", + "value": " with ", + "position": { + "start": { "line": 1650, "column": 15, "offset": 47289 }, + "end": { "line": 1650, "column": 21, "offset": 47295 } + } + }, + { + "type": "inlineCode", + "value": "target", + "position": { + "start": { "line": 1650, "column": 21, "offset": 47295 }, + "end": { "line": 1650, "column": 29, "offset": 47303 } + } + }, + { + "type": "text", + "value": " and returns a number indicating whether ", + "position": { + "start": { "line": 1650, "column": 29, "offset": 47303 }, + "end": { "line": 1650, "column": 70, "offset": 47344 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 1650, "column": 70, "offset": 47344 }, + "end": { "line": 1650, "column": 75, "offset": 47349 } + } + }, + { + "type": "text", + "value": "\ncomes before, after, or is the same as ", + "position": { + "start": { "line": 1650, "column": 75, "offset": 47349 }, + "end": { "line": 1651, "column": 40, "offset": 47389 } + } + }, + { + "type": "inlineCode", + "value": "target", + "position": { + "start": { "line": 1651, "column": 40, "offset": 47389 }, + "end": { "line": 1651, "column": 48, "offset": 47397 } + } + }, + { + "type": "text", + "value": " in sort order.\nComparison is based on the actual sequence of bytes in each ", + "position": { + "start": { "line": 1651, "column": 48, "offset": 47397 }, + "end": { "line": 1652, "column": 61, "offset": 47473 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 1652, "column": 61, "offset": 47473 }, + "end": { "line": 1652, "column": 69, "offset": 47481 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 1652, "column": 69, "offset": 47481 }, + "end": { "line": 1652, "column": 70, "offset": 47482 } + } + } + ], + "position": { + "start": { "line": 1650, "column": 1, "offset": 47275 }, + "end": { "line": 1652, "column": 70, "offset": 47482 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "0", + "position": { + "start": { "line": 1654, "column": 3, "offset": 47486 }, + "end": { "line": 1654, "column": 6, "offset": 47489 } + } + }, + { + "type": "text", + "value": " is returned if ", + "position": { + "start": { "line": 1654, "column": 6, "offset": 47489 }, + "end": { "line": 1654, "column": 22, "offset": 47505 } + } + }, + { + "type": "inlineCode", + "value": "target", + "position": { + "start": { "line": 1654, "column": 22, "offset": 47505 }, + "end": { "line": 1654, "column": 30, "offset": 47513 } + } + }, + { + "type": "text", + "value": " is the same as ", + "position": { + "start": { "line": 1654, "column": 30, "offset": 47513 }, + "end": { "line": 1654, "column": 46, "offset": 47529 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 1654, "column": 46, "offset": 47529 }, + "end": { "line": 1654, "column": 51, "offset": 47534 } + } + } + ], + "position": { + "start": { "line": 1654, "column": 3, "offset": 47486 }, + "end": { "line": 1654, "column": 51, "offset": 47534 } + } + } + ], + "position": { + "start": { "line": 1654, "column": 1, "offset": 47484 }, + "end": { "line": 1654, "column": 51, "offset": 47534 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "1", + "position": { + "start": { "line": 1655, "column": 3, "offset": 47537 }, + "end": { "line": 1655, "column": 6, "offset": 47540 } + } + }, + { + "type": "text", + "value": " is returned if ", + "position": { + "start": { "line": 1655, "column": 6, "offset": 47540 }, + "end": { "line": 1655, "column": 22, "offset": 47556 } + } + }, + { + "type": "inlineCode", + "value": "target", + "position": { + "start": { "line": 1655, "column": 22, "offset": 47556 }, + "end": { "line": 1655, "column": 30, "offset": 47564 } + } + }, + { + "type": "text", + "value": " should come ", + "position": { + "start": { "line": 1655, "column": 30, "offset": 47564 }, + "end": { "line": 1655, "column": 43, "offset": 47577 } + } + }, + { + "type": "emphasis", + "children": [ + { + "type": "text", + "value": "before", + "position": { + "start": { + "line": 1655, + "column": 44, + "offset": 47578 + }, + "end": { "line": 1655, "column": 50, "offset": 47584 } + } + } + ], + "position": { + "start": { "line": 1655, "column": 43, "offset": 47577 }, + "end": { "line": 1655, "column": 51, "offset": 47585 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 1655, "column": 51, "offset": 47585 }, + "end": { "line": 1655, "column": 52, "offset": 47586 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 1655, "column": 52, "offset": 47586 }, + "end": { "line": 1655, "column": 57, "offset": 47591 } + } + }, + { + "type": "text", + "value": " when sorted.", + "position": { + "start": { "line": 1655, "column": 57, "offset": 47591 }, + "end": { "line": 1655, "column": 70, "offset": 47604 } + } + } + ], + "position": { + "start": { "line": 1655, "column": 3, "offset": 47537 }, + "end": { "line": 1655, "column": 70, "offset": 47604 } + } + } + ], + "position": { + "start": { "line": 1655, "column": 1, "offset": 47535 }, + "end": { "line": 1655, "column": 70, "offset": 47604 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "-1", + "position": { + "start": { "line": 1656, "column": 3, "offset": 47607 }, + "end": { "line": 1656, "column": 7, "offset": 47611 } + } + }, + { + "type": "text", + "value": " is returned if ", + "position": { + "start": { "line": 1656, "column": 7, "offset": 47611 }, + "end": { "line": 1656, "column": 23, "offset": 47627 } + } + }, + { + "type": "inlineCode", + "value": "target", + "position": { + "start": { "line": 1656, "column": 23, "offset": 47627 }, + "end": { "line": 1656, "column": 31, "offset": 47635 } + } + }, + { + "type": "text", + "value": " should come ", + "position": { + "start": { "line": 1656, "column": 31, "offset": 47635 }, + "end": { "line": 1656, "column": 44, "offset": 47648 } + } + }, + { + "type": "emphasis", + "children": [ + { + "type": "text", + "value": "after", + "position": { + "start": { + "line": 1656, + "column": 45, + "offset": 47649 + }, + "end": { "line": 1656, "column": 50, "offset": 47654 } + } + } + ], + "position": { + "start": { "line": 1656, "column": 44, "offset": 47648 }, + "end": { "line": 1656, "column": 51, "offset": 47655 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 1656, "column": 51, "offset": 47655 }, + "end": { "line": 1656, "column": 52, "offset": 47656 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 1656, "column": 52, "offset": 47656 }, + "end": { "line": 1656, "column": 57, "offset": 47661 } + } + }, + { + "type": "text", + "value": " when sorted.", + "position": { + "start": { "line": 1656, "column": 57, "offset": 47661 }, + "end": { "line": 1656, "column": 70, "offset": 47674 } + } + } + ], + "position": { + "start": { "line": 1656, "column": 3, "offset": 47607 }, + "end": { "line": 1656, "column": 70, "offset": 47674 } + } + } + ], + "position": { + "start": { "line": 1656, "column": 1, "offset": 47605 }, + "end": { "line": 1656, "column": 70, "offset": 47674 } + } + } + ], + "position": { + "start": { "line": 1654, "column": 1, "offset": 47484 }, + "end": { "line": 1656, "column": 70, "offset": 47674 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf1 = Buffer.from('ABC');\nconst buf2 = Buffer.from('BCD');\nconst buf3 = Buffer.from('ABCD');\n\nconsole.log(buf1.compare(buf1));\n// Prints: 0\nconsole.log(buf1.compare(buf2));\n// Prints: -1\nconsole.log(buf1.compare(buf3));\n// Prints: -1\nconsole.log(buf2.compare(buf1));\n// Prints: 1\nconsole.log(buf2.compare(buf3));\n// Prints: 1\nconsole.log([buf1, buf2, buf3].sort(Buffer.compare));\n// Prints: [ , , ]\n// (This result is equal to: [buf1, buf3, buf2].)", + "position": { + "start": { "line": 1658, "column": 1, "offset": 47676 }, + "end": { "line": 1678, "column": 4, "offset": 48236 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf1 = Buffer.from('ABC');\nconst buf2 = Buffer.from('BCD');\nconst buf3 = Buffer.from('ABCD');\n\nconsole.log(buf1.compare(buf1));\n// Prints: 0\nconsole.log(buf1.compare(buf2));\n// Prints: -1\nconsole.log(buf1.compare(buf3));\n// Prints: -1\nconsole.log(buf2.compare(buf1));\n// Prints: 1\nconsole.log(buf2.compare(buf3));\n// Prints: 1\nconsole.log([buf1, buf2, buf3].sort(Buffer.compare));\n// Prints: [ , , ]\n// (This result is equal to: [buf1, buf3, buf2].)", + "position": { + "start": { "line": 1680, "column": 1, "offset": 48238 }, + "end": { "line": 1700, "column": 4, "offset": 48803 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "The optional ", + "position": { + "start": { "line": 1702, "column": 1, "offset": 48805 }, + "end": { "line": 1702, "column": 14, "offset": 48818 } + } + }, + { + "type": "inlineCode", + "value": "targetStart", + "position": { + "start": { "line": 1702, "column": 14, "offset": 48818 }, + "end": { "line": 1702, "column": 27, "offset": 48831 } + } + }, + { + "type": "text", + "value": ", ", + "position": { + "start": { "line": 1702, "column": 27, "offset": 48831 }, + "end": { "line": 1702, "column": 29, "offset": 48833 } + } + }, + { + "type": "inlineCode", + "value": "targetEnd", + "position": { + "start": { "line": 1702, "column": 29, "offset": 48833 }, + "end": { "line": 1702, "column": 40, "offset": 48844 } + } + }, + { + "type": "text", + "value": ", ", + "position": { + "start": { "line": 1702, "column": 40, "offset": 48844 }, + "end": { "line": 1702, "column": 42, "offset": 48846 } + } + }, + { + "type": "inlineCode", + "value": "sourceStart", + "position": { + "start": { "line": 1702, "column": 42, "offset": 48846 }, + "end": { "line": 1702, "column": 55, "offset": 48859 } + } + }, + { + "type": "text", + "value": ", and ", + "position": { + "start": { "line": 1702, "column": 55, "offset": 48859 }, + "end": { "line": 1702, "column": 61, "offset": 48865 } + } + }, + { + "type": "inlineCode", + "value": "sourceEnd", + "position": { + "start": { "line": 1702, "column": 61, "offset": 48865 }, + "end": { "line": 1702, "column": 72, "offset": 48876 } + } + }, + { + "type": "text", + "value": "\narguments can be used to limit the comparison to specific ranges within ", + "position": { + "start": { "line": 1702, "column": 72, "offset": 48876 }, + "end": { "line": 1703, "column": 73, "offset": 48949 } + } + }, + { + "type": "inlineCode", + "value": "target", + "position": { + "start": { "line": 1703, "column": 73, "offset": 48949 }, + "end": { "line": 1703, "column": 81, "offset": 48957 } + } + }, + { + "type": "text", + "value": "\nand ", + "position": { + "start": { "line": 1703, "column": 81, "offset": 48957 }, + "end": { "line": 1704, "column": 5, "offset": 48962 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 1704, "column": 5, "offset": 48962 }, + "end": { "line": 1704, "column": 10, "offset": 48967 } + } + }, + { + "type": "text", + "value": " respectively.", + "position": { + "start": { "line": 1704, "column": 10, "offset": 48967 }, + "end": { "line": 1704, "column": 24, "offset": 48981 } + } + } + ], + "position": { + "start": { "line": 1702, "column": 1, "offset": 48805 }, + "end": { "line": 1704, "column": 24, "offset": 48981 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf1 = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8, 9]);\nconst buf2 = Buffer.from([5, 6, 7, 8, 9, 1, 2, 3, 4]);\n\nconsole.log(buf1.compare(buf2, 5, 9, 0, 4));\n// Prints: 0\nconsole.log(buf1.compare(buf2, 0, 6, 4));\n// Prints: -1\nconsole.log(buf1.compare(buf2, 5, 6, 5));\n// Prints: 1", + "position": { + "start": { "line": 1706, "column": 1, "offset": 48983 }, + "end": { "line": 1718, "column": 4, "offset": 49312 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf1 = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8, 9]);\nconst buf2 = Buffer.from([5, 6, 7, 8, 9, 1, 2, 3, 4]);\n\nconsole.log(buf1.compare(buf2, 5, 9, 0, 4));\n// Prints: 0\nconsole.log(buf1.compare(buf2, 0, 6, 4));\n// Prints: -1\nconsole.log(buf1.compare(buf2, 5, 6, 5));\n// Prints: 1", + "position": { + "start": { "line": 1720, "column": 1, "offset": 49314 }, + "end": { "line": 1732, "column": 4, "offset": 49648 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "ERR_OUT_OF_RANGE", + "position": { + "start": { "line": 1734, "column": 2, "offset": 49651 }, + "end": { "line": 1734, "column": 20, "offset": 49669 } + } + } + ], + "position": { + "start": { "line": 1734, "column": 1, "offset": 49650 }, + "end": { "line": 1734, "column": 23, "offset": 49672 } + }, + "label": "`ERR_OUT_OF_RANGE`", + "identifier": "`err_out_of_range`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": " is thrown if ", + "position": { + "start": { "line": 1734, "column": 23, "offset": 49672 }, + "end": { "line": 1734, "column": 37, "offset": 49686 } + } + }, + { + "type": "inlineCode", + "value": "targetStart < 0", + "position": { + "start": { "line": 1734, "column": 37, "offset": 49686 }, + "end": { "line": 1734, "column": 54, "offset": 49703 } + } + }, + { + "type": "text", + "value": ", ", + "position": { + "start": { "line": 1734, "column": 54, "offset": 49703 }, + "end": { "line": 1734, "column": 56, "offset": 49705 } + } + }, + { + "type": "inlineCode", + "value": "sourceStart < 0", + "position": { + "start": { "line": 1734, "column": 56, "offset": 49705 }, + "end": { "line": 1734, "column": 73, "offset": 49722 } + } + }, + { + "type": "text", + "value": ",\n", + "position": { + "start": { "line": 1734, "column": 73, "offset": 49722 }, + "end": { "line": 1735, "column": 1, "offset": 49724 } + } + }, + { + "type": "inlineCode", + "value": "targetEnd > target.byteLength", + "position": { + "start": { "line": 1735, "column": 1, "offset": 49724 }, + "end": { "line": 1735, "column": 32, "offset": 49755 } + } + }, + { + "type": "text", + "value": ", or ", + "position": { + "start": { "line": 1735, "column": 32, "offset": 49755 }, + "end": { "line": 1735, "column": 37, "offset": 49760 } + } + }, + { + "type": "inlineCode", + "value": "sourceEnd > source.byteLength", + "position": { + "start": { "line": 1735, "column": 37, "offset": 49760 }, + "end": { "line": 1735, "column": 68, "offset": 49791 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 1735, "column": 68, "offset": 49791 }, + "end": { "line": 1735, "column": 69, "offset": 49792 } + } + } + ], + "position": { + "start": { "line": 1734, "column": 1, "offset": 49650 }, + "end": { "line": 1735, "column": 69, "offset": 49792 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.copy(target[, targetStart[, sourceStart[, sourceEnd]]])", + "position": { + "start": { "line": 1737, "column": 5, "offset": 49798 }, + "end": { "line": 1737, "column": 66, "offset": 49859 } + } + } + ], + "position": { + "start": { "line": 1737, "column": 1, "offset": 49794 }, + "end": { "line": 1737, "column": 66, "offset": 49859 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 1739, "column": 1, "offset": 49861 }, + "end": { "line": 1741, "column": 4, "offset": 49889 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "target", + "position": { + "start": { "line": 1743, "column": 3, "offset": 49893 }, + "end": { "line": 1743, "column": 11, "offset": 49901 } + } + }, + { + "type": "text", + "value": " {Buffer|Uint8Array} A ", + "position": { + "start": { "line": 1743, "column": 11, "offset": 49901 }, + "end": { "line": 1743, "column": 34, "offset": 49924 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 1743, "column": 34, "offset": 49924 }, + "end": { "line": 1743, "column": 42, "offset": 49932 } + } + }, + { + "type": "text", + "value": " or {Uint8Array} to copy into.", + "position": { + "start": { "line": 1743, "column": 42, "offset": 49932 }, + "end": { "line": 1743, "column": 72, "offset": 49962 } + } + } + ], + "position": { + "start": { "line": 1743, "column": 3, "offset": 49893 }, + "end": { "line": 1743, "column": 72, "offset": 49962 } + } + } + ], + "position": { + "start": { "line": 1743, "column": 1, "offset": 49891 }, + "end": { "line": 1743, "column": 72, "offset": 49962 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "targetStart", + "position": { + "start": { "line": 1744, "column": 3, "offset": 49965 }, + "end": { "line": 1744, "column": 16, "offset": 49978 } + } + }, + { + "type": "text", + "value": " {integer} The offset within ", + "position": { + "start": { "line": 1744, "column": 16, "offset": 49978 }, + "end": { "line": 1744, "column": 45, "offset": 50007 } + } + }, + { + "type": "inlineCode", + "value": "target", + "position": { + "start": { "line": 1744, "column": 45, "offset": 50007 }, + "end": { "line": 1744, "column": 53, "offset": 50015 } + } + }, + { + "type": "text", + "value": " at which to begin\nwriting. ", + "position": { + "start": { "line": 1744, "column": 53, "offset": 50015 }, + "end": { "line": 1745, "column": 12, "offset": 50045 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { + "line": 1745, + "column": 14, + "offset": 50047 + }, + "end": { "line": 1745, "column": 22, "offset": 50055 } + } + } + ], + "position": { + "start": { "line": 1745, "column": 12, "offset": 50045 }, + "end": { "line": 1745, "column": 24, "offset": 50057 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 1745, "column": 24, "offset": 50057 }, + "end": { "line": 1745, "column": 25, "offset": 50058 } + } + }, + { + "type": "inlineCode", + "value": "0", + "position": { + "start": { "line": 1745, "column": 25, "offset": 50058 }, + "end": { "line": 1745, "column": 28, "offset": 50061 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 1745, "column": 28, "offset": 50061 }, + "end": { "line": 1745, "column": 29, "offset": 50062 } + } + } + ], + "position": { + "start": { "line": 1744, "column": 3, "offset": 49965 }, + "end": { "line": 1745, "column": 29, "offset": 50062 } + } + } + ], + "position": { + "start": { "line": 1744, "column": 1, "offset": 49963 }, + "end": { "line": 1745, "column": 29, "offset": 50062 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "sourceStart", + "position": { + "start": { "line": 1746, "column": 3, "offset": 50065 }, + "end": { "line": 1746, "column": 16, "offset": 50078 } + } + }, + { + "type": "text", + "value": " {integer} The offset within ", + "position": { + "start": { "line": 1746, "column": 16, "offset": 50078 }, + "end": { "line": 1746, "column": 45, "offset": 50107 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 1746, "column": 45, "offset": 50107 }, + "end": { "line": 1746, "column": 50, "offset": 50112 } + } + }, + { + "type": "text", + "value": " from which to begin copying.\n", + "position": { + "start": { "line": 1746, "column": 50, "offset": 50112 }, + "end": { "line": 1747, "column": 1, "offset": 50142 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { "line": 1747, "column": 5, "offset": 50146 }, + "end": { "line": 1747, "column": 13, "offset": 50154 } + } + } + ], + "position": { + "start": { "line": 1747, "column": 3, "offset": 50144 }, + "end": { "line": 1747, "column": 15, "offset": 50156 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 1747, "column": 15, "offset": 50156 }, + "end": { "line": 1747, "column": 16, "offset": 50157 } + } + }, + { + "type": "inlineCode", + "value": "0", + "position": { + "start": { "line": 1747, "column": 16, "offset": 50157 }, + "end": { "line": 1747, "column": 19, "offset": 50160 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 1747, "column": 19, "offset": 50160 }, + "end": { "line": 1747, "column": 20, "offset": 50161 } + } + } + ], + "position": { + "start": { "line": 1746, "column": 3, "offset": 50065 }, + "end": { "line": 1747, "column": 20, "offset": 50161 } + } + } + ], + "position": { + "start": { "line": 1746, "column": 1, "offset": 50063 }, + "end": { "line": 1747, "column": 20, "offset": 50161 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "sourceEnd", + "position": { + "start": { "line": 1748, "column": 3, "offset": 50164 }, + "end": { "line": 1748, "column": 14, "offset": 50175 } + } + }, + { + "type": "text", + "value": " {integer} The offset within ", + "position": { + "start": { "line": 1748, "column": 14, "offset": 50175 }, + "end": { "line": 1748, "column": 43, "offset": 50204 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 1748, "column": 43, "offset": 50204 }, + "end": { "line": 1748, "column": 48, "offset": 50209 } + } + }, + { + "type": "text", + "value": " at which to stop copying (not\ninclusive). ", + "position": { + "start": { "line": 1748, "column": 48, "offset": 50209 }, + "end": { "line": 1749, "column": 15, "offset": 50254 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { + "line": 1749, + "column": 17, + "offset": 50256 + }, + "end": { "line": 1749, "column": 25, "offset": 50264 } + } + } + ], + "position": { + "start": { "line": 1749, "column": 15, "offset": 50254 }, + "end": { "line": 1749, "column": 27, "offset": 50266 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 1749, "column": 27, "offset": 50266 }, + "end": { "line": 1749, "column": 28, "offset": 50267 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "buf.length", + "position": { + "start": { + "line": 1749, + "column": 29, + "offset": 50268 + }, + "end": { "line": 1749, "column": 41, "offset": 50280 } + } + } + ], + "position": { + "start": { "line": 1749, "column": 28, "offset": 50267 }, + "end": { "line": 1749, "column": 44, "offset": 50283 } + }, + "label": "`buf.length`", + "identifier": "`buf.length`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 1749, "column": 44, "offset": 50283 }, + "end": { "line": 1749, "column": 45, "offset": 50284 } + } + } + ], + "position": { + "start": { "line": 1748, "column": 3, "offset": 50164 }, + "end": { "line": 1749, "column": 45, "offset": 50284 } + } + } + ], + "position": { + "start": { "line": 1748, "column": 1, "offset": 50162 }, + "end": { "line": 1749, "column": 45, "offset": 50284 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {integer} The number of bytes copied.", + "position": { + "start": { "line": 1750, "column": 3, "offset": 50287 }, + "end": { "line": 1750, "column": 49, "offset": 50333 } + } + } + ], + "position": { + "start": { "line": 1750, "column": 3, "offset": 50287 }, + "end": { "line": 1750, "column": 49, "offset": 50333 } + } + } + ], + "position": { + "start": { "line": 1750, "column": 1, "offset": 50285 }, + "end": { "line": 1750, "column": 49, "offset": 50333 } + } + } + ], + "position": { + "start": { "line": 1743, "column": 1, "offset": 49891 }, + "end": { "line": 1750, "column": 49, "offset": 50333 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Copies data from a region of ", + "position": { + "start": { "line": 1752, "column": 1, "offset": 50335 }, + "end": { "line": 1752, "column": 30, "offset": 50364 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 1752, "column": 30, "offset": 50364 }, + "end": { "line": 1752, "column": 35, "offset": 50369 } + } + }, + { + "type": "text", + "value": " to a region in ", + "position": { + "start": { "line": 1752, "column": 35, "offset": 50369 }, + "end": { "line": 1752, "column": 51, "offset": 50385 } + } + }, + { + "type": "inlineCode", + "value": "target", + "position": { + "start": { "line": 1752, "column": 51, "offset": 50385 }, + "end": { "line": 1752, "column": 59, "offset": 50393 } + } + }, + { + "type": "text", + "value": ", even if the ", + "position": { + "start": { "line": 1752, "column": 59, "offset": 50393 }, + "end": { "line": 1752, "column": 73, "offset": 50407 } + } + }, + { + "type": "inlineCode", + "value": "target", + "position": { + "start": { "line": 1752, "column": 73, "offset": 50407 }, + "end": { "line": 1752, "column": 81, "offset": 50415 } + } + }, + { + "type": "text", + "value": "\nmemory region overlaps with ", + "position": { + "start": { "line": 1752, "column": 81, "offset": 50415 }, + "end": { "line": 1753, "column": 29, "offset": 50444 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 1753, "column": 29, "offset": 50444 }, + "end": { "line": 1753, "column": 34, "offset": 50449 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 1753, "column": 34, "offset": 50449 }, + "end": { "line": 1753, "column": 35, "offset": 50450 } + } + } + ], + "position": { + "start": { "line": 1752, "column": 1, "offset": 50335 }, + "end": { "line": 1753, "column": 35, "offset": 50450 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "TypedArray.prototype.set()", + "position": { + "start": { "line": 1755, "column": 2, "offset": 50453 }, + "end": { "line": 1755, "column": 30, "offset": 50481 } + } + } + ], + "position": { + "start": { "line": 1755, "column": 1, "offset": 50452 }, + "end": { "line": 1755, "column": 33, "offset": 50484 } + }, + "label": "`TypedArray.prototype.set()`", + "identifier": "`typedarray.prototype.set()`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": " performs the same operation, and is available\nfor all TypedArrays, including Node.js ", + "position": { + "start": { "line": 1755, "column": 33, "offset": 50484 }, + "end": { "line": 1756, "column": 40, "offset": 50570 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 1756, "column": 40, "offset": 50570 }, + "end": { "line": 1756, "column": 48, "offset": 50578 } + } + }, + { + "type": "text", + "value": "s, although it takes\ndifferent function arguments.", + "position": { + "start": { "line": 1756, "column": 48, "offset": 50578 }, + "end": { "line": 1757, "column": 30, "offset": 50628 } + } + } + ], + "position": { + "start": { "line": 1755, "column": 1, "offset": 50452 }, + "end": { "line": 1757, "column": 30, "offset": 50628 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\n// Create two `Buffer` instances.\nconst buf1 = Buffer.allocUnsafe(26);\nconst buf2 = Buffer.allocUnsafe(26).fill('!');\n\nfor (let i = 0; i < 26; i++) {\n // 97 is the decimal ASCII value for 'a'.\n buf1[i] = i + 97;\n}\n\n// Copy `buf1` bytes 16 through 19 into `buf2` starting at byte 8 of `buf2`.\nbuf1.copy(buf2, 8, 16, 20);\n// This is equivalent to:\n// buf2.set(buf1.subarray(16, 20), 8);\n\nconsole.log(buf2.toString('ascii', 0, 25));\n// Prints: !!!!!!!!qrst!!!!!!!!!!!!!", + "position": { + "start": { "line": 1759, "column": 1, "offset": 50630 }, + "end": { "line": 1778, "column": 4, "offset": 51148 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\n// Create two `Buffer` instances.\nconst buf1 = Buffer.allocUnsafe(26);\nconst buf2 = Buffer.allocUnsafe(26).fill('!');\n\nfor (let i = 0; i < 26; i++) {\n // 97 is the decimal ASCII value for 'a'.\n buf1[i] = i + 97;\n}\n\n// Copy `buf1` bytes 16 through 19 into `buf2` starting at byte 8 of `buf2`.\nbuf1.copy(buf2, 8, 16, 20);\n// This is equivalent to:\n// buf2.set(buf1.subarray(16, 20), 8);\n\nconsole.log(buf2.toString('ascii', 0, 25));\n// Prints: !!!!!!!!qrst!!!!!!!!!!!!!", + "position": { + "start": { "line": 1780, "column": 1, "offset": 51150 }, + "end": { "line": 1799, "column": 4, "offset": 51673 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\n// Create a `Buffer` and copy data from one region to an overlapping region\n// within the same `Buffer`.\n\nconst buf = Buffer.allocUnsafe(26);\n\nfor (let i = 0; i < 26; i++) {\n // 97 is the decimal ASCII value for 'a'.\n buf[i] = i + 97;\n}\n\nbuf.copy(buf, 0, 4, 10);\n\nconsole.log(buf.toString());\n// Prints: efghijghijklmnopqrstuvwxyz", + "position": { + "start": { "line": 1801, "column": 1, "offset": 51675 }, + "end": { "line": 1818, "column": 4, "offset": 52057 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\n// Create a `Buffer` and copy data from one region to an overlapping region\n// within the same `Buffer`.\n\nconst buf = Buffer.allocUnsafe(26);\n\nfor (let i = 0; i < 26; i++) {\n // 97 is the decimal ASCII value for 'a'.\n buf[i] = i + 97;\n}\n\nbuf.copy(buf, 0, 4, 10);\n\nconsole.log(buf.toString());\n// Prints: efghijghijklmnopqrstuvwxyz", + "position": { + "start": { "line": 1820, "column": 1, "offset": 52059 }, + "end": { "line": 1837, "column": 4, "offset": 52446 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.entries()", + "position": { + "start": { "line": 1839, "column": 5, "offset": 52452 }, + "end": { "line": 1839, "column": 20, "offset": 52467 } + } + } + ], + "position": { + "start": { "line": 1839, "column": 1, "offset": 52448 }, + "end": { "line": 1839, "column": 20, "offset": 52467 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 1841, "column": 1, "offset": 52469 }, + "end": { "line": 1843, "column": 4, "offset": 52496 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {Iterator}", + "position": { + "start": { "line": 1845, "column": 3, "offset": 52500 }, + "end": { "line": 1845, "column": 22, "offset": 52519 } + } + } + ], + "position": { + "start": { "line": 1845, "column": 3, "offset": 52500 }, + "end": { "line": 1845, "column": 22, "offset": 52519 } + } + } + ], + "position": { + "start": { "line": 1845, "column": 1, "offset": 52498 }, + "end": { "line": 1845, "column": 22, "offset": 52519 } + } + } + ], + "position": { + "start": { "line": 1845, "column": 1, "offset": 52498 }, + "end": { "line": 1845, "column": 22, "offset": 52519 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Creates and returns an ", + "position": { + "start": { "line": 1847, "column": 1, "offset": 52521 }, + "end": { "line": 1847, "column": 24, "offset": 52544 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "text", + "value": "iterator", + "position": { + "start": { "line": 1847, "column": 25, "offset": 52545 }, + "end": { "line": 1847, "column": 33, "offset": 52553 } + } + } + ], + "position": { + "start": { "line": 1847, "column": 24, "offset": 52544 }, + "end": { "line": 1847, "column": 36, "offset": 52556 } + }, + "label": "iterator", + "identifier": "iterator", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": " of ", + "position": { + "start": { "line": 1847, "column": 36, "offset": 52556 }, + "end": { "line": 1847, "column": 40, "offset": 52560 } + } + }, + { + "type": "inlineCode", + "value": "[index, byte]", + "position": { + "start": { "line": 1847, "column": 40, "offset": 52560 }, + "end": { "line": 1847, "column": 55, "offset": 52575 } + } + }, + { + "type": "text", + "value": " pairs from the contents\nof ", + "position": { + "start": { "line": 1847, "column": 55, "offset": 52575 }, + "end": { "line": 1848, "column": 4, "offset": 52603 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 1848, "column": 4, "offset": 52603 }, + "end": { "line": 1848, "column": 9, "offset": 52608 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 1848, "column": 9, "offset": 52608 }, + "end": { "line": 1848, "column": 10, "offset": 52609 } + } + } + ], + "position": { + "start": { "line": 1847, "column": 1, "offset": 52521 }, + "end": { "line": 1848, "column": 10, "offset": 52609 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\n// Log the entire contents of a `Buffer`.\n\nconst buf = Buffer.from('buffer');\n\nfor (const pair of buf.entries()) {\n console.log(pair);\n}\n// Prints:\n// [0, 98]\n// [1, 117]\n// [2, 102]\n// [3, 102]\n// [4, 101]\n// [5, 114]", + "position": { + "start": { "line": 1850, "column": 1, "offset": 52611 }, + "end": { "line": 1867, "column": 4, "offset": 52892 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\n// Log the entire contents of a `Buffer`.\n\nconst buf = Buffer.from('buffer');\n\nfor (const pair of buf.entries()) {\n console.log(pair);\n}\n// Prints:\n// [0, 98]\n// [1, 117]\n// [2, 102]\n// [3, 102]\n// [4, 101]\n// [5, 114]", + "position": { + "start": { "line": 1869, "column": 1, "offset": 52894 }, + "end": { "line": 1886, "column": 4, "offset": 53180 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.equals(otherBuffer)", + "position": { + "start": { "line": 1888, "column": 5, "offset": 53186 }, + "end": { "line": 1888, "column": 30, "offset": 53211 } + } + } + ], + "position": { + "start": { "line": 1888, "column": 1, "offset": 53182 }, + "end": { "line": 1888, "column": 30, "offset": 53211 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 1890, "column": 1, "offset": 53213 }, + "end": { "line": 1896, "column": 4, "offset": 53382 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "otherBuffer", + "position": { + "start": { "line": 1898, "column": 3, "offset": 53386 }, + "end": { "line": 1898, "column": 16, "offset": 53399 } + } + }, + { + "type": "text", + "value": " {Buffer|Uint8Array} A ", + "position": { + "start": { "line": 1898, "column": 16, "offset": 53399 }, + "end": { "line": 1898, "column": 39, "offset": 53422 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 1898, "column": 39, "offset": 53422 }, + "end": { "line": 1898, "column": 47, "offset": 53430 } + } + }, + { + "type": "text", + "value": " or {Uint8Array} with which to\ncompare ", + "position": { + "start": { "line": 1898, "column": 47, "offset": 53430 }, + "end": { "line": 1899, "column": 11, "offset": 53471 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 1899, "column": 11, "offset": 53471 }, + "end": { "line": 1899, "column": 16, "offset": 53476 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 1899, "column": 16, "offset": 53476 }, + "end": { "line": 1899, "column": 17, "offset": 53477 } + } + } + ], + "position": { + "start": { "line": 1898, "column": 3, "offset": 53386 }, + "end": { "line": 1899, "column": 17, "offset": 53477 } + } + } + ], + "position": { + "start": { "line": 1898, "column": 1, "offset": 53384 }, + "end": { "line": 1899, "column": 17, "offset": 53477 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {boolean}", + "position": { + "start": { "line": 1900, "column": 3, "offset": 53480 }, + "end": { "line": 1900, "column": 21, "offset": 53498 } + } + } + ], + "position": { + "start": { "line": 1900, "column": 3, "offset": 53480 }, + "end": { "line": 1900, "column": 21, "offset": 53498 } + } + } + ], + "position": { + "start": { "line": 1900, "column": 1, "offset": 53478 }, + "end": { "line": 1900, "column": 21, "offset": 53498 } + } + } + ], + "position": { + "start": { "line": 1898, "column": 1, "offset": 53384 }, + "end": { "line": 1900, "column": 21, "offset": 53498 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns ", + "position": { + "start": { "line": 1902, "column": 1, "offset": 53500 }, + "end": { "line": 1902, "column": 9, "offset": 53508 } + } + }, + { + "type": "inlineCode", + "value": "true", + "position": { + "start": { "line": 1902, "column": 9, "offset": 53508 }, + "end": { "line": 1902, "column": 15, "offset": 53514 } + } + }, + { + "type": "text", + "value": " if both ", + "position": { + "start": { "line": 1902, "column": 15, "offset": 53514 }, + "end": { "line": 1902, "column": 24, "offset": 53523 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 1902, "column": 24, "offset": 53523 }, + "end": { "line": 1902, "column": 29, "offset": 53528 } + } + }, + { + "type": "text", + "value": " and ", + "position": { + "start": { "line": 1902, "column": 29, "offset": 53528 }, + "end": { "line": 1902, "column": 34, "offset": 53533 } + } + }, + { + "type": "inlineCode", + "value": "otherBuffer", + "position": { + "start": { "line": 1902, "column": 34, "offset": 53533 }, + "end": { "line": 1902, "column": 47, "offset": 53546 } + } + }, + { + "type": "text", + "value": " have exactly the same bytes,\n", + "position": { + "start": { "line": 1902, "column": 47, "offset": 53546 }, + "end": { "line": 1903, "column": 1, "offset": 53576 } + } + }, + { + "type": "inlineCode", + "value": "false", + "position": { + "start": { "line": 1903, "column": 1, "offset": 53576 }, + "end": { "line": 1903, "column": 8, "offset": 53583 } + } + }, + { + "type": "text", + "value": " otherwise. Equivalent to\n", + "position": { + "start": { "line": 1903, "column": 8, "offset": 53583 }, + "end": { "line": 1904, "column": 1, "offset": 53609 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "buf.compare(otherBuffer) === 0", + "position": { + "start": { "line": 1904, "column": 2, "offset": 53610 }, + "end": { "line": 1904, "column": 34, "offset": 53642 } + } + } + ], + "position": { + "start": { "line": 1904, "column": 1, "offset": 53609 }, + "end": { "line": 1904, "column": 52, "offset": 53660 } + }, + "label": "`buf.compare()`", + "identifier": "`buf.compare()`", + "referenceType": "full" + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 1904, "column": 52, "offset": 53660 }, + "end": { "line": 1904, "column": 53, "offset": 53661 } + } + } + ], + "position": { + "start": { "line": 1902, "column": 1, "offset": 53500 }, + "end": { "line": 1904, "column": 53, "offset": 53661 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf1 = Buffer.from('ABC');\nconst buf2 = Buffer.from('414243', 'hex');\nconst buf3 = Buffer.from('ABCD');\n\nconsole.log(buf1.equals(buf2));\n// Prints: true\nconsole.log(buf1.equals(buf3));\n// Prints: false", + "position": { + "start": { "line": 1906, "column": 1, "offset": 53663 }, + "end": { "line": 1917, "column": 4, "offset": 53920 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf1 = Buffer.from('ABC');\nconst buf2 = Buffer.from('414243', 'hex');\nconst buf3 = Buffer.from('ABCD');\n\nconsole.log(buf1.equals(buf2));\n// Prints: true\nconsole.log(buf1.equals(buf3));\n// Prints: false", + "position": { + "start": { "line": 1919, "column": 1, "offset": 53922 }, + "end": { "line": 1930, "column": 4, "offset": 54184 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.fill(value[, offset[, end]][, encoding])", + "position": { + "start": { "line": 1932, "column": 5, "offset": 54190 }, + "end": { "line": 1932, "column": 51, "offset": 54236 } + } + } + ], + "position": { + "start": { "line": 1932, "column": 1, "offset": 54186 }, + "end": { "line": 1932, "column": 51, "offset": 54236 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 1934, "column": 1, "offset": 54238 }, + "end": { "line": 1954, "column": 4, "offset": 55104 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 1956, "column": 3, "offset": 55108 }, + "end": { "line": 1956, "column": 10, "offset": 55115 } + } + }, + { + "type": "text", + "value": " {string|Buffer|Uint8Array|integer} The value with which to fill ", + "position": { + "start": { "line": 1956, "column": 10, "offset": 55115 }, + "end": { "line": 1956, "column": 75, "offset": 55180 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 1956, "column": 75, "offset": 55180 }, + "end": { "line": 1956, "column": 80, "offset": 55185 } + } + }, + { + "type": "text", + "value": ".\nEmpty value (string, Uint8Array, Buffer) is coerced to ", + "position": { + "start": { "line": 1956, "column": 80, "offset": 55185 }, + "end": { "line": 1957, "column": 58, "offset": 55244 } + } + }, + { + "type": "inlineCode", + "value": "0", + "position": { + "start": { "line": 1957, "column": 58, "offset": 55244 }, + "end": { "line": 1957, "column": 61, "offset": 55247 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 1957, "column": 61, "offset": 55247 }, + "end": { "line": 1957, "column": 62, "offset": 55248 } + } + } + ], + "position": { + "start": { "line": 1956, "column": 3, "offset": 55108 }, + "end": { "line": 1957, "column": 62, "offset": 55248 } + } + } + ], + "position": { + "start": { "line": 1956, "column": 1, "offset": 55106 }, + "end": { "line": 1957, "column": 62, "offset": 55248 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 1958, "column": 3, "offset": 55251 }, + "end": { "line": 1958, "column": 11, "offset": 55259 } + } + }, + { + "type": "text", + "value": " {integer} Number of bytes to skip before starting to fill ", + "position": { + "start": { "line": 1958, "column": 11, "offset": 55259 }, + "end": { "line": 1958, "column": 70, "offset": 55318 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 1958, "column": 70, "offset": 55318 }, + "end": { "line": 1958, "column": 75, "offset": 55323 } + } + }, + { + "type": "text", + "value": ".\n", + "position": { + "start": { "line": 1958, "column": 75, "offset": 55323 }, + "end": { "line": 1959, "column": 1, "offset": 55325 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { "line": 1959, "column": 5, "offset": 55329 }, + "end": { "line": 1959, "column": 13, "offset": 55337 } + } + } + ], + "position": { + "start": { "line": 1959, "column": 3, "offset": 55327 }, + "end": { "line": 1959, "column": 15, "offset": 55339 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 1959, "column": 15, "offset": 55339 }, + "end": { "line": 1959, "column": 16, "offset": 55340 } + } + }, + { + "type": "inlineCode", + "value": "0", + "position": { + "start": { "line": 1959, "column": 16, "offset": 55340 }, + "end": { "line": 1959, "column": 19, "offset": 55343 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 1959, "column": 19, "offset": 55343 }, + "end": { "line": 1959, "column": 20, "offset": 55344 } + } + } + ], + "position": { + "start": { "line": 1958, "column": 3, "offset": 55251 }, + "end": { "line": 1959, "column": 20, "offset": 55344 } + } + } + ], + "position": { + "start": { "line": 1958, "column": 1, "offset": 55249 }, + "end": { "line": 1959, "column": 20, "offset": 55344 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "end", + "position": { + "start": { "line": 1960, "column": 3, "offset": 55347 }, + "end": { "line": 1960, "column": 8, "offset": 55352 } + } + }, + { + "type": "text", + "value": " {integer} Where to stop filling ", + "position": { + "start": { "line": 1960, "column": 8, "offset": 55352 }, + "end": { "line": 1960, "column": 41, "offset": 55385 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 1960, "column": 41, "offset": 55385 }, + "end": { "line": 1960, "column": 46, "offset": 55390 } + } + }, + { + "type": "text", + "value": " (not inclusive). ", + "position": { + "start": { "line": 1960, "column": 46, "offset": 55390 }, + "end": { "line": 1960, "column": 64, "offset": 55408 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { + "line": 1960, + "column": 66, + "offset": 55410 + }, + "end": { "line": 1960, "column": 74, "offset": 55418 } + } + } + ], + "position": { + "start": { "line": 1960, "column": 64, "offset": 55408 }, + "end": { "line": 1960, "column": 76, "offset": 55420 } + } + }, + { + "type": "text", + "value": "\n", + "position": { + "start": { "line": 1960, "column": 76, "offset": 55420 }, + "end": { "line": 1961, "column": 1, "offset": 55421 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "buf.length", + "position": { + "start": { "line": 1961, "column": 4, "offset": 55424 }, + "end": { "line": 1961, "column": 16, "offset": 55436 } + } + } + ], + "position": { + "start": { "line": 1961, "column": 3, "offset": 55423 }, + "end": { "line": 1961, "column": 19, "offset": 55439 } + }, + "label": "`buf.length`", + "identifier": "`buf.length`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 1961, "column": 19, "offset": 55439 }, + "end": { "line": 1961, "column": 20, "offset": 55440 } + } + } + ], + "position": { + "start": { "line": 1960, "column": 3, "offset": 55347 }, + "end": { "line": 1961, "column": 20, "offset": 55440 } + } + } + ], + "position": { + "start": { "line": 1960, "column": 1, "offset": 55345 }, + "end": { "line": 1961, "column": 20, "offset": 55440 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "encoding", + "position": { + "start": { "line": 1962, "column": 3, "offset": 55443 }, + "end": { "line": 1962, "column": 13, "offset": 55453 } + } + }, + { + "type": "text", + "value": " {string} The encoding for ", + "position": { + "start": { "line": 1962, "column": 13, "offset": 55453 }, + "end": { "line": 1962, "column": 40, "offset": 55480 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 1962, "column": 40, "offset": 55480 }, + "end": { "line": 1962, "column": 47, "offset": 55487 } + } + }, + { + "type": "text", + "value": " if ", + "position": { + "start": { "line": 1962, "column": 47, "offset": 55487 }, + "end": { "line": 1962, "column": 51, "offset": 55491 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 1962, "column": 51, "offset": 55491 }, + "end": { "line": 1962, "column": 58, "offset": 55498 } + } + }, + { + "type": "text", + "value": " is a string.\n", + "position": { + "start": { "line": 1962, "column": 58, "offset": 55498 }, + "end": { "line": 1963, "column": 1, "offset": 55512 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { "line": 1963, "column": 5, "offset": 55516 }, + "end": { "line": 1963, "column": 13, "offset": 55524 } + } + } + ], + "position": { + "start": { "line": 1963, "column": 3, "offset": 55514 }, + "end": { "line": 1963, "column": 15, "offset": 55526 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 1963, "column": 15, "offset": 55526 }, + "end": { "line": 1963, "column": 16, "offset": 55527 } + } + }, + { + "type": "inlineCode", + "value": "'utf8'", + "position": { + "start": { "line": 1963, "column": 16, "offset": 55527 }, + "end": { "line": 1963, "column": 24, "offset": 55535 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 1963, "column": 24, "offset": 55535 }, + "end": { "line": 1963, "column": 25, "offset": 55536 } + } + } + ], + "position": { + "start": { "line": 1962, "column": 3, "offset": 55443 }, + "end": { "line": 1963, "column": 25, "offset": 55536 } + } + } + ], + "position": { + "start": { "line": 1962, "column": 1, "offset": 55441 }, + "end": { "line": 1963, "column": 25, "offset": 55536 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {Buffer} A reference to ", + "position": { + "start": { "line": 1964, "column": 3, "offset": 55539 }, + "end": { "line": 1964, "column": 36, "offset": 55572 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 1964, "column": 36, "offset": 55572 }, + "end": { "line": 1964, "column": 41, "offset": 55577 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 1964, "column": 41, "offset": 55577 }, + "end": { "line": 1964, "column": 42, "offset": 55578 } + } + } + ], + "position": { + "start": { "line": 1964, "column": 3, "offset": 55539 }, + "end": { "line": 1964, "column": 42, "offset": 55578 } + } + } + ], + "position": { + "start": { "line": 1964, "column": 1, "offset": 55537 }, + "end": { "line": 1964, "column": 42, "offset": 55578 } + } + } + ], + "position": { + "start": { "line": 1956, "column": 1, "offset": 55106 }, + "end": { "line": 1964, "column": 42, "offset": 55578 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Fills ", + "position": { + "start": { "line": 1966, "column": 1, "offset": 55580 }, + "end": { "line": 1966, "column": 7, "offset": 55586 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 1966, "column": 7, "offset": 55586 }, + "end": { "line": 1966, "column": 12, "offset": 55591 } + } + }, + { + "type": "text", + "value": " with the specified ", + "position": { + "start": { "line": 1966, "column": 12, "offset": 55591 }, + "end": { "line": 1966, "column": 32, "offset": 55611 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 1966, "column": 32, "offset": 55611 }, + "end": { "line": 1966, "column": 39, "offset": 55618 } + } + }, + { + "type": "text", + "value": ". If the ", + "position": { + "start": { "line": 1966, "column": 39, "offset": 55618 }, + "end": { "line": 1966, "column": 48, "offset": 55627 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 1966, "column": 48, "offset": 55627 }, + "end": { "line": 1966, "column": 56, "offset": 55635 } + } + }, + { + "type": "text", + "value": " and ", + "position": { + "start": { "line": 1966, "column": 56, "offset": 55635 }, + "end": { "line": 1966, "column": 61, "offset": 55640 } + } + }, + { + "type": "inlineCode", + "value": "end", + "position": { + "start": { "line": 1966, "column": 61, "offset": 55640 }, + "end": { "line": 1966, "column": 66, "offset": 55645 } + } + }, + { + "type": "text", + "value": " are not given,\nthe entire ", + "position": { + "start": { "line": 1966, "column": 66, "offset": 55645 }, + "end": { "line": 1967, "column": 12, "offset": 55672 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 1967, "column": 12, "offset": 55672 }, + "end": { "line": 1967, "column": 17, "offset": 55677 } + } + }, + { + "type": "text", + "value": " will be filled:", + "position": { + "start": { "line": 1967, "column": 17, "offset": 55677 }, + "end": { "line": 1967, "column": 33, "offset": 55693 } + } + } + ], + "position": { + "start": { "line": 1966, "column": 1, "offset": 55580 }, + "end": { "line": 1967, "column": 33, "offset": 55693 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\n// Fill a `Buffer` with the ASCII character 'h'.\n\nconst b = Buffer.allocUnsafe(50).fill('h');\n\nconsole.log(b.toString());\n// Prints: hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh\n\n// Fill a buffer with empty string\nconst c = Buffer.allocUnsafe(5).fill('');\n\nconsole.log(c.fill(''));\n// Prints: ", + "position": { + "start": { "line": 1969, "column": 1, "offset": 55695 }, + "end": { "line": 1984, "column": 4, "offset": 56067 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\n// Fill a `Buffer` with the ASCII character 'h'.\n\nconst b = Buffer.allocUnsafe(50).fill('h');\n\nconsole.log(b.toString());\n// Prints: hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh\n\n// Fill a buffer with empty string\nconst c = Buffer.allocUnsafe(5).fill('');\n\nconsole.log(c.fill(''));\n// Prints: ", + "position": { + "start": { "line": 1986, "column": 1, "offset": 56069 }, + "end": { "line": 2001, "column": 4, "offset": 56446 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 2003, "column": 1, "offset": 56448 }, + "end": { "line": 2003, "column": 8, "offset": 56455 } + } + }, + { + "type": "text", + "value": " is coerced to a ", + "position": { + "start": { "line": 2003, "column": 8, "offset": 56455 }, + "end": { "line": 2003, "column": 25, "offset": 56472 } + } + }, + { + "type": "inlineCode", + "value": "uint32", + "position": { + "start": { "line": 2003, "column": 25, "offset": 56472 }, + "end": { "line": 2003, "column": 33, "offset": 56480 } + } + }, + { + "type": "text", + "value": " value if it is not a string, ", + "position": { + "start": { "line": 2003, "column": 33, "offset": 56480 }, + "end": { "line": 2003, "column": 63, "offset": 56510 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 2003, "column": 63, "offset": 56510 }, + "end": { "line": 2003, "column": 71, "offset": 56518 } + } + }, + { + "type": "text", + "value": ", or\ninteger. If the resulting integer is greater than ", + "position": { + "start": { "line": 2003, "column": 71, "offset": 56518 }, + "end": { "line": 2004, "column": 51, "offset": 56573 } + } + }, + { + "type": "inlineCode", + "value": "255", + "position": { + "start": { "line": 2004, "column": 51, "offset": 56573 }, + "end": { "line": 2004, "column": 56, "offset": 56578 } + } + }, + { + "type": "text", + "value": " (decimal), ", + "position": { + "start": { "line": 2004, "column": 56, "offset": 56578 }, + "end": { "line": 2004, "column": 68, "offset": 56590 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 2004, "column": 68, "offset": 56590 }, + "end": { "line": 2004, "column": 73, "offset": 56595 } + } + }, + { + "type": "text", + "value": " will be\nfilled with ", + "position": { + "start": { "line": 2004, "column": 73, "offset": 56595 }, + "end": { "line": 2005, "column": 13, "offset": 56616 } + } + }, + { + "type": "inlineCode", + "value": "value & 255", + "position": { + "start": { "line": 2005, "column": 13, "offset": 56616 }, + "end": { "line": 2005, "column": 26, "offset": 56629 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 2005, "column": 26, "offset": 56629 }, + "end": { "line": 2005, "column": 27, "offset": 56630 } + } + } + ], + "position": { + "start": { "line": 2003, "column": 1, "offset": 56448 }, + "end": { "line": 2005, "column": 27, "offset": 56630 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "If the final write of a ", + "position": { + "start": { "line": 2007, "column": 1, "offset": 56632 }, + "end": { "line": 2007, "column": 25, "offset": 56656 } + } + }, + { + "type": "inlineCode", + "value": "fill()", + "position": { + "start": { "line": 2007, "column": 25, "offset": 56656 }, + "end": { "line": 2007, "column": 33, "offset": 56664 } + } + }, + { + "type": "text", + "value": " operation falls on a multi-byte character,\nthen only the bytes of that character that fit into ", + "position": { + "start": { "line": 2007, "column": 33, "offset": 56664 }, + "end": { "line": 2008, "column": 53, "offset": 56760 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 2008, "column": 53, "offset": 56760 }, + "end": { "line": 2008, "column": 58, "offset": 56765 } + } + }, + { + "type": "text", + "value": " are written:", + "position": { + "start": { "line": 2008, "column": 58, "offset": 56765 }, + "end": { "line": 2008, "column": 71, "offset": 56778 } + } + } + ], + "position": { + "start": { "line": 2007, "column": 1, "offset": 56632 }, + "end": { "line": 2008, "column": 71, "offset": 56778 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\n// Fill a `Buffer` with character that takes up two bytes in UTF-8.\n\nconsole.log(Buffer.allocUnsafe(5).fill('\\u0222'));\n// Prints: ", + "position": { + "start": { "line": 2010, "column": 1, "offset": 56780 }, + "end": { "line": 2017, "column": 4, "offset": 56984 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\n// Fill a `Buffer` with character that takes up two bytes in UTF-8.\n\nconsole.log(Buffer.allocUnsafe(5).fill('\\u0222'));\n// Prints: ", + "position": { + "start": { "line": 2019, "column": 1, "offset": 56986 }, + "end": { "line": 2026, "column": 4, "offset": 57195 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "If ", + "position": { + "start": { "line": 2028, "column": 1, "offset": 57197 }, + "end": { "line": 2028, "column": 4, "offset": 57200 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 2028, "column": 4, "offset": 57200 }, + "end": { "line": 2028, "column": 11, "offset": 57207 } + } + }, + { + "type": "text", + "value": " contains invalid characters, it is truncated; if no valid\nfill data remains, an exception is thrown:", + "position": { + "start": { "line": 2028, "column": 11, "offset": 57207 }, + "end": { "line": 2029, "column": 43, "offset": 57308 } + } + } + ], + "position": { + "start": { "line": 2028, "column": 1, "offset": 57197 }, + "end": { "line": 2029, "column": 43, "offset": 57308 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.allocUnsafe(5);\n\nconsole.log(buf.fill('a'));\n// Prints: \nconsole.log(buf.fill('aazz', 'hex'));\n// Prints: \nconsole.log(buf.fill('zz', 'hex'));\n// Throws an exception.", + "position": { + "start": { "line": 2031, "column": 1, "offset": 57310 }, + "end": { "line": 2042, "column": 4, "offset": 57591 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.allocUnsafe(5);\n\nconsole.log(buf.fill('a'));\n// Prints: \nconsole.log(buf.fill('aazz', 'hex'));\n// Prints: \nconsole.log(buf.fill('zz', 'hex'));\n// Throws an exception.", + "position": { + "start": { "line": 2044, "column": 1, "offset": 57593 }, + "end": { "line": 2055, "column": 4, "offset": 57879 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.includes(value[, byteOffset][, encoding])", + "position": { + "start": { "line": 2057, "column": 5, "offset": 57885 }, + "end": { "line": 2057, "column": 52, "offset": 57932 } + } + } + ], + "position": { + "start": { "line": 2057, "column": 1, "offset": 57881 }, + "end": { "line": 2057, "column": 52, "offset": 57932 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 2059, "column": 1, "offset": 57934 }, + "end": { "line": 2061, "column": 4, "offset": 57961 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 2063, "column": 3, "offset": 57965 }, + "end": { "line": 2063, "column": 10, "offset": 57972 } + } + }, + { + "type": "text", + "value": " {string|Buffer|Uint8Array|integer} What to search for.", + "position": { + "start": { "line": 2063, "column": 10, "offset": 57972 }, + "end": { "line": 2063, "column": 65, "offset": 58027 } + } + } + ], + "position": { + "start": { "line": 2063, "column": 3, "offset": 57965 }, + "end": { "line": 2063, "column": 65, "offset": 58027 } + } + } + ], + "position": { + "start": { "line": 2063, "column": 1, "offset": 57963 }, + "end": { "line": 2063, "column": 65, "offset": 58027 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "byteOffset", + "position": { + "start": { "line": 2064, "column": 3, "offset": 58030 }, + "end": { "line": 2064, "column": 15, "offset": 58042 } + } + }, + { + "type": "text", + "value": " {integer} Where to begin searching in ", + "position": { + "start": { "line": 2064, "column": 15, "offset": 58042 }, + "end": { "line": 2064, "column": 54, "offset": 58081 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 2064, "column": 54, "offset": 58081 }, + "end": { "line": 2064, "column": 59, "offset": 58086 } + } + }, + { + "type": "text", + "value": ". If negative, then\noffset is calculated from the end of ", + "position": { + "start": { "line": 2064, "column": 59, "offset": 58086 }, + "end": { "line": 2065, "column": 40, "offset": 58145 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 2065, "column": 40, "offset": 58145 }, + "end": { "line": 2065, "column": 45, "offset": 58150 } + } + }, + { + "type": "text", + "value": ". ", + "position": { + "start": { "line": 2065, "column": 45, "offset": 58150 }, + "end": { "line": 2065, "column": 47, "offset": 58152 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { + "line": 2065, + "column": 49, + "offset": 58154 + }, + "end": { "line": 2065, "column": 57, "offset": 58162 } + } + } + ], + "position": { + "start": { "line": 2065, "column": 47, "offset": 58152 }, + "end": { "line": 2065, "column": 59, "offset": 58164 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 2065, "column": 59, "offset": 58164 }, + "end": { "line": 2065, "column": 60, "offset": 58165 } + } + }, + { + "type": "inlineCode", + "value": "0", + "position": { + "start": { "line": 2065, "column": 60, "offset": 58165 }, + "end": { "line": 2065, "column": 63, "offset": 58168 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 2065, "column": 63, "offset": 58168 }, + "end": { "line": 2065, "column": 64, "offset": 58169 } + } + } + ], + "position": { + "start": { "line": 2064, "column": 3, "offset": 58030 }, + "end": { "line": 2065, "column": 64, "offset": 58169 } + } + } + ], + "position": { + "start": { "line": 2064, "column": 1, "offset": 58028 }, + "end": { "line": 2065, "column": 64, "offset": 58169 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "encoding", + "position": { + "start": { "line": 2066, "column": 3, "offset": 58172 }, + "end": { "line": 2066, "column": 13, "offset": 58182 } + } + }, + { + "type": "text", + "value": " {string} If ", + "position": { + "start": { "line": 2066, "column": 13, "offset": 58182 }, + "end": { "line": 2066, "column": 26, "offset": 58195 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 2066, "column": 26, "offset": 58195 }, + "end": { "line": 2066, "column": 33, "offset": 58202 } + } + }, + { + "type": "text", + "value": " is a string, this is its encoding.\n", + "position": { + "start": { "line": 2066, "column": 33, "offset": 58202 }, + "end": { "line": 2067, "column": 1, "offset": 58238 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { "line": 2067, "column": 5, "offset": 58242 }, + "end": { "line": 2067, "column": 13, "offset": 58250 } + } + } + ], + "position": { + "start": { "line": 2067, "column": 3, "offset": 58240 }, + "end": { "line": 2067, "column": 15, "offset": 58252 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 2067, "column": 15, "offset": 58252 }, + "end": { "line": 2067, "column": 16, "offset": 58253 } + } + }, + { + "type": "inlineCode", + "value": "'utf8'", + "position": { + "start": { "line": 2067, "column": 16, "offset": 58253 }, + "end": { "line": 2067, "column": 24, "offset": 58261 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 2067, "column": 24, "offset": 58261 }, + "end": { "line": 2067, "column": 25, "offset": 58262 } + } + } + ], + "position": { + "start": { "line": 2066, "column": 3, "offset": 58172 }, + "end": { "line": 2067, "column": 25, "offset": 58262 } + } + } + ], + "position": { + "start": { "line": 2066, "column": 1, "offset": 58170 }, + "end": { "line": 2067, "column": 25, "offset": 58262 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {boolean} ", + "position": { + "start": { "line": 2068, "column": 3, "offset": 58265 }, + "end": { "line": 2068, "column": 22, "offset": 58284 } + } + }, + { + "type": "inlineCode", + "value": "true", + "position": { + "start": { "line": 2068, "column": 22, "offset": 58284 }, + "end": { "line": 2068, "column": 28, "offset": 58290 } + } + }, + { + "type": "text", + "value": " if ", + "position": { + "start": { "line": 2068, "column": 28, "offset": 58290 }, + "end": { "line": 2068, "column": 32, "offset": 58294 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 2068, "column": 32, "offset": 58294 }, + "end": { "line": 2068, "column": 39, "offset": 58301 } + } + }, + { + "type": "text", + "value": " was found in ", + "position": { + "start": { "line": 2068, "column": 39, "offset": 58301 }, + "end": { "line": 2068, "column": 53, "offset": 58315 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 2068, "column": 53, "offset": 58315 }, + "end": { "line": 2068, "column": 58, "offset": 58320 } + } + }, + { + "type": "text", + "value": ", ", + "position": { + "start": { "line": 2068, "column": 58, "offset": 58320 }, + "end": { "line": 2068, "column": 60, "offset": 58322 } + } + }, + { + "type": "inlineCode", + "value": "false", + "position": { + "start": { "line": 2068, "column": 60, "offset": 58322 }, + "end": { "line": 2068, "column": 67, "offset": 58329 } + } + }, + { + "type": "text", + "value": " otherwise.", + "position": { + "start": { "line": 2068, "column": 67, "offset": 58329 }, + "end": { "line": 2068, "column": 78, "offset": 58340 } + } + } + ], + "position": { + "start": { "line": 2068, "column": 3, "offset": 58265 }, + "end": { "line": 2068, "column": 78, "offset": 58340 } + } + } + ], + "position": { + "start": { "line": 2068, "column": 1, "offset": 58263 }, + "end": { "line": 2068, "column": 78, "offset": 58340 } + } + } + ], + "position": { + "start": { "line": 2063, "column": 1, "offset": 57963 }, + "end": { "line": 2068, "column": 78, "offset": 58340 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Equivalent to ", + "position": { + "start": { "line": 2070, "column": 1, "offset": 58342 }, + "end": { "line": 2070, "column": 15, "offset": 58356 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "buf.indexOf() !== -1", + "position": { + "start": { "line": 2070, "column": 16, "offset": 58357 }, + "end": { "line": 2070, "column": 38, "offset": 58379 } + } + } + ], + "position": { + "start": { "line": 2070, "column": 15, "offset": 58356 }, + "end": { "line": 2070, "column": 56, "offset": 58397 } + }, + "label": "`buf.indexOf()`", + "identifier": "`buf.indexof()`", + "referenceType": "full" + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 2070, "column": 56, "offset": 58397 }, + "end": { "line": 2070, "column": 57, "offset": 58398 } + } + } + ], + "position": { + "start": { "line": 2070, "column": 1, "offset": 58342 }, + "end": { "line": 2070, "column": 57, "offset": 58398 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from('this is a buffer');\n\nconsole.log(buf.includes('this'));\n// Prints: true\nconsole.log(buf.includes('is'));\n// Prints: true\nconsole.log(buf.includes(Buffer.from('a buffer')));\n// Prints: true\nconsole.log(buf.includes(97));\n// Prints: true (97 is the decimal ASCII value for 'a')\nconsole.log(buf.includes(Buffer.from('a buffer example')));\n// Prints: false\nconsole.log(buf.includes(Buffer.from('a buffer example').slice(0, 8)));\n// Prints: true\nconsole.log(buf.includes('this', 4));\n// Prints: false", + "position": { + "start": { "line": 2072, "column": 1, "offset": 58400 }, + "end": { "line": 2091, "column": 4, "offset": 58970 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from('this is a buffer');\n\nconsole.log(buf.includes('this'));\n// Prints: true\nconsole.log(buf.includes('is'));\n// Prints: true\nconsole.log(buf.includes(Buffer.from('a buffer')));\n// Prints: true\nconsole.log(buf.includes(97));\n// Prints: true (97 is the decimal ASCII value for 'a')\nconsole.log(buf.includes(Buffer.from('a buffer example')));\n// Prints: false\nconsole.log(buf.includes(Buffer.from('a buffer example').slice(0, 8)));\n// Prints: true\nconsole.log(buf.includes('this', 4));\n// Prints: false", + "position": { + "start": { "line": 2093, "column": 1, "offset": 58972 }, + "end": { "line": 2112, "column": 4, "offset": 59547 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.indexOf(value[, byteOffset][, encoding])", + "position": { + "start": { "line": 2114, "column": 5, "offset": 59553 }, + "end": { "line": 2114, "column": 51, "offset": 59599 } + } + } + ], + "position": { + "start": { "line": 2114, "column": 1, "offset": 59549 }, + "end": { "line": 2114, "column": 51, "offset": 59599 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 2116, "column": 1, "offset": 59601 }, + "end": { "line": 2128, "column": 4, "offset": 59976 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 2130, "column": 3, "offset": 59980 }, + "end": { "line": 2130, "column": 10, "offset": 59987 } + } + }, + { + "type": "text", + "value": " {string|Buffer|Uint8Array|integer} What to search for.", + "position": { + "start": { "line": 2130, "column": 10, "offset": 59987 }, + "end": { "line": 2130, "column": 65, "offset": 60042 } + } + } + ], + "position": { + "start": { "line": 2130, "column": 3, "offset": 59980 }, + "end": { "line": 2130, "column": 65, "offset": 60042 } + } + } + ], + "position": { + "start": { "line": 2130, "column": 1, "offset": 59978 }, + "end": { "line": 2130, "column": 65, "offset": 60042 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "byteOffset", + "position": { + "start": { "line": 2131, "column": 3, "offset": 60045 }, + "end": { "line": 2131, "column": 15, "offset": 60057 } + } + }, + { + "type": "text", + "value": " {integer} Where to begin searching in ", + "position": { + "start": { "line": 2131, "column": 15, "offset": 60057 }, + "end": { "line": 2131, "column": 54, "offset": 60096 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 2131, "column": 54, "offset": 60096 }, + "end": { "line": 2131, "column": 59, "offset": 60101 } + } + }, + { + "type": "text", + "value": ". If negative, then\noffset is calculated from the end of ", + "position": { + "start": { "line": 2131, "column": 59, "offset": 60101 }, + "end": { "line": 2132, "column": 40, "offset": 60160 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 2132, "column": 40, "offset": 60160 }, + "end": { "line": 2132, "column": 45, "offset": 60165 } + } + }, + { + "type": "text", + "value": ". ", + "position": { + "start": { "line": 2132, "column": 45, "offset": 60165 }, + "end": { "line": 2132, "column": 47, "offset": 60167 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { + "line": 2132, + "column": 49, + "offset": 60169 + }, + "end": { "line": 2132, "column": 57, "offset": 60177 } + } + } + ], + "position": { + "start": { "line": 2132, "column": 47, "offset": 60167 }, + "end": { "line": 2132, "column": 59, "offset": 60179 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 2132, "column": 59, "offset": 60179 }, + "end": { "line": 2132, "column": 60, "offset": 60180 } + } + }, + { + "type": "inlineCode", + "value": "0", + "position": { + "start": { "line": 2132, "column": 60, "offset": 60180 }, + "end": { "line": 2132, "column": 63, "offset": 60183 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 2132, "column": 63, "offset": 60183 }, + "end": { "line": 2132, "column": 64, "offset": 60184 } + } + } + ], + "position": { + "start": { "line": 2131, "column": 3, "offset": 60045 }, + "end": { "line": 2132, "column": 64, "offset": 60184 } + } + } + ], + "position": { + "start": { "line": 2131, "column": 1, "offset": 60043 }, + "end": { "line": 2132, "column": 64, "offset": 60184 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "encoding", + "position": { + "start": { "line": 2133, "column": 3, "offset": 60187 }, + "end": { "line": 2133, "column": 13, "offset": 60197 } + } + }, + { + "type": "text", + "value": " {string} If ", + "position": { + "start": { "line": 2133, "column": 13, "offset": 60197 }, + "end": { "line": 2133, "column": 26, "offset": 60210 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 2133, "column": 26, "offset": 60210 }, + "end": { "line": 2133, "column": 33, "offset": 60217 } + } + }, + { + "type": "text", + "value": " is a string, this is the encoding used to\ndetermine the binary representation of the string that will be searched for in\n", + "position": { + "start": { "line": 2133, "column": 33, "offset": 60217 }, + "end": { "line": 2135, "column": 1, "offset": 60341 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 2135, "column": 3, "offset": 60343 }, + "end": { "line": 2135, "column": 8, "offset": 60348 } + } + }, + { + "type": "text", + "value": ". ", + "position": { + "start": { "line": 2135, "column": 8, "offset": 60348 }, + "end": { "line": 2135, "column": 10, "offset": 60350 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { + "line": 2135, + "column": 12, + "offset": 60352 + }, + "end": { "line": 2135, "column": 20, "offset": 60360 } + } + } + ], + "position": { + "start": { "line": 2135, "column": 10, "offset": 60350 }, + "end": { "line": 2135, "column": 22, "offset": 60362 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 2135, "column": 22, "offset": 60362 }, + "end": { "line": 2135, "column": 23, "offset": 60363 } + } + }, + { + "type": "inlineCode", + "value": "'utf8'", + "position": { + "start": { "line": 2135, "column": 23, "offset": 60363 }, + "end": { "line": 2135, "column": 31, "offset": 60371 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 2135, "column": 31, "offset": 60371 }, + "end": { "line": 2135, "column": 32, "offset": 60372 } + } + } + ], + "position": { + "start": { "line": 2133, "column": 3, "offset": 60187 }, + "end": { "line": 2135, "column": 32, "offset": 60372 } + } + } + ], + "position": { + "start": { "line": 2133, "column": 1, "offset": 60185 }, + "end": { "line": 2135, "column": 32, "offset": 60372 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {integer} The index of the first occurrence of ", + "position": { + "start": { "line": 2136, "column": 3, "offset": 60375 }, + "end": { "line": 2136, "column": 59, "offset": 60431 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 2136, "column": 59, "offset": 60431 }, + "end": { "line": 2136, "column": 66, "offset": 60438 } + } + }, + { + "type": "text", + "value": " in ", + "position": { + "start": { "line": 2136, "column": 66, "offset": 60438 }, + "end": { "line": 2136, "column": 70, "offset": 60442 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 2136, "column": 70, "offset": 60442 }, + "end": { "line": 2136, "column": 75, "offset": 60447 } + } + }, + { + "type": "text", + "value": ", or\n", + "position": { + "start": { "line": 2136, "column": 75, "offset": 60447 }, + "end": { "line": 2137, "column": 1, "offset": 60452 } + } + }, + { + "type": "inlineCode", + "value": "-1", + "position": { + "start": { "line": 2137, "column": 3, "offset": 60454 }, + "end": { "line": 2137, "column": 7, "offset": 60458 } + } + }, + { + "type": "text", + "value": " if ", + "position": { + "start": { "line": 2137, "column": 7, "offset": 60458 }, + "end": { "line": 2137, "column": 11, "offset": 60462 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 2137, "column": 11, "offset": 60462 }, + "end": { "line": 2137, "column": 16, "offset": 60467 } + } + }, + { + "type": "text", + "value": " does not contain ", + "position": { + "start": { "line": 2137, "column": 16, "offset": 60467 }, + "end": { "line": 2137, "column": 34, "offset": 60485 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 2137, "column": 34, "offset": 60485 }, + "end": { "line": 2137, "column": 41, "offset": 60492 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 2137, "column": 41, "offset": 60492 }, + "end": { "line": 2137, "column": 42, "offset": 60493 } + } + } + ], + "position": { + "start": { "line": 2136, "column": 3, "offset": 60375 }, + "end": { "line": 2137, "column": 42, "offset": 60493 } + } + } + ], + "position": { + "start": { "line": 2136, "column": 1, "offset": 60373 }, + "end": { "line": 2137, "column": 42, "offset": 60493 } + } + } + ], + "position": { + "start": { "line": 2130, "column": 1, "offset": 59978 }, + "end": { "line": 2137, "column": 42, "offset": 60493 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "If ", + "position": { + "start": { "line": 2139, "column": 1, "offset": 60495 }, + "end": { "line": 2139, "column": 4, "offset": 60498 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 2139, "column": 4, "offset": 60498 }, + "end": { "line": 2139, "column": 11, "offset": 60505 } + } + }, + { + "type": "text", + "value": " is:", + "position": { + "start": { "line": 2139, "column": 11, "offset": 60505 }, + "end": { "line": 2139, "column": 15, "offset": 60509 } + } + } + ], + "position": { + "start": { "line": 2139, "column": 1, "offset": 60495 }, + "end": { "line": 2139, "column": 15, "offset": 60509 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "a string, ", + "position": { + "start": { "line": 2141, "column": 3, "offset": 60513 }, + "end": { "line": 2141, "column": 13, "offset": 60523 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 2141, "column": 13, "offset": 60523 }, + "end": { "line": 2141, "column": 20, "offset": 60530 } + } + }, + { + "type": "text", + "value": " is interpreted according to the character encoding in\n", + "position": { + "start": { "line": 2141, "column": 20, "offset": 60530 }, + "end": { "line": 2142, "column": 1, "offset": 60585 } + } + }, + { + "type": "inlineCode", + "value": "encoding", + "position": { + "start": { "line": 2142, "column": 3, "offset": 60587 }, + "end": { "line": 2142, "column": 13, "offset": 60597 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 2142, "column": 13, "offset": 60597 }, + "end": { "line": 2142, "column": 14, "offset": 60598 } + } + } + ], + "position": { + "start": { "line": 2141, "column": 3, "offset": 60513 }, + "end": { "line": 2142, "column": 14, "offset": 60598 } + } + } + ], + "position": { + "start": { "line": 2141, "column": 1, "offset": 60511 }, + "end": { "line": 2142, "column": 14, "offset": 60598 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "a ", + "position": { + "start": { "line": 2143, "column": 3, "offset": 60601 }, + "end": { "line": 2143, "column": 5, "offset": 60603 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 2143, "column": 5, "offset": 60603 }, + "end": { "line": 2143, "column": 13, "offset": 60611 } + } + }, + { + "type": "text", + "value": " or {Uint8Array}, ", + "position": { + "start": { "line": 2143, "column": 13, "offset": 60611 }, + "end": { "line": 2143, "column": 31, "offset": 60629 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 2143, "column": 31, "offset": 60629 }, + "end": { "line": 2143, "column": 38, "offset": 60636 } + } + }, + { + "type": "text", + "value": " will be used in its entirety.\nTo compare a partial ", + "position": { + "start": { "line": 2143, "column": 38, "offset": 60636 }, + "end": { "line": 2144, "column": 24, "offset": 60690 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 2144, "column": 24, "offset": 60690 }, + "end": { "line": 2144, "column": 32, "offset": 60698 } + } + }, + { + "type": "text", + "value": ", use ", + "position": { + "start": { "line": 2144, "column": 32, "offset": 60698 }, + "end": { "line": 2144, "column": 38, "offset": 60704 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "buf.subarray", + "position": { + "start": { + "line": 2144, + "column": 39, + "offset": 60705 + }, + "end": { "line": 2144, "column": 53, "offset": 60719 } + } + } + ], + "position": { + "start": { "line": 2144, "column": 38, "offset": 60704 }, + "end": { "line": 2144, "column": 56, "offset": 60722 } + }, + "label": "`buf.subarray`", + "identifier": "`buf.subarray`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 2144, "column": 56, "offset": 60722 }, + "end": { "line": 2144, "column": 57, "offset": 60723 } + } + } + ], + "position": { + "start": { "line": 2143, "column": 3, "offset": 60601 }, + "end": { "line": 2144, "column": 57, "offset": 60723 } + } + } + ], + "position": { + "start": { "line": 2143, "column": 1, "offset": 60599 }, + "end": { "line": 2144, "column": 57, "offset": 60723 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "a number, ", + "position": { + "start": { "line": 2145, "column": 3, "offset": 60726 }, + "end": { "line": 2145, "column": 13, "offset": 60736 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 2145, "column": 13, "offset": 60736 }, + "end": { "line": 2145, "column": 20, "offset": 60743 } + } + }, + { + "type": "text", + "value": " will be interpreted as an unsigned 8-bit integer\nvalue between ", + "position": { + "start": { "line": 2145, "column": 20, "offset": 60743 }, + "end": { "line": 2146, "column": 17, "offset": 60809 } + } + }, + { + "type": "inlineCode", + "value": "0", + "position": { + "start": { "line": 2146, "column": 17, "offset": 60809 }, + "end": { "line": 2146, "column": 20, "offset": 60812 } + } + }, + { + "type": "text", + "value": " and ", + "position": { + "start": { "line": 2146, "column": 20, "offset": 60812 }, + "end": { "line": 2146, "column": 25, "offset": 60817 } + } + }, + { + "type": "inlineCode", + "value": "255", + "position": { + "start": { "line": 2146, "column": 25, "offset": 60817 }, + "end": { "line": 2146, "column": 30, "offset": 60822 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 2146, "column": 30, "offset": 60822 }, + "end": { "line": 2146, "column": 31, "offset": 60823 } + } + } + ], + "position": { + "start": { "line": 2145, "column": 3, "offset": 60726 }, + "end": { "line": 2146, "column": 31, "offset": 60823 } + } + } + ], + "position": { + "start": { "line": 2145, "column": 1, "offset": 60724 }, + "end": { "line": 2146, "column": 31, "offset": 60823 } + } + } + ], + "position": { + "start": { "line": 2141, "column": 1, "offset": 60511 }, + "end": { "line": 2146, "column": 31, "offset": 60823 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from('this is a buffer');\n\nconsole.log(buf.indexOf('this'));\n// Prints: 0\nconsole.log(buf.indexOf('is'));\n// Prints: 2\nconsole.log(buf.indexOf(Buffer.from('a buffer')));\n// Prints: 8\nconsole.log(buf.indexOf(97));\n// Prints: 8 (97 is the decimal ASCII value for 'a')\nconsole.log(buf.indexOf(Buffer.from('a buffer example')));\n// Prints: -1\nconsole.log(buf.indexOf(Buffer.from('a buffer example').slice(0, 8)));\n// Prints: 8\n\nconst utf16Buffer = Buffer.from('\\u039a\\u0391\\u03a3\\u03a3\\u0395', 'utf16le');\n\nconsole.log(utf16Buffer.indexOf('\\u03a3', 0, 'utf16le'));\n// Prints: 4\nconsole.log(utf16Buffer.indexOf('\\u03a3', -4, 'utf16le'));\n// Prints: 6", + "position": { + "start": { "line": 2148, "column": 1, "offset": 60825 }, + "end": { "line": 2172, "column": 4, "offset": 61539 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from('this is a buffer');\n\nconsole.log(buf.indexOf('this'));\n// Prints: 0\nconsole.log(buf.indexOf('is'));\n// Prints: 2\nconsole.log(buf.indexOf(Buffer.from('a buffer')));\n// Prints: 8\nconsole.log(buf.indexOf(97));\n// Prints: 8 (97 is the decimal ASCII value for 'a')\nconsole.log(buf.indexOf(Buffer.from('a buffer example')));\n// Prints: -1\nconsole.log(buf.indexOf(Buffer.from('a buffer example').slice(0, 8)));\n// Prints: 8\n\nconst utf16Buffer = Buffer.from('\\u039a\\u0391\\u03a3\\u03a3\\u0395', 'utf16le');\n\nconsole.log(utf16Buffer.indexOf('\\u03a3', 0, 'utf16le'));\n// Prints: 4\nconsole.log(utf16Buffer.indexOf('\\u03a3', -4, 'utf16le'));\n// Prints: 6", + "position": { + "start": { "line": 2174, "column": 1, "offset": 61541 }, + "end": { "line": 2198, "column": 4, "offset": 62260 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "If ", + "position": { + "start": { "line": 2200, "column": 1, "offset": 62262 }, + "end": { "line": 2200, "column": 4, "offset": 62265 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 2200, "column": 4, "offset": 62265 }, + "end": { "line": 2200, "column": 11, "offset": 62272 } + } + }, + { + "type": "text", + "value": " is not a string, number, or ", + "position": { + "start": { "line": 2200, "column": 11, "offset": 62272 }, + "end": { "line": 2200, "column": 40, "offset": 62301 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 2200, "column": 40, "offset": 62301 }, + "end": { "line": 2200, "column": 48, "offset": 62309 } + } + }, + { + "type": "text", + "value": ", this method will throw a\n", + "position": { + "start": { "line": 2200, "column": 48, "offset": 62309 }, + "end": { "line": 2201, "column": 1, "offset": 62336 } + } + }, + { + "type": "inlineCode", + "value": "TypeError", + "position": { + "start": { "line": 2201, "column": 1, "offset": 62336 }, + "end": { "line": 2201, "column": 12, "offset": 62347 } + } + }, + { + "type": "text", + "value": ". If ", + "position": { + "start": { "line": 2201, "column": 12, "offset": 62347 }, + "end": { "line": 2201, "column": 17, "offset": 62352 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 2201, "column": 17, "offset": 62352 }, + "end": { "line": 2201, "column": 24, "offset": 62359 } + } + }, + { + "type": "text", + "value": " is a number, it will be coerced to a valid byte value,\nan integer between 0 and 255.", + "position": { + "start": { "line": 2201, "column": 24, "offset": 62359 }, + "end": { "line": 2202, "column": 30, "offset": 62444 } + } + } + ], + "position": { + "start": { "line": 2200, "column": 1, "offset": 62262 }, + "end": { "line": 2202, "column": 30, "offset": 62444 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "If ", + "position": { + "start": { "line": 2204, "column": 1, "offset": 62446 }, + "end": { "line": 2204, "column": 4, "offset": 62449 } + } + }, + { + "type": "inlineCode", + "value": "byteOffset", + "position": { + "start": { "line": 2204, "column": 4, "offset": 62449 }, + "end": { "line": 2204, "column": 16, "offset": 62461 } + } + }, + { + "type": "text", + "value": " is not a number, it will be coerced to a number. If the result\nof coercion is ", + "position": { + "start": { "line": 2204, "column": 16, "offset": 62461 }, + "end": { "line": 2205, "column": 16, "offset": 62540 } + } + }, + { + "type": "inlineCode", + "value": "NaN", + "position": { + "start": { "line": 2205, "column": 16, "offset": 62540 }, + "end": { "line": 2205, "column": 21, "offset": 62545 } + } + }, + { + "type": "text", + "value": " or ", + "position": { + "start": { "line": 2205, "column": 21, "offset": 62545 }, + "end": { "line": 2205, "column": 25, "offset": 62549 } + } + }, + { + "type": "inlineCode", + "value": "0", + "position": { + "start": { "line": 2205, "column": 25, "offset": 62549 }, + "end": { "line": 2205, "column": 28, "offset": 62552 } + } + }, + { + "type": "text", + "value": ", then the entire buffer will be searched. This\nbehavior matches ", + "position": { + "start": { "line": 2205, "column": 28, "offset": 62552 }, + "end": { "line": 2206, "column": 18, "offset": 62617 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "String.prototype.indexOf()", + "position": { + "start": { "line": 2206, "column": 19, "offset": 62618 }, + "end": { "line": 2206, "column": 47, "offset": 62646 } + } + } + ], + "position": { + "start": { "line": 2206, "column": 18, "offset": 62617 }, + "end": { "line": 2206, "column": 50, "offset": 62649 } + }, + "label": "`String.prototype.indexOf()`", + "identifier": "`string.prototype.indexof()`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 2206, "column": 50, "offset": 62649 }, + "end": { "line": 2206, "column": 51, "offset": 62650 } + } + } + ], + "position": { + "start": { "line": 2204, "column": 1, "offset": 62446 }, + "end": { "line": 2206, "column": 51, "offset": 62650 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst b = Buffer.from('abcdef');\n\n// Passing a value that's a number, but not a valid byte.\n// Prints: 2, equivalent to searching for 99 or 'c'.\nconsole.log(b.indexOf(99.9));\nconsole.log(b.indexOf(256 + 99));\n\n// Passing a byteOffset that coerces to NaN or 0.\n// Prints: 1, searching the whole buffer.\nconsole.log(b.indexOf('b', undefined));\nconsole.log(b.indexOf('b', {}));\nconsole.log(b.indexOf('b', null));\nconsole.log(b.indexOf('b', []));", + "position": { + "start": { "line": 2208, "column": 1, "offset": 62652 }, + "end": { "line": 2224, "column": 4, "offset": 63144 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst b = Buffer.from('abcdef');\n\n// Passing a value that's a number, but not a valid byte.\n// Prints: 2, equivalent to searching for 99 or 'c'.\nconsole.log(b.indexOf(99.9));\nconsole.log(b.indexOf(256 + 99));\n\n// Passing a byteOffset that coerces to NaN or 0.\n// Prints: 1, searching the whole buffer.\nconsole.log(b.indexOf('b', undefined));\nconsole.log(b.indexOf('b', {}));\nconsole.log(b.indexOf('b', null));\nconsole.log(b.indexOf('b', []));", + "position": { + "start": { "line": 2226, "column": 1, "offset": 63146 }, + "end": { "line": 2242, "column": 4, "offset": 63643 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "If ", + "position": { + "start": { "line": 2244, "column": 1, "offset": 63645 }, + "end": { "line": 2244, "column": 4, "offset": 63648 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 2244, "column": 4, "offset": 63648 }, + "end": { "line": 2244, "column": 11, "offset": 63655 } + } + }, + { + "type": "text", + "value": " is an empty string or empty ", + "position": { + "start": { "line": 2244, "column": 11, "offset": 63655 }, + "end": { "line": 2244, "column": 40, "offset": 63684 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 2244, "column": 40, "offset": 63684 }, + "end": { "line": 2244, "column": 48, "offset": 63692 } + } + }, + { + "type": "text", + "value": " and ", + "position": { + "start": { "line": 2244, "column": 48, "offset": 63692 }, + "end": { "line": 2244, "column": 53, "offset": 63697 } + } + }, + { + "type": "inlineCode", + "value": "byteOffset", + "position": { + "start": { "line": 2244, "column": 53, "offset": 63697 }, + "end": { "line": 2244, "column": 65, "offset": 63709 } + } + }, + { + "type": "text", + "value": " is less\nthan ", + "position": { + "start": { "line": 2244, "column": 65, "offset": 63709 }, + "end": { "line": 2245, "column": 6, "offset": 63723 } + } + }, + { + "type": "inlineCode", + "value": "buf.length", + "position": { + "start": { "line": 2245, "column": 6, "offset": 63723 }, + "end": { "line": 2245, "column": 18, "offset": 63735 } + } + }, + { + "type": "text", + "value": ", ", + "position": { + "start": { "line": 2245, "column": 18, "offset": 63735 }, + "end": { "line": 2245, "column": 20, "offset": 63737 } + } + }, + { + "type": "inlineCode", + "value": "byteOffset", + "position": { + "start": { "line": 2245, "column": 20, "offset": 63737 }, + "end": { "line": 2245, "column": 32, "offset": 63749 } + } + }, + { + "type": "text", + "value": " will be returned. If ", + "position": { + "start": { "line": 2245, "column": 32, "offset": 63749 }, + "end": { "line": 2245, "column": 54, "offset": 63771 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 2245, "column": 54, "offset": 63771 }, + "end": { "line": 2245, "column": 61, "offset": 63778 } + } + }, + { + "type": "text", + "value": " is empty and\n", + "position": { + "start": { "line": 2245, "column": 61, "offset": 63778 }, + "end": { "line": 2246, "column": 1, "offset": 63792 } + } + }, + { + "type": "inlineCode", + "value": "byteOffset", + "position": { + "start": { "line": 2246, "column": 1, "offset": 63792 }, + "end": { "line": 2246, "column": 13, "offset": 63804 } + } + }, + { + "type": "text", + "value": " is at least ", + "position": { + "start": { "line": 2246, "column": 13, "offset": 63804 }, + "end": { "line": 2246, "column": 26, "offset": 63817 } + } + }, + { + "type": "inlineCode", + "value": "buf.length", + "position": { + "start": { "line": 2246, "column": 26, "offset": 63817 }, + "end": { "line": 2246, "column": 38, "offset": 63829 } + } + }, + { + "type": "text", + "value": ", ", + "position": { + "start": { "line": 2246, "column": 38, "offset": 63829 }, + "end": { "line": 2246, "column": 40, "offset": 63831 } + } + }, + { + "type": "inlineCode", + "value": "buf.length", + "position": { + "start": { "line": 2246, "column": 40, "offset": 63831 }, + "end": { "line": 2246, "column": 52, "offset": 63843 } + } + }, + { + "type": "text", + "value": " will be returned.", + "position": { + "start": { "line": 2246, "column": 52, "offset": 63843 }, + "end": { "line": 2246, "column": 70, "offset": 63861 } + } + } + ], + "position": { + "start": { "line": 2244, "column": 1, "offset": 63645 }, + "end": { "line": 2246, "column": 70, "offset": 63861 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.keys()", + "position": { + "start": { "line": 2248, "column": 5, "offset": 63867 }, + "end": { "line": 2248, "column": 17, "offset": 63879 } + } + } + ], + "position": { + "start": { "line": 2248, "column": 1, "offset": 63863 }, + "end": { "line": 2248, "column": 17, "offset": 63879 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 2250, "column": 1, "offset": 63881 }, + "end": { "line": 2252, "column": 4, "offset": 63908 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {Iterator}", + "position": { + "start": { "line": 2254, "column": 3, "offset": 63912 }, + "end": { "line": 2254, "column": 22, "offset": 63931 } + } + } + ], + "position": { + "start": { "line": 2254, "column": 3, "offset": 63912 }, + "end": { "line": 2254, "column": 22, "offset": 63931 } + } + } + ], + "position": { + "start": { "line": 2254, "column": 1, "offset": 63910 }, + "end": { "line": 2254, "column": 22, "offset": 63931 } + } + } + ], + "position": { + "start": { "line": 2254, "column": 1, "offset": 63910 }, + "end": { "line": 2254, "column": 22, "offset": 63931 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Creates and returns an ", + "position": { + "start": { "line": 2256, "column": 1, "offset": 63933 }, + "end": { "line": 2256, "column": 24, "offset": 63956 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "text", + "value": "iterator", + "position": { + "start": { "line": 2256, "column": 25, "offset": 63957 }, + "end": { "line": 2256, "column": 33, "offset": 63965 } + } + } + ], + "position": { + "start": { "line": 2256, "column": 24, "offset": 63956 }, + "end": { "line": 2256, "column": 36, "offset": 63968 } + }, + "label": "iterator", + "identifier": "iterator", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": " of ", + "position": { + "start": { "line": 2256, "column": 36, "offset": 63968 }, + "end": { "line": 2256, "column": 40, "offset": 63972 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 2256, "column": 40, "offset": 63972 }, + "end": { "line": 2256, "column": 45, "offset": 63977 } + } + }, + { + "type": "text", + "value": " keys (indexes).", + "position": { + "start": { "line": 2256, "column": 45, "offset": 63977 }, + "end": { "line": 2256, "column": 61, "offset": 63993 } + } + } + ], + "position": { + "start": { "line": 2256, "column": 1, "offset": 63933 }, + "end": { "line": 2256, "column": 61, "offset": 63993 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from('buffer');\n\nfor (const key of buf.keys()) {\n console.log(key);\n}\n// Prints:\n// 0\n// 1\n// 2\n// 3\n// 4\n// 5", + "position": { + "start": { "line": 2258, "column": 1, "offset": 63995 }, + "end": { "line": 2273, "column": 4, "offset": 64187 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from('buffer');\n\nfor (const key of buf.keys()) {\n console.log(key);\n}\n// Prints:\n// 0\n// 1\n// 2\n// 3\n// 4\n// 5", + "position": { + "start": { "line": 2275, "column": 1, "offset": 64189 }, + "end": { "line": 2290, "column": 4, "offset": 64386 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.lastIndexOf(value[, byteOffset][, encoding])", + "position": { + "start": { "line": 2292, "column": 5, "offset": 64392 }, + "end": { "line": 2292, "column": 55, "offset": 64442 } + } + } + ], + "position": { + "start": { "line": 2292, "column": 1, "offset": 64388 }, + "end": { "line": 2292, "column": 55, "offset": 64442 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 2294, "column": 1, "offset": 64444 }, + "end": { "line": 2300, "column": 4, "offset": 64610 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 2302, "column": 3, "offset": 64614 }, + "end": { "line": 2302, "column": 10, "offset": 64621 } + } + }, + { + "type": "text", + "value": " {string|Buffer|Uint8Array|integer} What to search for.", + "position": { + "start": { "line": 2302, "column": 10, "offset": 64621 }, + "end": { "line": 2302, "column": 65, "offset": 64676 } + } + } + ], + "position": { + "start": { "line": 2302, "column": 3, "offset": 64614 }, + "end": { "line": 2302, "column": 65, "offset": 64676 } + } + } + ], + "position": { + "start": { "line": 2302, "column": 1, "offset": 64612 }, + "end": { "line": 2302, "column": 65, "offset": 64676 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "byteOffset", + "position": { + "start": { "line": 2303, "column": 3, "offset": 64679 }, + "end": { "line": 2303, "column": 15, "offset": 64691 } + } + }, + { + "type": "text", + "value": " {integer} Where to begin searching in ", + "position": { + "start": { "line": 2303, "column": 15, "offset": 64691 }, + "end": { "line": 2303, "column": 54, "offset": 64730 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 2303, "column": 54, "offset": 64730 }, + "end": { "line": 2303, "column": 59, "offset": 64735 } + } + }, + { + "type": "text", + "value": ". If negative, then\noffset is calculated from the end of ", + "position": { + "start": { "line": 2303, "column": 59, "offset": 64735 }, + "end": { "line": 2304, "column": 40, "offset": 64794 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 2304, "column": 40, "offset": 64794 }, + "end": { "line": 2304, "column": 45, "offset": 64799 } + } + }, + { + "type": "text", + "value": ". ", + "position": { + "start": { "line": 2304, "column": 45, "offset": 64799 }, + "end": { "line": 2304, "column": 47, "offset": 64801 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { + "line": 2304, + "column": 49, + "offset": 64803 + }, + "end": { "line": 2304, "column": 57, "offset": 64811 } + } + } + ], + "position": { + "start": { "line": 2304, "column": 47, "offset": 64801 }, + "end": { "line": 2304, "column": 59, "offset": 64813 } + } + }, + { + "type": "text", + "value": "\n", + "position": { + "start": { "line": 2304, "column": 59, "offset": 64813 }, + "end": { "line": 2305, "column": 1, "offset": 64814 } + } + }, + { + "type": "inlineCode", + "value": "buf.length - 1", + "position": { + "start": { "line": 2305, "column": 3, "offset": 64816 }, + "end": { "line": 2305, "column": 19, "offset": 64832 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 2305, "column": 19, "offset": 64832 }, + "end": { "line": 2305, "column": 20, "offset": 64833 } + } + } + ], + "position": { + "start": { "line": 2303, "column": 3, "offset": 64679 }, + "end": { "line": 2305, "column": 20, "offset": 64833 } + } + } + ], + "position": { + "start": { "line": 2303, "column": 1, "offset": 64677 }, + "end": { "line": 2305, "column": 20, "offset": 64833 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "encoding", + "position": { + "start": { "line": 2306, "column": 3, "offset": 64836 }, + "end": { "line": 2306, "column": 13, "offset": 64846 } + } + }, + { + "type": "text", + "value": " {string} If ", + "position": { + "start": { "line": 2306, "column": 13, "offset": 64846 }, + "end": { "line": 2306, "column": 26, "offset": 64859 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 2306, "column": 26, "offset": 64859 }, + "end": { "line": 2306, "column": 33, "offset": 64866 } + } + }, + { + "type": "text", + "value": " is a string, this is the encoding used to\ndetermine the binary representation of the string that will be searched for in\n", + "position": { + "start": { "line": 2306, "column": 33, "offset": 64866 }, + "end": { "line": 2308, "column": 1, "offset": 64990 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 2308, "column": 3, "offset": 64992 }, + "end": { "line": 2308, "column": 8, "offset": 64997 } + } + }, + { + "type": "text", + "value": ". ", + "position": { + "start": { "line": 2308, "column": 8, "offset": 64997 }, + "end": { "line": 2308, "column": 10, "offset": 64999 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { + "line": 2308, + "column": 12, + "offset": 65001 + }, + "end": { "line": 2308, "column": 20, "offset": 65009 } + } + } + ], + "position": { + "start": { "line": 2308, "column": 10, "offset": 64999 }, + "end": { "line": 2308, "column": 22, "offset": 65011 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 2308, "column": 22, "offset": 65011 }, + "end": { "line": 2308, "column": 23, "offset": 65012 } + } + }, + { + "type": "inlineCode", + "value": "'utf8'", + "position": { + "start": { "line": 2308, "column": 23, "offset": 65012 }, + "end": { "line": 2308, "column": 31, "offset": 65020 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 2308, "column": 31, "offset": 65020 }, + "end": { "line": 2308, "column": 32, "offset": 65021 } + } + } + ], + "position": { + "start": { "line": 2306, "column": 3, "offset": 64836 }, + "end": { "line": 2308, "column": 32, "offset": 65021 } + } + } + ], + "position": { + "start": { "line": 2306, "column": 1, "offset": 64834 }, + "end": { "line": 2308, "column": 32, "offset": 65021 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {integer} The index of the last occurrence of ", + "position": { + "start": { "line": 2309, "column": 3, "offset": 65024 }, + "end": { "line": 2309, "column": 58, "offset": 65079 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 2309, "column": 58, "offset": 65079 }, + "end": { "line": 2309, "column": 65, "offset": 65086 } + } + }, + { + "type": "text", + "value": " in ", + "position": { + "start": { "line": 2309, "column": 65, "offset": 65086 }, + "end": { "line": 2309, "column": 69, "offset": 65090 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 2309, "column": 69, "offset": 65090 }, + "end": { "line": 2309, "column": 74, "offset": 65095 } + } + }, + { + "type": "text", + "value": ", or\n", + "position": { + "start": { "line": 2309, "column": 74, "offset": 65095 }, + "end": { "line": 2310, "column": 1, "offset": 65100 } + } + }, + { + "type": "inlineCode", + "value": "-1", + "position": { + "start": { "line": 2310, "column": 3, "offset": 65102 }, + "end": { "line": 2310, "column": 7, "offset": 65106 } + } + }, + { + "type": "text", + "value": " if ", + "position": { + "start": { "line": 2310, "column": 7, "offset": 65106 }, + "end": { "line": 2310, "column": 11, "offset": 65110 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 2310, "column": 11, "offset": 65110 }, + "end": { "line": 2310, "column": 16, "offset": 65115 } + } + }, + { + "type": "text", + "value": " does not contain ", + "position": { + "start": { "line": 2310, "column": 16, "offset": 65115 }, + "end": { "line": 2310, "column": 34, "offset": 65133 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 2310, "column": 34, "offset": 65133 }, + "end": { "line": 2310, "column": 41, "offset": 65140 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 2310, "column": 41, "offset": 65140 }, + "end": { "line": 2310, "column": 42, "offset": 65141 } + } + } + ], + "position": { + "start": { "line": 2309, "column": 3, "offset": 65024 }, + "end": { "line": 2310, "column": 42, "offset": 65141 } + } + } + ], + "position": { + "start": { "line": 2309, "column": 1, "offset": 65022 }, + "end": { "line": 2310, "column": 42, "offset": 65141 } + } + } + ], + "position": { + "start": { "line": 2302, "column": 1, "offset": 64612 }, + "end": { "line": 2310, "column": 42, "offset": 65141 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Identical to ", + "position": { + "start": { "line": 2312, "column": 1, "offset": 65143 }, + "end": { "line": 2312, "column": 14, "offset": 65156 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "buf.indexOf()", + "position": { + "start": { "line": 2312, "column": 15, "offset": 65157 }, + "end": { "line": 2312, "column": 30, "offset": 65172 } + } + } + ], + "position": { + "start": { "line": 2312, "column": 14, "offset": 65156 }, + "end": { "line": 2312, "column": 33, "offset": 65175 } + }, + "label": "`buf.indexOf()`", + "identifier": "`buf.indexof()`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": ", except the last occurrence of ", + "position": { + "start": { "line": 2312, "column": 33, "offset": 65175 }, + "end": { "line": 2312, "column": 65, "offset": 65207 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 2312, "column": 65, "offset": 65207 }, + "end": { "line": 2312, "column": 72, "offset": 65214 } + } + }, + { + "type": "text", + "value": " is found\nrather than the first occurrence.", + "position": { + "start": { "line": 2312, "column": 72, "offset": 65214 }, + "end": { "line": 2313, "column": 34, "offset": 65257 } + } + } + ], + "position": { + "start": { "line": 2312, "column": 1, "offset": 65143 }, + "end": { "line": 2313, "column": 34, "offset": 65257 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from('this buffer is a buffer');\n\nconsole.log(buf.lastIndexOf('this'));\n// Prints: 0\nconsole.log(buf.lastIndexOf('buffer'));\n// Prints: 17\nconsole.log(buf.lastIndexOf(Buffer.from('buffer')));\n// Prints: 17\nconsole.log(buf.lastIndexOf(97));\n// Prints: 15 (97 is the decimal ASCII value for 'a')\nconsole.log(buf.lastIndexOf(Buffer.from('yolo')));\n// Prints: -1\nconsole.log(buf.lastIndexOf('buffer', 5));\n// Prints: 5\nconsole.log(buf.lastIndexOf('buffer', 4));\n// Prints: -1\n\nconst utf16Buffer = Buffer.from('\\u039a\\u0391\\u03a3\\u03a3\\u0395', 'utf16le');\n\nconsole.log(utf16Buffer.lastIndexOf('\\u03a3', undefined, 'utf16le'));\n// Prints: 6\nconsole.log(utf16Buffer.lastIndexOf('\\u03a3', -5, 'utf16le'));\n// Prints: 4", + "position": { + "start": { "line": 2315, "column": 1, "offset": 65259 }, + "end": { "line": 2341, "column": 4, "offset": 66038 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from('this buffer is a buffer');\n\nconsole.log(buf.lastIndexOf('this'));\n// Prints: 0\nconsole.log(buf.lastIndexOf('buffer'));\n// Prints: 17\nconsole.log(buf.lastIndexOf(Buffer.from('buffer')));\n// Prints: 17\nconsole.log(buf.lastIndexOf(97));\n// Prints: 15 (97 is the decimal ASCII value for 'a')\nconsole.log(buf.lastIndexOf(Buffer.from('yolo')));\n// Prints: -1\nconsole.log(buf.lastIndexOf('buffer', 5));\n// Prints: 5\nconsole.log(buf.lastIndexOf('buffer', 4));\n// Prints: -1\n\nconst utf16Buffer = Buffer.from('\\u039a\\u0391\\u03a3\\u03a3\\u0395', 'utf16le');\n\nconsole.log(utf16Buffer.lastIndexOf('\\u03a3', undefined, 'utf16le'));\n// Prints: 6\nconsole.log(utf16Buffer.lastIndexOf('\\u03a3', -5, 'utf16le'));\n// Prints: 4", + "position": { + "start": { "line": 2343, "column": 1, "offset": 66040 }, + "end": { "line": 2369, "column": 4, "offset": 66824 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "If ", + "position": { + "start": { "line": 2371, "column": 1, "offset": 66826 }, + "end": { "line": 2371, "column": 4, "offset": 66829 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 2371, "column": 4, "offset": 66829 }, + "end": { "line": 2371, "column": 11, "offset": 66836 } + } + }, + { + "type": "text", + "value": " is not a string, number, or ", + "position": { + "start": { "line": 2371, "column": 11, "offset": 66836 }, + "end": { "line": 2371, "column": 40, "offset": 66865 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 2371, "column": 40, "offset": 66865 }, + "end": { "line": 2371, "column": 48, "offset": 66873 } + } + }, + { + "type": "text", + "value": ", this method will throw a\n", + "position": { + "start": { "line": 2371, "column": 48, "offset": 66873 }, + "end": { "line": 2372, "column": 1, "offset": 66900 } + } + }, + { + "type": "inlineCode", + "value": "TypeError", + "position": { + "start": { "line": 2372, "column": 1, "offset": 66900 }, + "end": { "line": 2372, "column": 12, "offset": 66911 } + } + }, + { + "type": "text", + "value": ". If ", + "position": { + "start": { "line": 2372, "column": 12, "offset": 66911 }, + "end": { "line": 2372, "column": 17, "offset": 66916 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 2372, "column": 17, "offset": 66916 }, + "end": { "line": 2372, "column": 24, "offset": 66923 } + } + }, + { + "type": "text", + "value": " is a number, it will be coerced to a valid byte value,\nan integer between 0 and 255.", + "position": { + "start": { "line": 2372, "column": 24, "offset": 66923 }, + "end": { "line": 2373, "column": 30, "offset": 67008 } + } + } + ], + "position": { + "start": { "line": 2371, "column": 1, "offset": 66826 }, + "end": { "line": 2373, "column": 30, "offset": 67008 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "If ", + "position": { + "start": { "line": 2375, "column": 1, "offset": 67010 }, + "end": { "line": 2375, "column": 4, "offset": 67013 } + } + }, + { + "type": "inlineCode", + "value": "byteOffset", + "position": { + "start": { "line": 2375, "column": 4, "offset": 67013 }, + "end": { "line": 2375, "column": 16, "offset": 67025 } + } + }, + { + "type": "text", + "value": " is not a number, it will be coerced to a number. Any arguments\nthat coerce to ", + "position": { + "start": { "line": 2375, "column": 16, "offset": 67025 }, + "end": { "line": 2376, "column": 16, "offset": 67104 } + } + }, + { + "type": "inlineCode", + "value": "NaN", + "position": { + "start": { "line": 2376, "column": 16, "offset": 67104 }, + "end": { "line": 2376, "column": 21, "offset": 67109 } + } + }, + { + "type": "text", + "value": ", like ", + "position": { + "start": { "line": 2376, "column": 21, "offset": 67109 }, + "end": { "line": 2376, "column": 28, "offset": 67116 } + } + }, + { + "type": "inlineCode", + "value": "{}", + "position": { + "start": { "line": 2376, "column": 28, "offset": 67116 }, + "end": { "line": 2376, "column": 32, "offset": 67120 } + } + }, + { + "type": "text", + "value": " or ", + "position": { + "start": { "line": 2376, "column": 32, "offset": 67120 }, + "end": { "line": 2376, "column": 36, "offset": 67124 } + } + }, + { + "type": "inlineCode", + "value": "undefined", + "position": { + "start": { "line": 2376, "column": 36, "offset": 67124 }, + "end": { "line": 2376, "column": 47, "offset": 67135 } + } + }, + { + "type": "text", + "value": ", will search the whole buffer.\nThis behavior matches ", + "position": { + "start": { "line": 2376, "column": 47, "offset": 67135 }, + "end": { "line": 2377, "column": 23, "offset": 67189 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "String.prototype.lastIndexOf()", + "position": { + "start": { "line": 2377, "column": 24, "offset": 67190 }, + "end": { "line": 2377, "column": 56, "offset": 67222 } + } + } + ], + "position": { + "start": { "line": 2377, "column": 23, "offset": 67189 }, + "end": { "line": 2377, "column": 59, "offset": 67225 } + }, + "label": "`String.prototype.lastIndexOf()`", + "identifier": "`string.prototype.lastindexof()`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 2377, "column": 59, "offset": 67225 }, + "end": { "line": 2377, "column": 60, "offset": 67226 } + } + } + ], + "position": { + "start": { "line": 2375, "column": 1, "offset": 67010 }, + "end": { "line": 2377, "column": 60, "offset": 67226 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst b = Buffer.from('abcdef');\n\n// Passing a value that's a number, but not a valid byte.\n// Prints: 2, equivalent to searching for 99 or 'c'.\nconsole.log(b.lastIndexOf(99.9));\nconsole.log(b.lastIndexOf(256 + 99));\n\n// Passing a byteOffset that coerces to NaN.\n// Prints: 1, searching the whole buffer.\nconsole.log(b.lastIndexOf('b', undefined));\nconsole.log(b.lastIndexOf('b', {}));\n\n// Passing a byteOffset that coerces to 0.\n// Prints: -1, equivalent to passing 0.\nconsole.log(b.lastIndexOf('b', null));\nconsole.log(b.lastIndexOf('b', []));", + "position": { + "start": { "line": 2379, "column": 1, "offset": 67228 }, + "end": { "line": 2398, "column": 4, "offset": 67823 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst b = Buffer.from('abcdef');\n\n// Passing a value that's a number, but not a valid byte.\n// Prints: 2, equivalent to searching for 99 or 'c'.\nconsole.log(b.lastIndexOf(99.9));\nconsole.log(b.lastIndexOf(256 + 99));\n\n// Passing a byteOffset that coerces to NaN.\n// Prints: 1, searching the whole buffer.\nconsole.log(b.lastIndexOf('b', undefined));\nconsole.log(b.lastIndexOf('b', {}));\n\n// Passing a byteOffset that coerces to 0.\n// Prints: -1, equivalent to passing 0.\nconsole.log(b.lastIndexOf('b', null));\nconsole.log(b.lastIndexOf('b', []));", + "position": { + "start": { "line": 2400, "column": 1, "offset": 67825 }, + "end": { "line": 2419, "column": 4, "offset": 68425 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "If ", + "position": { + "start": { "line": 2421, "column": 1, "offset": 68427 }, + "end": { "line": 2421, "column": 4, "offset": 68430 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 2421, "column": 4, "offset": 68430 }, + "end": { "line": 2421, "column": 11, "offset": 68437 } + } + }, + { + "type": "text", + "value": " is an empty string or empty ", + "position": { + "start": { "line": 2421, "column": 11, "offset": 68437 }, + "end": { "line": 2421, "column": 40, "offset": 68466 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 2421, "column": 40, "offset": 68466 }, + "end": { "line": 2421, "column": 48, "offset": 68474 } + } + }, + { + "type": "text", + "value": ", ", + "position": { + "start": { "line": 2421, "column": 48, "offset": 68474 }, + "end": { "line": 2421, "column": 50, "offset": 68476 } + } + }, + { + "type": "inlineCode", + "value": "byteOffset", + "position": { + "start": { "line": 2421, "column": 50, "offset": 68476 }, + "end": { "line": 2421, "column": 62, "offset": 68488 } + } + }, + { + "type": "text", + "value": " will be returned.", + "position": { + "start": { "line": 2421, "column": 62, "offset": 68488 }, + "end": { "line": 2421, "column": 80, "offset": 68506 } + } + } + ], + "position": { + "start": { "line": 2421, "column": 1, "offset": 68427 }, + "end": { "line": 2421, "column": 80, "offset": 68506 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.length", + "position": { + "start": { "line": 2423, "column": 5, "offset": 68512 }, + "end": { "line": 2423, "column": 17, "offset": 68524 } + } + } + ], + "position": { + "start": { "line": 2423, "column": 1, "offset": 68508 }, + "end": { "line": 2423, "column": 17, "offset": 68524 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 2425, "column": 1, "offset": 68526 }, + "end": { "line": 2427, "column": 4, "offset": 68554 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "{integer}", + "position": { + "start": { "line": 2429, "column": 3, "offset": 68558 }, + "end": { "line": 2429, "column": 12, "offset": 68567 } + } + } + ], + "position": { + "start": { "line": 2429, "column": 3, "offset": 68558 }, + "end": { "line": 2429, "column": 12, "offset": 68567 } + } + } + ], + "position": { + "start": { "line": 2429, "column": 1, "offset": 68556 }, + "end": { "line": 2429, "column": 12, "offset": 68567 } + } + } + ], + "position": { + "start": { "line": 2429, "column": 1, "offset": 68556 }, + "end": { "line": 2429, "column": 12, "offset": 68567 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns the number of bytes in ", + "position": { + "start": { "line": 2431, "column": 1, "offset": 68569 }, + "end": { "line": 2431, "column": 32, "offset": 68600 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 2431, "column": 32, "offset": 68600 }, + "end": { "line": 2431, "column": 37, "offset": 68605 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 2431, "column": 37, "offset": 68605 }, + "end": { "line": 2431, "column": 38, "offset": 68606 } + } + } + ], + "position": { + "start": { "line": 2431, "column": 1, "offset": 68569 }, + "end": { "line": 2431, "column": 38, "offset": 68606 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\n// Create a `Buffer` and write a shorter string to it using UTF-8.\n\nconst buf = Buffer.alloc(1234);\n\nconsole.log(buf.length);\n// Prints: 1234\n\nbuf.write('some string', 0, 'utf8');\n\nconsole.log(buf.length);\n// Prints: 1234", + "position": { + "start": { "line": 2433, "column": 1, "offset": 68608 }, + "end": { "line": 2447, "column": 4, "offset": 68879 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\n// Create a `Buffer` and write a shorter string to it using UTF-8.\n\nconst buf = Buffer.alloc(1234);\n\nconsole.log(buf.length);\n// Prints: 1234\n\nbuf.write('some string', 0, 'utf8');\n\nconsole.log(buf.length);\n// Prints: 1234", + "position": { + "start": { "line": 2449, "column": 1, "offset": 68881 }, + "end": { "line": 2463, "column": 4, "offset": 69157 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.parent", + "position": { + "start": { "line": 2465, "column": 5, "offset": 69163 }, + "end": { "line": 2465, "column": 17, "offset": 69175 } + } + } + ], + "position": { + "start": { "line": 2465, "column": 1, "offset": 69159 }, + "end": { "line": 2465, "column": 17, "offset": 69175 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 2467, "column": 1, "offset": 69177 }, + "end": { "line": 2469, "column": 4, "offset": 69209 } + } + }, + { + "type": "blockquote", + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Stability: 0 - Deprecated: Use ", + "position": { + "start": { "line": 2471, "column": 3, "offset": 69213 }, + "end": { "line": 2471, "column": 34, "offset": 69244 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "buf.buffer", + "position": { + "start": { "line": 2471, "column": 35, "offset": 69245 }, + "end": { "line": 2471, "column": 47, "offset": 69257 } + } + } + ], + "position": { + "start": { "line": 2471, "column": 34, "offset": 69244 }, + "end": { "line": 2471, "column": 50, "offset": 69260 } + }, + "label": "`buf.buffer`", + "identifier": "`buf.buffer`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": " instead.", + "position": { + "start": { "line": 2471, "column": 50, "offset": 69260 }, + "end": { "line": 2471, "column": 59, "offset": 69269 } + } + } + ], + "position": { + "start": { "line": 2471, "column": 3, "offset": 69213 }, + "end": { "line": 2471, "column": 59, "offset": 69269 } + } + } + ], + "position": { + "start": { "line": 2471, "column": 1, "offset": 69211 }, + "end": { "line": 2471, "column": 59, "offset": 69269 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "The ", + "position": { + "start": { "line": 2473, "column": 1, "offset": 69271 }, + "end": { "line": 2473, "column": 5, "offset": 69275 } + } + }, + { + "type": "inlineCode", + "value": "buf.parent", + "position": { + "start": { "line": 2473, "column": 5, "offset": 69275 }, + "end": { "line": 2473, "column": 17, "offset": 69287 } + } + }, + { + "type": "text", + "value": " property is a deprecated alias for ", + "position": { + "start": { "line": 2473, "column": 17, "offset": 69287 }, + "end": { "line": 2473, "column": 53, "offset": 69323 } + } + }, + { + "type": "inlineCode", + "value": "buf.buffer", + "position": { + "start": { "line": 2473, "column": 53, "offset": 69323 }, + "end": { "line": 2473, "column": 65, "offset": 69335 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 2473, "column": 65, "offset": 69335 }, + "end": { "line": 2473, "column": 66, "offset": 69336 } + } + } + ], + "position": { + "start": { "line": 2473, "column": 1, "offset": 69271 }, + "end": { "line": 2473, "column": 66, "offset": 69336 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.readBigInt64BE([offset])", + "position": { + "start": { "line": 2475, "column": 5, "offset": 69342 }, + "end": { "line": 2475, "column": 35, "offset": 69372 } + } + } + ], + "position": { + "start": { "line": 2475, "column": 1, "offset": 69338 }, + "end": { "line": 2475, "column": 35, "offset": 69372 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 2477, "column": 1, "offset": 69374 }, + "end": { "line": 2481, "column": 4, "offset": 69417 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 2483, "column": 3, "offset": 69421 }, + "end": { "line": 2483, "column": 11, "offset": 69429 } + } + }, + { + "type": "text", + "value": " {integer} Number of bytes to skip before starting to read. Must\nsatisfy: ", + "position": { + "start": { "line": 2483, "column": 11, "offset": 69429 }, + "end": { "line": 2484, "column": 12, "offset": 69505 } + } + }, + { + "type": "inlineCode", + "value": "0 <= offset <= buf.length - 8", + "position": { + "start": { "line": 2484, "column": 12, "offset": 69505 }, + "end": { "line": 2484, "column": 43, "offset": 69536 } + } + }, + { + "type": "text", + "value": ". ", + "position": { + "start": { "line": 2484, "column": 43, "offset": 69536 }, + "end": { "line": 2484, "column": 45, "offset": 69538 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { + "line": 2484, + "column": 47, + "offset": 69540 + }, + "end": { "line": 2484, "column": 55, "offset": 69548 } + } + } + ], + "position": { + "start": { "line": 2484, "column": 45, "offset": 69538 }, + "end": { "line": 2484, "column": 57, "offset": 69550 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 2484, "column": 57, "offset": 69550 }, + "end": { "line": 2484, "column": 58, "offset": 69551 } + } + }, + { + "type": "inlineCode", + "value": "0", + "position": { + "start": { "line": 2484, "column": 58, "offset": 69551 }, + "end": { "line": 2484, "column": 61, "offset": 69554 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 2484, "column": 61, "offset": 69554 }, + "end": { "line": 2484, "column": 62, "offset": 69555 } + } + } + ], + "position": { + "start": { "line": 2483, "column": 3, "offset": 69421 }, + "end": { "line": 2484, "column": 62, "offset": 69555 } + } + } + ], + "position": { + "start": { "line": 2483, "column": 1, "offset": 69419 }, + "end": { "line": 2484, "column": 62, "offset": 69555 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {bigint}", + "position": { + "start": { "line": 2485, "column": 3, "offset": 69558 }, + "end": { "line": 2485, "column": 20, "offset": 69575 } + } + } + ], + "position": { + "start": { "line": 2485, "column": 3, "offset": 69558 }, + "end": { "line": 2485, "column": 20, "offset": 69575 } + } + } + ], + "position": { + "start": { "line": 2485, "column": 1, "offset": 69556 }, + "end": { "line": 2485, "column": 20, "offset": 69575 } + } + } + ], + "position": { + "start": { "line": 2483, "column": 1, "offset": 69419 }, + "end": { "line": 2485, "column": 20, "offset": 69575 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Reads a signed, big-endian 64-bit integer from ", + "position": { + "start": { "line": 2487, "column": 1, "offset": 69577 }, + "end": { "line": 2487, "column": 48, "offset": 69624 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 2487, "column": 48, "offset": 69624 }, + "end": { "line": 2487, "column": 53, "offset": 69629 } + } + }, + { + "type": "text", + "value": " at the specified ", + "position": { + "start": { "line": 2487, "column": 53, "offset": 69629 }, + "end": { "line": 2487, "column": 71, "offset": 69647 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 2487, "column": 71, "offset": 69647 }, + "end": { "line": 2487, "column": 79, "offset": 69655 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 2487, "column": 79, "offset": 69655 }, + "end": { "line": 2487, "column": 80, "offset": 69656 } + } + } + ], + "position": { + "start": { "line": 2487, "column": 1, "offset": 69577 }, + "end": { "line": 2487, "column": 80, "offset": 69656 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Integers read from a ", + "position": { + "start": { "line": 2489, "column": 1, "offset": 69658 }, + "end": { "line": 2489, "column": 22, "offset": 69679 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 2489, "column": 22, "offset": 69679 }, + "end": { "line": 2489, "column": 30, "offset": 69687 } + } + }, + { + "type": "text", + "value": " are interpreted as two's complement signed\nvalues.", + "position": { + "start": { "line": 2489, "column": 30, "offset": 69687 }, + "end": { "line": 2490, "column": 8, "offset": 69738 } + } + } + ], + "position": { + "start": { "line": 2489, "column": 1, "offset": 69658 }, + "end": { "line": 2490, "column": 8, "offset": 69738 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.readBigInt64LE([offset])", + "position": { + "start": { "line": 2492, "column": 5, "offset": 69744 }, + "end": { "line": 2492, "column": 35, "offset": 69774 } + } + } + ], + "position": { + "start": { "line": 2492, "column": 1, "offset": 69740 }, + "end": { "line": 2492, "column": 35, "offset": 69774 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 2494, "column": 1, "offset": 69776 }, + "end": { "line": 2498, "column": 4, "offset": 69819 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 2500, "column": 3, "offset": 69823 }, + "end": { "line": 2500, "column": 11, "offset": 69831 } + } + }, + { + "type": "text", + "value": " {integer} Number of bytes to skip before starting to read. Must\nsatisfy: ", + "position": { + "start": { "line": 2500, "column": 11, "offset": 69831 }, + "end": { "line": 2501, "column": 12, "offset": 69907 } + } + }, + { + "type": "inlineCode", + "value": "0 <= offset <= buf.length - 8", + "position": { + "start": { "line": 2501, "column": 12, "offset": 69907 }, + "end": { "line": 2501, "column": 43, "offset": 69938 } + } + }, + { + "type": "text", + "value": ". ", + "position": { + "start": { "line": 2501, "column": 43, "offset": 69938 }, + "end": { "line": 2501, "column": 45, "offset": 69940 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { + "line": 2501, + "column": 47, + "offset": 69942 + }, + "end": { "line": 2501, "column": 55, "offset": 69950 } + } + } + ], + "position": { + "start": { "line": 2501, "column": 45, "offset": 69940 }, + "end": { "line": 2501, "column": 57, "offset": 69952 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 2501, "column": 57, "offset": 69952 }, + "end": { "line": 2501, "column": 58, "offset": 69953 } + } + }, + { + "type": "inlineCode", + "value": "0", + "position": { + "start": { "line": 2501, "column": 58, "offset": 69953 }, + "end": { "line": 2501, "column": 61, "offset": 69956 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 2501, "column": 61, "offset": 69956 }, + "end": { "line": 2501, "column": 62, "offset": 69957 } + } + } + ], + "position": { + "start": { "line": 2500, "column": 3, "offset": 69823 }, + "end": { "line": 2501, "column": 62, "offset": 69957 } + } + } + ], + "position": { + "start": { "line": 2500, "column": 1, "offset": 69821 }, + "end": { "line": 2501, "column": 62, "offset": 69957 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {bigint}", + "position": { + "start": { "line": 2502, "column": 3, "offset": 69960 }, + "end": { "line": 2502, "column": 20, "offset": 69977 } + } + } + ], + "position": { + "start": { "line": 2502, "column": 3, "offset": 69960 }, + "end": { "line": 2502, "column": 20, "offset": 69977 } + } + } + ], + "position": { + "start": { "line": 2502, "column": 1, "offset": 69958 }, + "end": { "line": 2502, "column": 20, "offset": 69977 } + } + } + ], + "position": { + "start": { "line": 2500, "column": 1, "offset": 69821 }, + "end": { "line": 2502, "column": 20, "offset": 69977 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Reads a signed, little-endian 64-bit integer from ", + "position": { + "start": { "line": 2504, "column": 1, "offset": 69979 }, + "end": { "line": 2504, "column": 51, "offset": 70029 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 2504, "column": 51, "offset": 70029 }, + "end": { "line": 2504, "column": 56, "offset": 70034 } + } + }, + { + "type": "text", + "value": " at the specified\n", + "position": { + "start": { "line": 2504, "column": 56, "offset": 70034 }, + "end": { "line": 2505, "column": 1, "offset": 70052 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 2505, "column": 1, "offset": 70052 }, + "end": { "line": 2505, "column": 9, "offset": 70060 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 2505, "column": 9, "offset": 70060 }, + "end": { "line": 2505, "column": 10, "offset": 70061 } + } + } + ], + "position": { + "start": { "line": 2504, "column": 1, "offset": 69979 }, + "end": { "line": 2505, "column": 10, "offset": 70061 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Integers read from a ", + "position": { + "start": { "line": 2507, "column": 1, "offset": 70063 }, + "end": { "line": 2507, "column": 22, "offset": 70084 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 2507, "column": 22, "offset": 70084 }, + "end": { "line": 2507, "column": 30, "offset": 70092 } + } + }, + { + "type": "text", + "value": " are interpreted as two's complement signed\nvalues.", + "position": { + "start": { "line": 2507, "column": 30, "offset": 70092 }, + "end": { "line": 2508, "column": 8, "offset": 70143 } + } + } + ], + "position": { + "start": { "line": 2507, "column": 1, "offset": 70063 }, + "end": { "line": 2508, "column": 8, "offset": 70143 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.readBigUInt64BE([offset])", + "position": { + "start": { "line": 2510, "column": 5, "offset": 70149 }, + "end": { "line": 2510, "column": 36, "offset": 70180 } + } + } + ], + "position": { + "start": { "line": 2510, "column": 1, "offset": 70145 }, + "end": { "line": 2510, "column": 36, "offset": 70180 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 2512, "column": 1, "offset": 70182 }, + "end": { "line": 2522, "column": 4, "offset": 70408 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 2524, "column": 3, "offset": 70412 }, + "end": { "line": 2524, "column": 11, "offset": 70420 } + } + }, + { + "type": "text", + "value": " {integer} Number of bytes to skip before starting to read. Must\nsatisfy: ", + "position": { + "start": { "line": 2524, "column": 11, "offset": 70420 }, + "end": { "line": 2525, "column": 12, "offset": 70496 } + } + }, + { + "type": "inlineCode", + "value": "0 <= offset <= buf.length - 8", + "position": { + "start": { "line": 2525, "column": 12, "offset": 70496 }, + "end": { "line": 2525, "column": 43, "offset": 70527 } + } + }, + { + "type": "text", + "value": ". ", + "position": { + "start": { "line": 2525, "column": 43, "offset": 70527 }, + "end": { "line": 2525, "column": 45, "offset": 70529 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { + "line": 2525, + "column": 47, + "offset": 70531 + }, + "end": { "line": 2525, "column": 55, "offset": 70539 } + } + } + ], + "position": { + "start": { "line": 2525, "column": 45, "offset": 70529 }, + "end": { "line": 2525, "column": 57, "offset": 70541 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 2525, "column": 57, "offset": 70541 }, + "end": { "line": 2525, "column": 58, "offset": 70542 } + } + }, + { + "type": "inlineCode", + "value": "0", + "position": { + "start": { "line": 2525, "column": 58, "offset": 70542 }, + "end": { "line": 2525, "column": 61, "offset": 70545 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 2525, "column": 61, "offset": 70545 }, + "end": { "line": 2525, "column": 62, "offset": 70546 } + } + } + ], + "position": { + "start": { "line": 2524, "column": 3, "offset": 70412 }, + "end": { "line": 2525, "column": 62, "offset": 70546 } + } + } + ], + "position": { + "start": { "line": 2524, "column": 1, "offset": 70410 }, + "end": { "line": 2525, "column": 62, "offset": 70546 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {bigint}", + "position": { + "start": { "line": 2526, "column": 3, "offset": 70549 }, + "end": { "line": 2526, "column": 20, "offset": 70566 } + } + } + ], + "position": { + "start": { "line": 2526, "column": 3, "offset": 70549 }, + "end": { "line": 2526, "column": 20, "offset": 70566 } + } + } + ], + "position": { + "start": { "line": 2526, "column": 1, "offset": 70547 }, + "end": { "line": 2526, "column": 20, "offset": 70566 } + } + } + ], + "position": { + "start": { "line": 2524, "column": 1, "offset": 70410 }, + "end": { "line": 2526, "column": 20, "offset": 70566 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Reads an unsigned, big-endian 64-bit integer from ", + "position": { + "start": { "line": 2528, "column": 1, "offset": 70568 }, + "end": { "line": 2528, "column": 51, "offset": 70618 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 2528, "column": 51, "offset": 70618 }, + "end": { "line": 2528, "column": 56, "offset": 70623 } + } + }, + { + "type": "text", + "value": " at the specified\n", + "position": { + "start": { "line": 2528, "column": 56, "offset": 70623 }, + "end": { "line": 2529, "column": 1, "offset": 70641 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 2529, "column": 1, "offset": 70641 }, + "end": { "line": 2529, "column": 9, "offset": 70649 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 2529, "column": 9, "offset": 70649 }, + "end": { "line": 2529, "column": 10, "offset": 70650 } + } + } + ], + "position": { + "start": { "line": 2528, "column": 1, "offset": 70568 }, + "end": { "line": 2529, "column": 10, "offset": 70650 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "This function is also available under the ", + "position": { + "start": { "line": 2531, "column": 1, "offset": 70652 }, + "end": { "line": 2531, "column": 43, "offset": 70694 } + } + }, + { + "type": "inlineCode", + "value": "readBigUint64BE", + "position": { + "start": { "line": 2531, "column": 43, "offset": 70694 }, + "end": { "line": 2531, "column": 60, "offset": 70711 } + } + }, + { + "type": "text", + "value": " alias.", + "position": { + "start": { "line": 2531, "column": 60, "offset": 70711 }, + "end": { "line": 2531, "column": 67, "offset": 70718 } + } + } + ], + "position": { + "start": { "line": 2531, "column": 1, "offset": 70652 }, + "end": { "line": 2531, "column": 67, "offset": 70718 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from([0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff]);\n\nconsole.log(buf.readBigUInt64BE(0));\n// Prints: 4294967295n", + "position": { + "start": { "line": 2533, "column": 1, "offset": 70720 }, + "end": { "line": 2540, "column": 4, "offset": 70905 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from([0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff]);\n\nconsole.log(buf.readBigUInt64BE(0));\n// Prints: 4294967295n", + "position": { + "start": { "line": 2542, "column": 1, "offset": 70907 }, + "end": { "line": 2549, "column": 4, "offset": 71097 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.readBigUInt64LE([offset])", + "position": { + "start": { "line": 2551, "column": 5, "offset": 71103 }, + "end": { "line": 2551, "column": 36, "offset": 71134 } + } + } + ], + "position": { + "start": { "line": 2551, "column": 1, "offset": 71099 }, + "end": { "line": 2551, "column": 36, "offset": 71134 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 2553, "column": 1, "offset": 71136 }, + "end": { "line": 2563, "column": 4, "offset": 71362 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 2565, "column": 3, "offset": 71366 }, + "end": { "line": 2565, "column": 11, "offset": 71374 } + } + }, + { + "type": "text", + "value": " {integer} Number of bytes to skip before starting to read. Must\nsatisfy: ", + "position": { + "start": { "line": 2565, "column": 11, "offset": 71374 }, + "end": { "line": 2566, "column": 12, "offset": 71450 } + } + }, + { + "type": "inlineCode", + "value": "0 <= offset <= buf.length - 8", + "position": { + "start": { "line": 2566, "column": 12, "offset": 71450 }, + "end": { "line": 2566, "column": 43, "offset": 71481 } + } + }, + { + "type": "text", + "value": ". ", + "position": { + "start": { "line": 2566, "column": 43, "offset": 71481 }, + "end": { "line": 2566, "column": 45, "offset": 71483 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { + "line": 2566, + "column": 47, + "offset": 71485 + }, + "end": { "line": 2566, "column": 55, "offset": 71493 } + } + } + ], + "position": { + "start": { "line": 2566, "column": 45, "offset": 71483 }, + "end": { "line": 2566, "column": 57, "offset": 71495 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 2566, "column": 57, "offset": 71495 }, + "end": { "line": 2566, "column": 58, "offset": 71496 } + } + }, + { + "type": "inlineCode", + "value": "0", + "position": { + "start": { "line": 2566, "column": 58, "offset": 71496 }, + "end": { "line": 2566, "column": 61, "offset": 71499 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 2566, "column": 61, "offset": 71499 }, + "end": { "line": 2566, "column": 62, "offset": 71500 } + } + } + ], + "position": { + "start": { "line": 2565, "column": 3, "offset": 71366 }, + "end": { "line": 2566, "column": 62, "offset": 71500 } + } + } + ], + "position": { + "start": { "line": 2565, "column": 1, "offset": 71364 }, + "end": { "line": 2566, "column": 62, "offset": 71500 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {bigint}", + "position": { + "start": { "line": 2567, "column": 3, "offset": 71503 }, + "end": { "line": 2567, "column": 20, "offset": 71520 } + } + } + ], + "position": { + "start": { "line": 2567, "column": 3, "offset": 71503 }, + "end": { "line": 2567, "column": 20, "offset": 71520 } + } + } + ], + "position": { + "start": { "line": 2567, "column": 1, "offset": 71501 }, + "end": { "line": 2567, "column": 20, "offset": 71520 } + } + } + ], + "position": { + "start": { "line": 2565, "column": 1, "offset": 71364 }, + "end": { "line": 2567, "column": 20, "offset": 71520 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Reads an unsigned, little-endian 64-bit integer from ", + "position": { + "start": { "line": 2569, "column": 1, "offset": 71522 }, + "end": { "line": 2569, "column": 54, "offset": 71575 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 2569, "column": 54, "offset": 71575 }, + "end": { "line": 2569, "column": 59, "offset": 71580 } + } + }, + { + "type": "text", + "value": " at the specified\n", + "position": { + "start": { "line": 2569, "column": 59, "offset": 71580 }, + "end": { "line": 2570, "column": 1, "offset": 71598 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 2570, "column": 1, "offset": 71598 }, + "end": { "line": 2570, "column": 9, "offset": 71606 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 2570, "column": 9, "offset": 71606 }, + "end": { "line": 2570, "column": 10, "offset": 71607 } + } + } + ], + "position": { + "start": { "line": 2569, "column": 1, "offset": 71522 }, + "end": { "line": 2570, "column": 10, "offset": 71607 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "This function is also available under the ", + "position": { + "start": { "line": 2572, "column": 1, "offset": 71609 }, + "end": { "line": 2572, "column": 43, "offset": 71651 } + } + }, + { + "type": "inlineCode", + "value": "readBigUint64LE", + "position": { + "start": { "line": 2572, "column": 43, "offset": 71651 }, + "end": { "line": 2572, "column": 60, "offset": 71668 } + } + }, + { + "type": "text", + "value": " alias.", + "position": { + "start": { "line": 2572, "column": 60, "offset": 71668 }, + "end": { "line": 2572, "column": 67, "offset": 71675 } + } + } + ], + "position": { + "start": { "line": 2572, "column": 1, "offset": 71609 }, + "end": { "line": 2572, "column": 67, "offset": 71675 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from([0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff]);\n\nconsole.log(buf.readBigUInt64LE(0));\n// Prints: 18446744069414584320n", + "position": { + "start": { "line": 2574, "column": 1, "offset": 71677 }, + "end": { "line": 2581, "column": 4, "offset": 71872 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from([0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff]);\n\nconsole.log(buf.readBigUInt64LE(0));\n// Prints: 18446744069414584320n", + "position": { + "start": { "line": 2583, "column": 1, "offset": 71874 }, + "end": { "line": 2590, "column": 4, "offset": 72074 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.readDoubleBE([offset])", + "position": { + "start": { "line": 2592, "column": 5, "offset": 72080 }, + "end": { "line": 2592, "column": 33, "offset": 72108 } + } + } + ], + "position": { + "start": { "line": 2592, "column": 1, "offset": 72076 }, + "end": { "line": 2592, "column": 33, "offset": 72108 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 2594, "column": 1, "offset": 72110 }, + "end": { "line": 2601, "column": 4, "offset": 72336 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 2603, "column": 3, "offset": 72340 }, + "end": { "line": 2603, "column": 11, "offset": 72348 } + } + }, + { + "type": "text", + "value": " {integer} Number of bytes to skip before starting to read. Must\nsatisfy ", + "position": { + "start": { "line": 2603, "column": 11, "offset": 72348 }, + "end": { "line": 2604, "column": 11, "offset": 72423 } + } + }, + { + "type": "inlineCode", + "value": "0 <= offset <= buf.length - 8", + "position": { + "start": { "line": 2604, "column": 11, "offset": 72423 }, + "end": { "line": 2604, "column": 42, "offset": 72454 } + } + }, + { + "type": "text", + "value": ". ", + "position": { + "start": { "line": 2604, "column": 42, "offset": 72454 }, + "end": { "line": 2604, "column": 44, "offset": 72456 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { + "line": 2604, + "column": 46, + "offset": 72458 + }, + "end": { "line": 2604, "column": 54, "offset": 72466 } + } + } + ], + "position": { + "start": { "line": 2604, "column": 44, "offset": 72456 }, + "end": { "line": 2604, "column": 56, "offset": 72468 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 2604, "column": 56, "offset": 72468 }, + "end": { "line": 2604, "column": 57, "offset": 72469 } + } + }, + { + "type": "inlineCode", + "value": "0", + "position": { + "start": { "line": 2604, "column": 57, "offset": 72469 }, + "end": { "line": 2604, "column": 60, "offset": 72472 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 2604, "column": 60, "offset": 72472 }, + "end": { "line": 2604, "column": 61, "offset": 72473 } + } + } + ], + "position": { + "start": { "line": 2603, "column": 3, "offset": 72340 }, + "end": { "line": 2604, "column": 61, "offset": 72473 } + } + } + ], + "position": { + "start": { "line": 2603, "column": 1, "offset": 72338 }, + "end": { "line": 2604, "column": 61, "offset": 72473 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {number}", + "position": { + "start": { "line": 2605, "column": 3, "offset": 72476 }, + "end": { "line": 2605, "column": 20, "offset": 72493 } + } + } + ], + "position": { + "start": { "line": 2605, "column": 3, "offset": 72476 }, + "end": { "line": 2605, "column": 20, "offset": 72493 } + } + } + ], + "position": { + "start": { "line": 2605, "column": 1, "offset": 72474 }, + "end": { "line": 2605, "column": 20, "offset": 72493 } + } + } + ], + "position": { + "start": { "line": 2603, "column": 1, "offset": 72338 }, + "end": { "line": 2605, "column": 20, "offset": 72493 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Reads a 64-bit, big-endian double from ", + "position": { + "start": { "line": 2607, "column": 1, "offset": 72495 }, + "end": { "line": 2607, "column": 40, "offset": 72534 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 2607, "column": 40, "offset": 72534 }, + "end": { "line": 2607, "column": 45, "offset": 72539 } + } + }, + { + "type": "text", + "value": " at the specified ", + "position": { + "start": { "line": 2607, "column": 45, "offset": 72539 }, + "end": { "line": 2607, "column": 63, "offset": 72557 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 2607, "column": 63, "offset": 72557 }, + "end": { "line": 2607, "column": 71, "offset": 72565 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 2607, "column": 71, "offset": 72565 }, + "end": { "line": 2607, "column": 72, "offset": 72566 } + } + } + ], + "position": { + "start": { "line": 2607, "column": 1, "offset": 72495 }, + "end": { "line": 2607, "column": 72, "offset": 72566 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8]);\n\nconsole.log(buf.readDoubleBE(0));\n// Prints: 8.20788039913184e-304", + "position": { + "start": { "line": 2609, "column": 1, "offset": 72568 }, + "end": { "line": 2616, "column": 4, "offset": 72736 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8]);\n\nconsole.log(buf.readDoubleBE(0));\n// Prints: 8.20788039913184e-304", + "position": { + "start": { "line": 2618, "column": 1, "offset": 72738 }, + "end": { "line": 2625, "column": 4, "offset": 72911 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.readDoubleLE([offset])", + "position": { + "start": { "line": 2627, "column": 5, "offset": 72917 }, + "end": { "line": 2627, "column": 33, "offset": 72945 } + } + } + ], + "position": { + "start": { "line": 2627, "column": 1, "offset": 72913 }, + "end": { "line": 2627, "column": 33, "offset": 72945 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 2629, "column": 1, "offset": 72947 }, + "end": { "line": 2636, "column": 4, "offset": 73173 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 2638, "column": 3, "offset": 73177 }, + "end": { "line": 2638, "column": 11, "offset": 73185 } + } + }, + { + "type": "text", + "value": " {integer} Number of bytes to skip before starting to read. Must\nsatisfy ", + "position": { + "start": { "line": 2638, "column": 11, "offset": 73185 }, + "end": { "line": 2639, "column": 11, "offset": 73260 } + } + }, + { + "type": "inlineCode", + "value": "0 <= offset <= buf.length - 8", + "position": { + "start": { "line": 2639, "column": 11, "offset": 73260 }, + "end": { "line": 2639, "column": 42, "offset": 73291 } + } + }, + { + "type": "text", + "value": ". ", + "position": { + "start": { "line": 2639, "column": 42, "offset": 73291 }, + "end": { "line": 2639, "column": 44, "offset": 73293 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { + "line": 2639, + "column": 46, + "offset": 73295 + }, + "end": { "line": 2639, "column": 54, "offset": 73303 } + } + } + ], + "position": { + "start": { "line": 2639, "column": 44, "offset": 73293 }, + "end": { "line": 2639, "column": 56, "offset": 73305 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 2639, "column": 56, "offset": 73305 }, + "end": { "line": 2639, "column": 57, "offset": 73306 } + } + }, + { + "type": "inlineCode", + "value": "0", + "position": { + "start": { "line": 2639, "column": 57, "offset": 73306 }, + "end": { "line": 2639, "column": 60, "offset": 73309 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 2639, "column": 60, "offset": 73309 }, + "end": { "line": 2639, "column": 61, "offset": 73310 } + } + } + ], + "position": { + "start": { "line": 2638, "column": 3, "offset": 73177 }, + "end": { "line": 2639, "column": 61, "offset": 73310 } + } + } + ], + "position": { + "start": { "line": 2638, "column": 1, "offset": 73175 }, + "end": { "line": 2639, "column": 61, "offset": 73310 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {number}", + "position": { + "start": { "line": 2640, "column": 3, "offset": 73313 }, + "end": { "line": 2640, "column": 20, "offset": 73330 } + } + } + ], + "position": { + "start": { "line": 2640, "column": 3, "offset": 73313 }, + "end": { "line": 2640, "column": 20, "offset": 73330 } + } + } + ], + "position": { + "start": { "line": 2640, "column": 1, "offset": 73311 }, + "end": { "line": 2640, "column": 20, "offset": 73330 } + } + } + ], + "position": { + "start": { "line": 2638, "column": 1, "offset": 73175 }, + "end": { "line": 2640, "column": 20, "offset": 73330 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Reads a 64-bit, little-endian double from ", + "position": { + "start": { "line": 2642, "column": 1, "offset": 73332 }, + "end": { "line": 2642, "column": 43, "offset": 73374 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 2642, "column": 43, "offset": 73374 }, + "end": { "line": 2642, "column": 48, "offset": 73379 } + } + }, + { + "type": "text", + "value": " at the specified ", + "position": { + "start": { "line": 2642, "column": 48, "offset": 73379 }, + "end": { "line": 2642, "column": 66, "offset": 73397 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 2642, "column": 66, "offset": 73397 }, + "end": { "line": 2642, "column": 74, "offset": 73405 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 2642, "column": 74, "offset": 73405 }, + "end": { "line": 2642, "column": 75, "offset": 73406 } + } + } + ], + "position": { + "start": { "line": 2642, "column": 1, "offset": 73332 }, + "end": { "line": 2642, "column": 75, "offset": 73406 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8]);\n\nconsole.log(buf.readDoubleLE(0));\n// Prints: 5.447603722011605e-270\nconsole.log(buf.readDoubleLE(1));\n// Throws ERR_OUT_OF_RANGE.", + "position": { + "start": { "line": 2644, "column": 1, "offset": 73408 }, + "end": { "line": 2653, "column": 4, "offset": 73639 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8]);\n\nconsole.log(buf.readDoubleLE(0));\n// Prints: 5.447603722011605e-270\nconsole.log(buf.readDoubleLE(1));\n// Throws ERR_OUT_OF_RANGE.", + "position": { + "start": { "line": 2655, "column": 1, "offset": 73641 }, + "end": { "line": 2664, "column": 4, "offset": 73877 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.readFloatBE([offset])", + "position": { + "start": { "line": 2666, "column": 5, "offset": 73883 }, + "end": { "line": 2666, "column": 32, "offset": 73910 } + } + } + ], + "position": { + "start": { "line": 2666, "column": 1, "offset": 73879 }, + "end": { "line": 2666, "column": 32, "offset": 73910 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 2668, "column": 1, "offset": 73912 }, + "end": { "line": 2675, "column": 4, "offset": 74138 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 2677, "column": 3, "offset": 74142 }, + "end": { "line": 2677, "column": 11, "offset": 74150 } + } + }, + { + "type": "text", + "value": " {integer} Number of bytes to skip before starting to read. Must\nsatisfy ", + "position": { + "start": { "line": 2677, "column": 11, "offset": 74150 }, + "end": { "line": 2678, "column": 11, "offset": 74225 } + } + }, + { + "type": "inlineCode", + "value": "0 <= offset <= buf.length - 4", + "position": { + "start": { "line": 2678, "column": 11, "offset": 74225 }, + "end": { "line": 2678, "column": 42, "offset": 74256 } + } + }, + { + "type": "text", + "value": ". ", + "position": { + "start": { "line": 2678, "column": 42, "offset": 74256 }, + "end": { "line": 2678, "column": 44, "offset": 74258 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { + "line": 2678, + "column": 46, + "offset": 74260 + }, + "end": { "line": 2678, "column": 54, "offset": 74268 } + } + } + ], + "position": { + "start": { "line": 2678, "column": 44, "offset": 74258 }, + "end": { "line": 2678, "column": 56, "offset": 74270 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 2678, "column": 56, "offset": 74270 }, + "end": { "line": 2678, "column": 57, "offset": 74271 } + } + }, + { + "type": "inlineCode", + "value": "0", + "position": { + "start": { "line": 2678, "column": 57, "offset": 74271 }, + "end": { "line": 2678, "column": 60, "offset": 74274 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 2678, "column": 60, "offset": 74274 }, + "end": { "line": 2678, "column": 61, "offset": 74275 } + } + } + ], + "position": { + "start": { "line": 2677, "column": 3, "offset": 74142 }, + "end": { "line": 2678, "column": 61, "offset": 74275 } + } + } + ], + "position": { + "start": { "line": 2677, "column": 1, "offset": 74140 }, + "end": { "line": 2678, "column": 61, "offset": 74275 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {number}", + "position": { + "start": { "line": 2679, "column": 3, "offset": 74278 }, + "end": { "line": 2679, "column": 20, "offset": 74295 } + } + } + ], + "position": { + "start": { "line": 2679, "column": 3, "offset": 74278 }, + "end": { "line": 2679, "column": 20, "offset": 74295 } + } + } + ], + "position": { + "start": { "line": 2679, "column": 1, "offset": 74276 }, + "end": { "line": 2679, "column": 20, "offset": 74295 } + } + } + ], + "position": { + "start": { "line": 2677, "column": 1, "offset": 74140 }, + "end": { "line": 2679, "column": 20, "offset": 74295 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Reads a 32-bit, big-endian float from ", + "position": { + "start": { "line": 2681, "column": 1, "offset": 74297 }, + "end": { "line": 2681, "column": 39, "offset": 74335 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 2681, "column": 39, "offset": 74335 }, + "end": { "line": 2681, "column": 44, "offset": 74340 } + } + }, + { + "type": "text", + "value": " at the specified ", + "position": { + "start": { "line": 2681, "column": 44, "offset": 74340 }, + "end": { "line": 2681, "column": 62, "offset": 74358 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 2681, "column": 62, "offset": 74358 }, + "end": { "line": 2681, "column": 70, "offset": 74366 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 2681, "column": 70, "offset": 74366 }, + "end": { "line": 2681, "column": 71, "offset": 74367 } + } + } + ], + "position": { + "start": { "line": 2681, "column": 1, "offset": 74297 }, + "end": { "line": 2681, "column": 71, "offset": 74367 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from([1, 2, 3, 4]);\n\nconsole.log(buf.readFloatBE(0));\n// Prints: 2.387939260590663e-38", + "position": { + "start": { "line": 2683, "column": 1, "offset": 74369 }, + "end": { "line": 2690, "column": 4, "offset": 74524 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from([1, 2, 3, 4]);\n\nconsole.log(buf.readFloatBE(0));\n// Prints: 2.387939260590663e-38", + "position": { + "start": { "line": 2692, "column": 1, "offset": 74526 }, + "end": { "line": 2699, "column": 4, "offset": 74686 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.readFloatLE([offset])", + "position": { + "start": { "line": 2701, "column": 5, "offset": 74692 }, + "end": { "line": 2701, "column": 32, "offset": 74719 } + } + } + ], + "position": { + "start": { "line": 2701, "column": 1, "offset": 74688 }, + "end": { "line": 2701, "column": 32, "offset": 74719 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 2703, "column": 1, "offset": 74721 }, + "end": { "line": 2710, "column": 4, "offset": 74947 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 2712, "column": 3, "offset": 74951 }, + "end": { "line": 2712, "column": 11, "offset": 74959 } + } + }, + { + "type": "text", + "value": " {integer} Number of bytes to skip before starting to read. Must\nsatisfy ", + "position": { + "start": { "line": 2712, "column": 11, "offset": 74959 }, + "end": { "line": 2713, "column": 11, "offset": 75034 } + } + }, + { + "type": "inlineCode", + "value": "0 <= offset <= buf.length - 4", + "position": { + "start": { "line": 2713, "column": 11, "offset": 75034 }, + "end": { "line": 2713, "column": 42, "offset": 75065 } + } + }, + { + "type": "text", + "value": ". ", + "position": { + "start": { "line": 2713, "column": 42, "offset": 75065 }, + "end": { "line": 2713, "column": 44, "offset": 75067 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { + "line": 2713, + "column": 46, + "offset": 75069 + }, + "end": { "line": 2713, "column": 54, "offset": 75077 } + } + } + ], + "position": { + "start": { "line": 2713, "column": 44, "offset": 75067 }, + "end": { "line": 2713, "column": 56, "offset": 75079 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 2713, "column": 56, "offset": 75079 }, + "end": { "line": 2713, "column": 57, "offset": 75080 } + } + }, + { + "type": "inlineCode", + "value": "0", + "position": { + "start": { "line": 2713, "column": 57, "offset": 75080 }, + "end": { "line": 2713, "column": 60, "offset": 75083 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 2713, "column": 60, "offset": 75083 }, + "end": { "line": 2713, "column": 61, "offset": 75084 } + } + } + ], + "position": { + "start": { "line": 2712, "column": 3, "offset": 74951 }, + "end": { "line": 2713, "column": 61, "offset": 75084 } + } + } + ], + "position": { + "start": { "line": 2712, "column": 1, "offset": 74949 }, + "end": { "line": 2713, "column": 61, "offset": 75084 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {number}", + "position": { + "start": { "line": 2714, "column": 3, "offset": 75087 }, + "end": { "line": 2714, "column": 20, "offset": 75104 } + } + } + ], + "position": { + "start": { "line": 2714, "column": 3, "offset": 75087 }, + "end": { "line": 2714, "column": 20, "offset": 75104 } + } + } + ], + "position": { + "start": { "line": 2714, "column": 1, "offset": 75085 }, + "end": { "line": 2714, "column": 20, "offset": 75104 } + } + } + ], + "position": { + "start": { "line": 2712, "column": 1, "offset": 74949 }, + "end": { "line": 2714, "column": 20, "offset": 75104 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Reads a 32-bit, little-endian float from ", + "position": { + "start": { "line": 2716, "column": 1, "offset": 75106 }, + "end": { "line": 2716, "column": 42, "offset": 75147 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 2716, "column": 42, "offset": 75147 }, + "end": { "line": 2716, "column": 47, "offset": 75152 } + } + }, + { + "type": "text", + "value": " at the specified ", + "position": { + "start": { "line": 2716, "column": 47, "offset": 75152 }, + "end": { "line": 2716, "column": 65, "offset": 75170 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 2716, "column": 65, "offset": 75170 }, + "end": { "line": 2716, "column": 73, "offset": 75178 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 2716, "column": 73, "offset": 75178 }, + "end": { "line": 2716, "column": 74, "offset": 75179 } + } + } + ], + "position": { + "start": { "line": 2716, "column": 1, "offset": 75106 }, + "end": { "line": 2716, "column": 74, "offset": 75179 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from([1, 2, 3, 4]);\n\nconsole.log(buf.readFloatLE(0));\n// Prints: 1.539989614439558e-36\nconsole.log(buf.readFloatLE(1));\n// Throws ERR_OUT_OF_RANGE.", + "position": { + "start": { "line": 2718, "column": 1, "offset": 75181 }, + "end": { "line": 2727, "column": 4, "offset": 75397 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from([1, 2, 3, 4]);\n\nconsole.log(buf.readFloatLE(0));\n// Prints: 1.539989614439558e-36\nconsole.log(buf.readFloatLE(1));\n// Throws ERR_OUT_OF_RANGE.", + "position": { + "start": { "line": 2729, "column": 1, "offset": 75399 }, + "end": { "line": 2738, "column": 4, "offset": 75620 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.readInt8([offset])", + "position": { + "start": { "line": 2740, "column": 5, "offset": 75626 }, + "end": { "line": 2740, "column": 29, "offset": 75650 } + } + } + ], + "position": { + "start": { "line": 2740, "column": 1, "offset": 75622 }, + "end": { "line": 2740, "column": 29, "offset": 75650 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 2742, "column": 1, "offset": 75652 }, + "end": { "line": 2749, "column": 4, "offset": 75876 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 2751, "column": 3, "offset": 75880 }, + "end": { "line": 2751, "column": 11, "offset": 75888 } + } + }, + { + "type": "text", + "value": " {integer} Number of bytes to skip before starting to read. Must\nsatisfy ", + "position": { + "start": { "line": 2751, "column": 11, "offset": 75888 }, + "end": { "line": 2752, "column": 11, "offset": 75963 } + } + }, + { + "type": "inlineCode", + "value": "0 <= offset <= buf.length - 1", + "position": { + "start": { "line": 2752, "column": 11, "offset": 75963 }, + "end": { "line": 2752, "column": 42, "offset": 75994 } + } + }, + { + "type": "text", + "value": ". ", + "position": { + "start": { "line": 2752, "column": 42, "offset": 75994 }, + "end": { "line": 2752, "column": 44, "offset": 75996 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { + "line": 2752, + "column": 46, + "offset": 75998 + }, + "end": { "line": 2752, "column": 54, "offset": 76006 } + } + } + ], + "position": { + "start": { "line": 2752, "column": 44, "offset": 75996 }, + "end": { "line": 2752, "column": 56, "offset": 76008 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 2752, "column": 56, "offset": 76008 }, + "end": { "line": 2752, "column": 57, "offset": 76009 } + } + }, + { + "type": "inlineCode", + "value": "0", + "position": { + "start": { "line": 2752, "column": 57, "offset": 76009 }, + "end": { "line": 2752, "column": 60, "offset": 76012 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 2752, "column": 60, "offset": 76012 }, + "end": { "line": 2752, "column": 61, "offset": 76013 } + } + } + ], + "position": { + "start": { "line": 2751, "column": 3, "offset": 75880 }, + "end": { "line": 2752, "column": 61, "offset": 76013 } + } + } + ], + "position": { + "start": { "line": 2751, "column": 1, "offset": 75878 }, + "end": { "line": 2752, "column": 61, "offset": 76013 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {integer}", + "position": { + "start": { "line": 2753, "column": 3, "offset": 76016 }, + "end": { "line": 2753, "column": 21, "offset": 76034 } + } + } + ], + "position": { + "start": { "line": 2753, "column": 3, "offset": 76016 }, + "end": { "line": 2753, "column": 21, "offset": 76034 } + } + } + ], + "position": { + "start": { "line": 2753, "column": 1, "offset": 76014 }, + "end": { "line": 2753, "column": 21, "offset": 76034 } + } + } + ], + "position": { + "start": { "line": 2751, "column": 1, "offset": 75878 }, + "end": { "line": 2753, "column": 21, "offset": 76034 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Reads a signed 8-bit integer from ", + "position": { + "start": { "line": 2755, "column": 1, "offset": 76036 }, + "end": { "line": 2755, "column": 35, "offset": 76070 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 2755, "column": 35, "offset": 76070 }, + "end": { "line": 2755, "column": 40, "offset": 76075 } + } + }, + { + "type": "text", + "value": " at the specified ", + "position": { + "start": { "line": 2755, "column": 40, "offset": 76075 }, + "end": { "line": 2755, "column": 58, "offset": 76093 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 2755, "column": 58, "offset": 76093 }, + "end": { "line": 2755, "column": 66, "offset": 76101 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 2755, "column": 66, "offset": 76101 }, + "end": { "line": 2755, "column": 67, "offset": 76102 } + } + } + ], + "position": { + "start": { "line": 2755, "column": 1, "offset": 76036 }, + "end": { "line": 2755, "column": 67, "offset": 76102 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Integers read from a ", + "position": { + "start": { "line": 2757, "column": 1, "offset": 76104 }, + "end": { "line": 2757, "column": 22, "offset": 76125 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 2757, "column": 22, "offset": 76125 }, + "end": { "line": 2757, "column": 30, "offset": 76133 } + } + }, + { + "type": "text", + "value": " are interpreted as two's complement signed values.", + "position": { + "start": { "line": 2757, "column": 30, "offset": 76133 }, + "end": { "line": 2757, "column": 81, "offset": 76184 } + } + } + ], + "position": { + "start": { "line": 2757, "column": 1, "offset": 76104 }, + "end": { "line": 2757, "column": 81, "offset": 76184 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from([-1, 5]);\n\nconsole.log(buf.readInt8(0));\n// Prints: -1\nconsole.log(buf.readInt8(1));\n// Prints: 5\nconsole.log(buf.readInt8(2));\n// Throws ERR_OUT_OF_RANGE.", + "position": { + "start": { "line": 2759, "column": 1, "offset": 76186 }, + "end": { "line": 2770, "column": 4, "offset": 76415 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from([-1, 5]);\n\nconsole.log(buf.readInt8(0));\n// Prints: -1\nconsole.log(buf.readInt8(1));\n// Prints: 5\nconsole.log(buf.readInt8(2));\n// Throws ERR_OUT_OF_RANGE.", + "position": { + "start": { "line": 2772, "column": 1, "offset": 76417 }, + "end": { "line": 2783, "column": 4, "offset": 76651 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.readInt16BE([offset])", + "position": { + "start": { "line": 2785, "column": 5, "offset": 76657 }, + "end": { "line": 2785, "column": 32, "offset": 76684 } + } + } + ], + "position": { + "start": { "line": 2785, "column": 1, "offset": 76653 }, + "end": { "line": 2785, "column": 32, "offset": 76684 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 2787, "column": 1, "offset": 76686 }, + "end": { "line": 2794, "column": 4, "offset": 76910 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 2796, "column": 3, "offset": 76914 }, + "end": { "line": 2796, "column": 11, "offset": 76922 } + } + }, + { + "type": "text", + "value": " {integer} Number of bytes to skip before starting to read. Must\nsatisfy ", + "position": { + "start": { "line": 2796, "column": 11, "offset": 76922 }, + "end": { "line": 2797, "column": 11, "offset": 76997 } + } + }, + { + "type": "inlineCode", + "value": "0 <= offset <= buf.length - 2", + "position": { + "start": { "line": 2797, "column": 11, "offset": 76997 }, + "end": { "line": 2797, "column": 42, "offset": 77028 } + } + }, + { + "type": "text", + "value": ". ", + "position": { + "start": { "line": 2797, "column": 42, "offset": 77028 }, + "end": { "line": 2797, "column": 44, "offset": 77030 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { + "line": 2797, + "column": 46, + "offset": 77032 + }, + "end": { "line": 2797, "column": 54, "offset": 77040 } + } + } + ], + "position": { + "start": { "line": 2797, "column": 44, "offset": 77030 }, + "end": { "line": 2797, "column": 56, "offset": 77042 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 2797, "column": 56, "offset": 77042 }, + "end": { "line": 2797, "column": 57, "offset": 77043 } + } + }, + { + "type": "inlineCode", + "value": "0", + "position": { + "start": { "line": 2797, "column": 57, "offset": 77043 }, + "end": { "line": 2797, "column": 60, "offset": 77046 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 2797, "column": 60, "offset": 77046 }, + "end": { "line": 2797, "column": 61, "offset": 77047 } + } + } + ], + "position": { + "start": { "line": 2796, "column": 3, "offset": 76914 }, + "end": { "line": 2797, "column": 61, "offset": 77047 } + } + } + ], + "position": { + "start": { "line": 2796, "column": 1, "offset": 76912 }, + "end": { "line": 2797, "column": 61, "offset": 77047 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {integer}", + "position": { + "start": { "line": 2798, "column": 3, "offset": 77050 }, + "end": { "line": 2798, "column": 21, "offset": 77068 } + } + } + ], + "position": { + "start": { "line": 2798, "column": 3, "offset": 77050 }, + "end": { "line": 2798, "column": 21, "offset": 77068 } + } + } + ], + "position": { + "start": { "line": 2798, "column": 1, "offset": 77048 }, + "end": { "line": 2798, "column": 21, "offset": 77068 } + } + } + ], + "position": { + "start": { "line": 2796, "column": 1, "offset": 76912 }, + "end": { "line": 2798, "column": 21, "offset": 77068 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Reads a signed, big-endian 16-bit integer from ", + "position": { + "start": { "line": 2800, "column": 1, "offset": 77070 }, + "end": { "line": 2800, "column": 48, "offset": 77117 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 2800, "column": 48, "offset": 77117 }, + "end": { "line": 2800, "column": 53, "offset": 77122 } + } + }, + { + "type": "text", + "value": " at the specified ", + "position": { + "start": { "line": 2800, "column": 53, "offset": 77122 }, + "end": { "line": 2800, "column": 71, "offset": 77140 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 2800, "column": 71, "offset": 77140 }, + "end": { "line": 2800, "column": 79, "offset": 77148 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 2800, "column": 79, "offset": 77148 }, + "end": { "line": 2800, "column": 80, "offset": 77149 } + } + } + ], + "position": { + "start": { "line": 2800, "column": 1, "offset": 77070 }, + "end": { "line": 2800, "column": 80, "offset": 77149 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Integers read from a ", + "position": { + "start": { "line": 2802, "column": 1, "offset": 77151 }, + "end": { "line": 2802, "column": 22, "offset": 77172 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 2802, "column": 22, "offset": 77172 }, + "end": { "line": 2802, "column": 30, "offset": 77180 } + } + }, + { + "type": "text", + "value": " are interpreted as two's complement signed values.", + "position": { + "start": { "line": 2802, "column": 30, "offset": 77180 }, + "end": { "line": 2802, "column": 81, "offset": 77231 } + } + } + ], + "position": { + "start": { "line": 2802, "column": 1, "offset": 77151 }, + "end": { "line": 2802, "column": 81, "offset": 77231 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from([0, 5]);\n\nconsole.log(buf.readInt16BE(0));\n// Prints: 5", + "position": { + "start": { "line": 2804, "column": 1, "offset": 77233 }, + "end": { "line": 2811, "column": 4, "offset": 77362 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from([0, 5]);\n\nconsole.log(buf.readInt16BE(0));\n// Prints: 5", + "position": { + "start": { "line": 2813, "column": 1, "offset": 77364 }, + "end": { "line": 2820, "column": 4, "offset": 77498 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.readInt16LE([offset])", + "position": { + "start": { "line": 2822, "column": 5, "offset": 77504 }, + "end": { "line": 2822, "column": 32, "offset": 77531 } + } + } + ], + "position": { + "start": { "line": 2822, "column": 1, "offset": 77500 }, + "end": { "line": 2822, "column": 32, "offset": 77531 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 2824, "column": 1, "offset": 77533 }, + "end": { "line": 2831, "column": 4, "offset": 77757 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 2833, "column": 3, "offset": 77761 }, + "end": { "line": 2833, "column": 11, "offset": 77769 } + } + }, + { + "type": "text", + "value": " {integer} Number of bytes to skip before starting to read. Must\nsatisfy ", + "position": { + "start": { "line": 2833, "column": 11, "offset": 77769 }, + "end": { "line": 2834, "column": 11, "offset": 77844 } + } + }, + { + "type": "inlineCode", + "value": "0 <= offset <= buf.length - 2", + "position": { + "start": { "line": 2834, "column": 11, "offset": 77844 }, + "end": { "line": 2834, "column": 42, "offset": 77875 } + } + }, + { + "type": "text", + "value": ". ", + "position": { + "start": { "line": 2834, "column": 42, "offset": 77875 }, + "end": { "line": 2834, "column": 44, "offset": 77877 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { + "line": 2834, + "column": 46, + "offset": 77879 + }, + "end": { "line": 2834, "column": 54, "offset": 77887 } + } + } + ], + "position": { + "start": { "line": 2834, "column": 44, "offset": 77877 }, + "end": { "line": 2834, "column": 56, "offset": 77889 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 2834, "column": 56, "offset": 77889 }, + "end": { "line": 2834, "column": 57, "offset": 77890 } + } + }, + { + "type": "inlineCode", + "value": "0", + "position": { + "start": { "line": 2834, "column": 57, "offset": 77890 }, + "end": { "line": 2834, "column": 60, "offset": 77893 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 2834, "column": 60, "offset": 77893 }, + "end": { "line": 2834, "column": 61, "offset": 77894 } + } + } + ], + "position": { + "start": { "line": 2833, "column": 3, "offset": 77761 }, + "end": { "line": 2834, "column": 61, "offset": 77894 } + } + } + ], + "position": { + "start": { "line": 2833, "column": 1, "offset": 77759 }, + "end": { "line": 2834, "column": 61, "offset": 77894 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {integer}", + "position": { + "start": { "line": 2835, "column": 3, "offset": 77897 }, + "end": { "line": 2835, "column": 21, "offset": 77915 } + } + } + ], + "position": { + "start": { "line": 2835, "column": 3, "offset": 77897 }, + "end": { "line": 2835, "column": 21, "offset": 77915 } + } + } + ], + "position": { + "start": { "line": 2835, "column": 1, "offset": 77895 }, + "end": { "line": 2835, "column": 21, "offset": 77915 } + } + } + ], + "position": { + "start": { "line": 2833, "column": 1, "offset": 77759 }, + "end": { "line": 2835, "column": 21, "offset": 77915 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Reads a signed, little-endian 16-bit integer from ", + "position": { + "start": { "line": 2837, "column": 1, "offset": 77917 }, + "end": { "line": 2837, "column": 51, "offset": 77967 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 2837, "column": 51, "offset": 77967 }, + "end": { "line": 2837, "column": 56, "offset": 77972 } + } + }, + { + "type": "text", + "value": " at the specified\n", + "position": { + "start": { "line": 2837, "column": 56, "offset": 77972 }, + "end": { "line": 2838, "column": 1, "offset": 77990 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 2838, "column": 1, "offset": 77990 }, + "end": { "line": 2838, "column": 9, "offset": 77998 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 2838, "column": 9, "offset": 77998 }, + "end": { "line": 2838, "column": 10, "offset": 77999 } + } + } + ], + "position": { + "start": { "line": 2837, "column": 1, "offset": 77917 }, + "end": { "line": 2838, "column": 10, "offset": 77999 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Integers read from a ", + "position": { + "start": { "line": 2840, "column": 1, "offset": 78001 }, + "end": { "line": 2840, "column": 22, "offset": 78022 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 2840, "column": 22, "offset": 78022 }, + "end": { "line": 2840, "column": 30, "offset": 78030 } + } + }, + { + "type": "text", + "value": " are interpreted as two's complement signed values.", + "position": { + "start": { "line": 2840, "column": 30, "offset": 78030 }, + "end": { "line": 2840, "column": 81, "offset": 78081 } + } + } + ], + "position": { + "start": { "line": 2840, "column": 1, "offset": 78001 }, + "end": { "line": 2840, "column": 81, "offset": 78081 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from([0, 5]);\n\nconsole.log(buf.readInt16LE(0));\n// Prints: 1280\nconsole.log(buf.readInt16LE(1));\n// Throws ERR_OUT_OF_RANGE.", + "position": { + "start": { "line": 2842, "column": 1, "offset": 78083 }, + "end": { "line": 2851, "column": 4, "offset": 78276 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from([0, 5]);\n\nconsole.log(buf.readInt16LE(0));\n// Prints: 1280\nconsole.log(buf.readInt16LE(1));\n// Throws ERR_OUT_OF_RANGE.", + "position": { + "start": { "line": 2853, "column": 1, "offset": 78278 }, + "end": { "line": 2862, "column": 4, "offset": 78476 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.readInt32BE([offset])", + "position": { + "start": { "line": 2864, "column": 5, "offset": 78482 }, + "end": { "line": 2864, "column": 32, "offset": 78509 } + } + } + ], + "position": { + "start": { "line": 2864, "column": 1, "offset": 78478 }, + "end": { "line": 2864, "column": 32, "offset": 78509 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 2866, "column": 1, "offset": 78511 }, + "end": { "line": 2873, "column": 4, "offset": 78735 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 2875, "column": 3, "offset": 78739 }, + "end": { "line": 2875, "column": 11, "offset": 78747 } + } + }, + { + "type": "text", + "value": " {integer} Number of bytes to skip before starting to read. Must\nsatisfy ", + "position": { + "start": { "line": 2875, "column": 11, "offset": 78747 }, + "end": { "line": 2876, "column": 11, "offset": 78822 } + } + }, + { + "type": "inlineCode", + "value": "0 <= offset <= buf.length - 4", + "position": { + "start": { "line": 2876, "column": 11, "offset": 78822 }, + "end": { "line": 2876, "column": 42, "offset": 78853 } + } + }, + { + "type": "text", + "value": ". ", + "position": { + "start": { "line": 2876, "column": 42, "offset": 78853 }, + "end": { "line": 2876, "column": 44, "offset": 78855 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { + "line": 2876, + "column": 46, + "offset": 78857 + }, + "end": { "line": 2876, "column": 54, "offset": 78865 } + } + } + ], + "position": { + "start": { "line": 2876, "column": 44, "offset": 78855 }, + "end": { "line": 2876, "column": 56, "offset": 78867 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 2876, "column": 56, "offset": 78867 }, + "end": { "line": 2876, "column": 57, "offset": 78868 } + } + }, + { + "type": "inlineCode", + "value": "0", + "position": { + "start": { "line": 2876, "column": 57, "offset": 78868 }, + "end": { "line": 2876, "column": 60, "offset": 78871 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 2876, "column": 60, "offset": 78871 }, + "end": { "line": 2876, "column": 61, "offset": 78872 } + } + } + ], + "position": { + "start": { "line": 2875, "column": 3, "offset": 78739 }, + "end": { "line": 2876, "column": 61, "offset": 78872 } + } + } + ], + "position": { + "start": { "line": 2875, "column": 1, "offset": 78737 }, + "end": { "line": 2876, "column": 61, "offset": 78872 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {integer}", + "position": { + "start": { "line": 2877, "column": 3, "offset": 78875 }, + "end": { "line": 2877, "column": 21, "offset": 78893 } + } + } + ], + "position": { + "start": { "line": 2877, "column": 3, "offset": 78875 }, + "end": { "line": 2877, "column": 21, "offset": 78893 } + } + } + ], + "position": { + "start": { "line": 2877, "column": 1, "offset": 78873 }, + "end": { "line": 2877, "column": 21, "offset": 78893 } + } + } + ], + "position": { + "start": { "line": 2875, "column": 1, "offset": 78737 }, + "end": { "line": 2877, "column": 21, "offset": 78893 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Reads a signed, big-endian 32-bit integer from ", + "position": { + "start": { "line": 2879, "column": 1, "offset": 78895 }, + "end": { "line": 2879, "column": 48, "offset": 78942 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 2879, "column": 48, "offset": 78942 }, + "end": { "line": 2879, "column": 53, "offset": 78947 } + } + }, + { + "type": "text", + "value": " at the specified ", + "position": { + "start": { "line": 2879, "column": 53, "offset": 78947 }, + "end": { "line": 2879, "column": 71, "offset": 78965 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 2879, "column": 71, "offset": 78965 }, + "end": { "line": 2879, "column": 79, "offset": 78973 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 2879, "column": 79, "offset": 78973 }, + "end": { "line": 2879, "column": 80, "offset": 78974 } + } + } + ], + "position": { + "start": { "line": 2879, "column": 1, "offset": 78895 }, + "end": { "line": 2879, "column": 80, "offset": 78974 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Integers read from a ", + "position": { + "start": { "line": 2881, "column": 1, "offset": 78976 }, + "end": { "line": 2881, "column": 22, "offset": 78997 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 2881, "column": 22, "offset": 78997 }, + "end": { "line": 2881, "column": 30, "offset": 79005 } + } + }, + { + "type": "text", + "value": " are interpreted as two's complement signed values.", + "position": { + "start": { "line": 2881, "column": 30, "offset": 79005 }, + "end": { "line": 2881, "column": 81, "offset": 79056 } + } + } + ], + "position": { + "start": { "line": 2881, "column": 1, "offset": 78976 }, + "end": { "line": 2881, "column": 81, "offset": 79056 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from([0, 0, 0, 5]);\n\nconsole.log(buf.readInt32BE(0));\n// Prints: 5", + "position": { + "start": { "line": 2883, "column": 1, "offset": 79058 }, + "end": { "line": 2890, "column": 4, "offset": 79193 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from([0, 0, 0, 5]);\n\nconsole.log(buf.readInt32BE(0));\n// Prints: 5", + "position": { + "start": { "line": 2892, "column": 1, "offset": 79195 }, + "end": { "line": 2899, "column": 4, "offset": 79335 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.readInt32LE([offset])", + "position": { + "start": { "line": 2901, "column": 5, "offset": 79341 }, + "end": { "line": 2901, "column": 32, "offset": 79368 } + } + } + ], + "position": { + "start": { "line": 2901, "column": 1, "offset": 79337 }, + "end": { "line": 2901, "column": 32, "offset": 79368 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 2903, "column": 1, "offset": 79370 }, + "end": { "line": 2910, "column": 4, "offset": 79594 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 2912, "column": 3, "offset": 79598 }, + "end": { "line": 2912, "column": 11, "offset": 79606 } + } + }, + { + "type": "text", + "value": " {integer} Number of bytes to skip before starting to read. Must\nsatisfy ", + "position": { + "start": { "line": 2912, "column": 11, "offset": 79606 }, + "end": { "line": 2913, "column": 11, "offset": 79681 } + } + }, + { + "type": "inlineCode", + "value": "0 <= offset <= buf.length - 4", + "position": { + "start": { "line": 2913, "column": 11, "offset": 79681 }, + "end": { "line": 2913, "column": 42, "offset": 79712 } + } + }, + { + "type": "text", + "value": ". ", + "position": { + "start": { "line": 2913, "column": 42, "offset": 79712 }, + "end": { "line": 2913, "column": 44, "offset": 79714 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { + "line": 2913, + "column": 46, + "offset": 79716 + }, + "end": { "line": 2913, "column": 54, "offset": 79724 } + } + } + ], + "position": { + "start": { "line": 2913, "column": 44, "offset": 79714 }, + "end": { "line": 2913, "column": 56, "offset": 79726 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 2913, "column": 56, "offset": 79726 }, + "end": { "line": 2913, "column": 57, "offset": 79727 } + } + }, + { + "type": "inlineCode", + "value": "0", + "position": { + "start": { "line": 2913, "column": 57, "offset": 79727 }, + "end": { "line": 2913, "column": 60, "offset": 79730 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 2913, "column": 60, "offset": 79730 }, + "end": { "line": 2913, "column": 61, "offset": 79731 } + } + } + ], + "position": { + "start": { "line": 2912, "column": 3, "offset": 79598 }, + "end": { "line": 2913, "column": 61, "offset": 79731 } + } + } + ], + "position": { + "start": { "line": 2912, "column": 1, "offset": 79596 }, + "end": { "line": 2913, "column": 61, "offset": 79731 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {integer}", + "position": { + "start": { "line": 2914, "column": 3, "offset": 79734 }, + "end": { "line": 2914, "column": 21, "offset": 79752 } + } + } + ], + "position": { + "start": { "line": 2914, "column": 3, "offset": 79734 }, + "end": { "line": 2914, "column": 21, "offset": 79752 } + } + } + ], + "position": { + "start": { "line": 2914, "column": 1, "offset": 79732 }, + "end": { "line": 2914, "column": 21, "offset": 79752 } + } + } + ], + "position": { + "start": { "line": 2912, "column": 1, "offset": 79596 }, + "end": { "line": 2914, "column": 21, "offset": 79752 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Reads a signed, little-endian 32-bit integer from ", + "position": { + "start": { "line": 2916, "column": 1, "offset": 79754 }, + "end": { "line": 2916, "column": 51, "offset": 79804 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 2916, "column": 51, "offset": 79804 }, + "end": { "line": 2916, "column": 56, "offset": 79809 } + } + }, + { + "type": "text", + "value": " at the specified\n", + "position": { + "start": { "line": 2916, "column": 56, "offset": 79809 }, + "end": { "line": 2917, "column": 1, "offset": 79827 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 2917, "column": 1, "offset": 79827 }, + "end": { "line": 2917, "column": 9, "offset": 79835 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 2917, "column": 9, "offset": 79835 }, + "end": { "line": 2917, "column": 10, "offset": 79836 } + } + } + ], + "position": { + "start": { "line": 2916, "column": 1, "offset": 79754 }, + "end": { "line": 2917, "column": 10, "offset": 79836 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Integers read from a ", + "position": { + "start": { "line": 2919, "column": 1, "offset": 79838 }, + "end": { "line": 2919, "column": 22, "offset": 79859 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 2919, "column": 22, "offset": 79859 }, + "end": { "line": 2919, "column": 30, "offset": 79867 } + } + }, + { + "type": "text", + "value": " are interpreted as two's complement signed values.", + "position": { + "start": { "line": 2919, "column": 30, "offset": 79867 }, + "end": { "line": 2919, "column": 81, "offset": 79918 } + } + } + ], + "position": { + "start": { "line": 2919, "column": 1, "offset": 79838 }, + "end": { "line": 2919, "column": 81, "offset": 79918 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from([0, 0, 0, 5]);\n\nconsole.log(buf.readInt32LE(0));\n// Prints: 83886080\nconsole.log(buf.readInt32LE(1));\n// Throws ERR_OUT_OF_RANGE.", + "position": { + "start": { "line": 2921, "column": 1, "offset": 79920 }, + "end": { "line": 2930, "column": 4, "offset": 80123 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from([0, 0, 0, 5]);\n\nconsole.log(buf.readInt32LE(0));\n// Prints: 83886080\nconsole.log(buf.readInt32LE(1));\n// Throws ERR_OUT_OF_RANGE.", + "position": { + "start": { "line": 2932, "column": 1, "offset": 80125 }, + "end": { "line": 2941, "column": 4, "offset": 80333 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.readIntBE(offset, byteLength)", + "position": { + "start": { "line": 2943, "column": 5, "offset": 80339 }, + "end": { "line": 2943, "column": 40, "offset": 80374 } + } + } + ], + "position": { + "start": { "line": 2943, "column": 1, "offset": 80335 }, + "end": { "line": 2943, "column": 40, "offset": 80374 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 2945, "column": 1, "offset": 80376 }, + "end": { "line": 2952, "column": 4, "offset": 80619 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 2954, "column": 3, "offset": 80623 }, + "end": { "line": 2954, "column": 11, "offset": 80631 } + } + }, + { + "type": "text", + "value": " {integer} Number of bytes to skip before starting to read. Must\nsatisfy ", + "position": { + "start": { "line": 2954, "column": 11, "offset": 80631 }, + "end": { "line": 2955, "column": 11, "offset": 80706 } + } + }, + { + "type": "inlineCode", + "value": "0 <= offset <= buf.length - byteLength", + "position": { + "start": { "line": 2955, "column": 11, "offset": 80706 }, + "end": { "line": 2955, "column": 51, "offset": 80746 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 2955, "column": 51, "offset": 80746 }, + "end": { "line": 2955, "column": 52, "offset": 80747 } + } + } + ], + "position": { + "start": { "line": 2954, "column": 3, "offset": 80623 }, + "end": { "line": 2955, "column": 52, "offset": 80747 } + } + } + ], + "position": { + "start": { "line": 2954, "column": 1, "offset": 80621 }, + "end": { "line": 2955, "column": 52, "offset": 80747 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "byteLength", + "position": { + "start": { "line": 2956, "column": 3, "offset": 80750 }, + "end": { "line": 2956, "column": 15, "offset": 80762 } + } + }, + { + "type": "text", + "value": " {integer} Number of bytes to read. Must satisfy\n", + "position": { + "start": { "line": 2956, "column": 15, "offset": 80762 }, + "end": { "line": 2957, "column": 1, "offset": 80811 } + } + }, + { + "type": "inlineCode", + "value": "0 < byteLength <= 6", + "position": { + "start": { "line": 2957, "column": 3, "offset": 80813 }, + "end": { "line": 2957, "column": 24, "offset": 80834 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 2957, "column": 24, "offset": 80834 }, + "end": { "line": 2957, "column": 25, "offset": 80835 } + } + } + ], + "position": { + "start": { "line": 2956, "column": 3, "offset": 80750 }, + "end": { "line": 2957, "column": 25, "offset": 80835 } + } + } + ], + "position": { + "start": { "line": 2956, "column": 1, "offset": 80748 }, + "end": { "line": 2957, "column": 25, "offset": 80835 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {integer}", + "position": { + "start": { "line": 2958, "column": 3, "offset": 80838 }, + "end": { "line": 2958, "column": 21, "offset": 80856 } + } + } + ], + "position": { + "start": { "line": 2958, "column": 3, "offset": 80838 }, + "end": { "line": 2958, "column": 21, "offset": 80856 } + } + } + ], + "position": { + "start": { "line": 2958, "column": 1, "offset": 80836 }, + "end": { "line": 2958, "column": 21, "offset": 80856 } + } + } + ], + "position": { + "start": { "line": 2954, "column": 1, "offset": 80621 }, + "end": { "line": 2958, "column": 21, "offset": 80856 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Reads ", + "position": { + "start": { "line": 2960, "column": 1, "offset": 80858 }, + "end": { "line": 2960, "column": 7, "offset": 80864 } + } + }, + { + "type": "inlineCode", + "value": "byteLength", + "position": { + "start": { "line": 2960, "column": 7, "offset": 80864 }, + "end": { "line": 2960, "column": 19, "offset": 80876 } + } + }, + { + "type": "text", + "value": " number of bytes from ", + "position": { + "start": { "line": 2960, "column": 19, "offset": 80876 }, + "end": { "line": 2960, "column": 41, "offset": 80898 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 2960, "column": 41, "offset": 80898 }, + "end": { "line": 2960, "column": 46, "offset": 80903 } + } + }, + { + "type": "text", + "value": " at the specified ", + "position": { + "start": { "line": 2960, "column": 46, "offset": 80903 }, + "end": { "line": 2960, "column": 64, "offset": 80921 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 2960, "column": 64, "offset": 80921 }, + "end": { "line": 2960, "column": 72, "offset": 80929 } + } + }, + { + "type": "text", + "value": "\nand interprets the result as a big-endian, two's complement signed value\nsupporting up to 48 bits of accuracy.", + "position": { + "start": { "line": 2960, "column": 72, "offset": 80929 }, + "end": { "line": 2962, "column": 38, "offset": 81040 } + } + } + ], + "position": { + "start": { "line": 2960, "column": 1, "offset": 80858 }, + "end": { "line": 2962, "column": 38, "offset": 81040 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]);\n\nconsole.log(buf.readIntBE(0, 6).toString(16));\n// Prints: 1234567890ab\nconsole.log(buf.readIntBE(1, 6).toString(16));\n// Throws ERR_OUT_OF_RANGE.\nconsole.log(buf.readIntBE(1, 0).toString(16));\n// Throws ERR_OUT_OF_RANGE.", + "position": { + "start": { "line": 2964, "column": 1, "offset": 81042 }, + "end": { "line": 2975, "column": 4, "offset": 81376 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]);\n\nconsole.log(buf.readIntBE(0, 6).toString(16));\n// Prints: 1234567890ab\nconsole.log(buf.readIntBE(1, 6).toString(16));\n// Throws ERR_OUT_OF_RANGE.\nconsole.log(buf.readIntBE(1, 0).toString(16));\n// Throws ERR_OUT_OF_RANGE.", + "position": { + "start": { "line": 2977, "column": 1, "offset": 81378 }, + "end": { "line": 2988, "column": 4, "offset": 81717 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.readIntLE(offset, byteLength)", + "position": { + "start": { "line": 2990, "column": 5, "offset": 81723 }, + "end": { "line": 2990, "column": 40, "offset": 81758 } + } + } + ], + "position": { + "start": { "line": 2990, "column": 1, "offset": 81719 }, + "end": { "line": 2990, "column": 40, "offset": 81758 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 2992, "column": 1, "offset": 81760 }, + "end": { "line": 2999, "column": 4, "offset": 82003 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 3001, "column": 3, "offset": 82007 }, + "end": { "line": 3001, "column": 11, "offset": 82015 } + } + }, + { + "type": "text", + "value": " {integer} Number of bytes to skip before starting to read. Must\nsatisfy ", + "position": { + "start": { "line": 3001, "column": 11, "offset": 82015 }, + "end": { "line": 3002, "column": 11, "offset": 82090 } + } + }, + { + "type": "inlineCode", + "value": "0 <= offset <= buf.length - byteLength", + "position": { + "start": { "line": 3002, "column": 11, "offset": 82090 }, + "end": { "line": 3002, "column": 51, "offset": 82130 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 3002, "column": 51, "offset": 82130 }, + "end": { "line": 3002, "column": 52, "offset": 82131 } + } + } + ], + "position": { + "start": { "line": 3001, "column": 3, "offset": 82007 }, + "end": { "line": 3002, "column": 52, "offset": 82131 } + } + } + ], + "position": { + "start": { "line": 3001, "column": 1, "offset": 82005 }, + "end": { "line": 3002, "column": 52, "offset": 82131 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "byteLength", + "position": { + "start": { "line": 3003, "column": 3, "offset": 82134 }, + "end": { "line": 3003, "column": 15, "offset": 82146 } + } + }, + { + "type": "text", + "value": " {integer} Number of bytes to read. Must satisfy\n", + "position": { + "start": { "line": 3003, "column": 15, "offset": 82146 }, + "end": { "line": 3004, "column": 1, "offset": 82195 } + } + }, + { + "type": "inlineCode", + "value": "0 < byteLength <= 6", + "position": { + "start": { "line": 3004, "column": 3, "offset": 82197 }, + "end": { "line": 3004, "column": 24, "offset": 82218 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 3004, "column": 24, "offset": 82218 }, + "end": { "line": 3004, "column": 25, "offset": 82219 } + } + } + ], + "position": { + "start": { "line": 3003, "column": 3, "offset": 82134 }, + "end": { "line": 3004, "column": 25, "offset": 82219 } + } + } + ], + "position": { + "start": { "line": 3003, "column": 1, "offset": 82132 }, + "end": { "line": 3004, "column": 25, "offset": 82219 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {integer}", + "position": { + "start": { "line": 3005, "column": 3, "offset": 82222 }, + "end": { "line": 3005, "column": 21, "offset": 82240 } + } + } + ], + "position": { + "start": { "line": 3005, "column": 3, "offset": 82222 }, + "end": { "line": 3005, "column": 21, "offset": 82240 } + } + } + ], + "position": { + "start": { "line": 3005, "column": 1, "offset": 82220 }, + "end": { "line": 3005, "column": 21, "offset": 82240 } + } + } + ], + "position": { + "start": { "line": 3001, "column": 1, "offset": 82005 }, + "end": { "line": 3005, "column": 21, "offset": 82240 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Reads ", + "position": { + "start": { "line": 3007, "column": 1, "offset": 82242 }, + "end": { "line": 3007, "column": 7, "offset": 82248 } + } + }, + { + "type": "inlineCode", + "value": "byteLength", + "position": { + "start": { "line": 3007, "column": 7, "offset": 82248 }, + "end": { "line": 3007, "column": 19, "offset": 82260 } + } + }, + { + "type": "text", + "value": " number of bytes from ", + "position": { + "start": { "line": 3007, "column": 19, "offset": 82260 }, + "end": { "line": 3007, "column": 41, "offset": 82282 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 3007, "column": 41, "offset": 82282 }, + "end": { "line": 3007, "column": 46, "offset": 82287 } + } + }, + { + "type": "text", + "value": " at the specified ", + "position": { + "start": { "line": 3007, "column": 46, "offset": 82287 }, + "end": { "line": 3007, "column": 64, "offset": 82305 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 3007, "column": 64, "offset": 82305 }, + "end": { "line": 3007, "column": 72, "offset": 82313 } + } + }, + { + "type": "text", + "value": "\nand interprets the result as a little-endian, two's complement signed value\nsupporting up to 48 bits of accuracy.", + "position": { + "start": { "line": 3007, "column": 72, "offset": 82313 }, + "end": { "line": 3009, "column": 38, "offset": 82427 } + } + } + ], + "position": { + "start": { "line": 3007, "column": 1, "offset": 82242 }, + "end": { "line": 3009, "column": 38, "offset": 82427 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]);\n\nconsole.log(buf.readIntLE(0, 6).toString(16));\n// Prints: -546f87a9cbee", + "position": { + "start": { "line": 3011, "column": 1, "offset": 82429 }, + "end": { "line": 3018, "column": 4, "offset": 82614 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]);\n\nconsole.log(buf.readIntLE(0, 6).toString(16));\n// Prints: -546f87a9cbee", + "position": { + "start": { "line": 3020, "column": 1, "offset": 82616 }, + "end": { "line": 3027, "column": 4, "offset": 82806 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.readUInt8([offset])", + "position": { + "start": { "line": 3029, "column": 5, "offset": 82812 }, + "end": { "line": 3029, "column": 30, "offset": 82837 } + } + } + ], + "position": { + "start": { "line": 3029, "column": 1, "offset": 82808 }, + "end": { "line": 3029, "column": 30, "offset": 82837 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 3031, "column": 1, "offset": 82839 }, + "end": { "line": 3043, "column": 4, "offset": 83230 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 3045, "column": 3, "offset": 83234 }, + "end": { "line": 3045, "column": 11, "offset": 83242 } + } + }, + { + "type": "text", + "value": " {integer} Number of bytes to skip before starting to read. Must\nsatisfy ", + "position": { + "start": { "line": 3045, "column": 11, "offset": 83242 }, + "end": { "line": 3046, "column": 11, "offset": 83317 } + } + }, + { + "type": "inlineCode", + "value": "0 <= offset <= buf.length - 1", + "position": { + "start": { "line": 3046, "column": 11, "offset": 83317 }, + "end": { "line": 3046, "column": 42, "offset": 83348 } + } + }, + { + "type": "text", + "value": ". ", + "position": { + "start": { "line": 3046, "column": 42, "offset": 83348 }, + "end": { "line": 3046, "column": 44, "offset": 83350 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { + "line": 3046, + "column": 46, + "offset": 83352 + }, + "end": { "line": 3046, "column": 54, "offset": 83360 } + } + } + ], + "position": { + "start": { "line": 3046, "column": 44, "offset": 83350 }, + "end": { "line": 3046, "column": 56, "offset": 83362 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 3046, "column": 56, "offset": 83362 }, + "end": { "line": 3046, "column": 57, "offset": 83363 } + } + }, + { + "type": "inlineCode", + "value": "0", + "position": { + "start": { "line": 3046, "column": 57, "offset": 83363 }, + "end": { "line": 3046, "column": 60, "offset": 83366 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 3046, "column": 60, "offset": 83366 }, + "end": { "line": 3046, "column": 61, "offset": 83367 } + } + } + ], + "position": { + "start": { "line": 3045, "column": 3, "offset": 83234 }, + "end": { "line": 3046, "column": 61, "offset": 83367 } + } + } + ], + "position": { + "start": { "line": 3045, "column": 1, "offset": 83232 }, + "end": { "line": 3046, "column": 61, "offset": 83367 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {integer}", + "position": { + "start": { "line": 3047, "column": 3, "offset": 83370 }, + "end": { "line": 3047, "column": 21, "offset": 83388 } + } + } + ], + "position": { + "start": { "line": 3047, "column": 3, "offset": 83370 }, + "end": { "line": 3047, "column": 21, "offset": 83388 } + } + } + ], + "position": { + "start": { "line": 3047, "column": 1, "offset": 83368 }, + "end": { "line": 3047, "column": 21, "offset": 83388 } + } + } + ], + "position": { + "start": { "line": 3045, "column": 1, "offset": 83232 }, + "end": { "line": 3047, "column": 21, "offset": 83388 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Reads an unsigned 8-bit integer from ", + "position": { + "start": { "line": 3049, "column": 1, "offset": 83390 }, + "end": { "line": 3049, "column": 38, "offset": 83427 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 3049, "column": 38, "offset": 83427 }, + "end": { "line": 3049, "column": 43, "offset": 83432 } + } + }, + { + "type": "text", + "value": " at the specified ", + "position": { + "start": { "line": 3049, "column": 43, "offset": 83432 }, + "end": { "line": 3049, "column": 61, "offset": 83450 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 3049, "column": 61, "offset": 83450 }, + "end": { "line": 3049, "column": 69, "offset": 83458 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 3049, "column": 69, "offset": 83458 }, + "end": { "line": 3049, "column": 70, "offset": 83459 } + } + } + ], + "position": { + "start": { "line": 3049, "column": 1, "offset": 83390 }, + "end": { "line": 3049, "column": 70, "offset": 83459 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "This function is also available under the ", + "position": { + "start": { "line": 3051, "column": 1, "offset": 83461 }, + "end": { "line": 3051, "column": 43, "offset": 83503 } + } + }, + { + "type": "inlineCode", + "value": "readUint8", + "position": { + "start": { "line": 3051, "column": 43, "offset": 83503 }, + "end": { "line": 3051, "column": 54, "offset": 83514 } + } + }, + { + "type": "text", + "value": " alias.", + "position": { + "start": { "line": 3051, "column": 54, "offset": 83514 }, + "end": { "line": 3051, "column": 61, "offset": 83521 } + } + } + ], + "position": { + "start": { "line": 3051, "column": 1, "offset": 83461 }, + "end": { "line": 3051, "column": 61, "offset": 83521 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from([1, -2]);\n\nconsole.log(buf.readUInt8(0));\n// Prints: 1\nconsole.log(buf.readUInt8(1));\n// Prints: 254\nconsole.log(buf.readUInt8(2));\n// Throws ERR_OUT_OF_RANGE.", + "position": { + "start": { "line": 3053, "column": 1, "offset": 83523 }, + "end": { "line": 3064, "column": 4, "offset": 83756 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from([1, -2]);\n\nconsole.log(buf.readUInt8(0));\n// Prints: 1\nconsole.log(buf.readUInt8(1));\n// Prints: 254\nconsole.log(buf.readUInt8(2));\n// Throws ERR_OUT_OF_RANGE.", + "position": { + "start": { "line": 3066, "column": 1, "offset": 83758 }, + "end": { "line": 3077, "column": 4, "offset": 83996 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.readUInt16BE([offset])", + "position": { + "start": { "line": 3079, "column": 5, "offset": 84002 }, + "end": { "line": 3079, "column": 33, "offset": 84030 } + } + } + ], + "position": { + "start": { "line": 3079, "column": 1, "offset": 83998 }, + "end": { "line": 3079, "column": 33, "offset": 84030 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 3081, "column": 1, "offset": 84032 }, + "end": { "line": 3093, "column": 4, "offset": 84426 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 3095, "column": 3, "offset": 84430 }, + "end": { "line": 3095, "column": 11, "offset": 84438 } + } + }, + { + "type": "text", + "value": " {integer} Number of bytes to skip before starting to read. Must\nsatisfy ", + "position": { + "start": { "line": 3095, "column": 11, "offset": 84438 }, + "end": { "line": 3096, "column": 11, "offset": 84513 } + } + }, + { + "type": "inlineCode", + "value": "0 <= offset <= buf.length - 2", + "position": { + "start": { "line": 3096, "column": 11, "offset": 84513 }, + "end": { "line": 3096, "column": 42, "offset": 84544 } + } + }, + { + "type": "text", + "value": ". ", + "position": { + "start": { "line": 3096, "column": 42, "offset": 84544 }, + "end": { "line": 3096, "column": 44, "offset": 84546 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { + "line": 3096, + "column": 46, + "offset": 84548 + }, + "end": { "line": 3096, "column": 54, "offset": 84556 } + } + } + ], + "position": { + "start": { "line": 3096, "column": 44, "offset": 84546 }, + "end": { "line": 3096, "column": 56, "offset": 84558 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 3096, "column": 56, "offset": 84558 }, + "end": { "line": 3096, "column": 57, "offset": 84559 } + } + }, + { + "type": "inlineCode", + "value": "0", + "position": { + "start": { "line": 3096, "column": 57, "offset": 84559 }, + "end": { "line": 3096, "column": 60, "offset": 84562 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 3096, "column": 60, "offset": 84562 }, + "end": { "line": 3096, "column": 61, "offset": 84563 } + } + } + ], + "position": { + "start": { "line": 3095, "column": 3, "offset": 84430 }, + "end": { "line": 3096, "column": 61, "offset": 84563 } + } + } + ], + "position": { + "start": { "line": 3095, "column": 1, "offset": 84428 }, + "end": { "line": 3096, "column": 61, "offset": 84563 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {integer}", + "position": { + "start": { "line": 3097, "column": 3, "offset": 84566 }, + "end": { "line": 3097, "column": 21, "offset": 84584 } + } + } + ], + "position": { + "start": { "line": 3097, "column": 3, "offset": 84566 }, + "end": { "line": 3097, "column": 21, "offset": 84584 } + } + } + ], + "position": { + "start": { "line": 3097, "column": 1, "offset": 84564 }, + "end": { "line": 3097, "column": 21, "offset": 84584 } + } + } + ], + "position": { + "start": { "line": 3095, "column": 1, "offset": 84428 }, + "end": { "line": 3097, "column": 21, "offset": 84584 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Reads an unsigned, big-endian 16-bit integer from ", + "position": { + "start": { "line": 3099, "column": 1, "offset": 84586 }, + "end": { "line": 3099, "column": 51, "offset": 84636 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 3099, "column": 51, "offset": 84636 }, + "end": { "line": 3099, "column": 56, "offset": 84641 } + } + }, + { + "type": "text", + "value": " at the specified\n", + "position": { + "start": { "line": 3099, "column": 56, "offset": 84641 }, + "end": { "line": 3100, "column": 1, "offset": 84659 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 3100, "column": 1, "offset": 84659 }, + "end": { "line": 3100, "column": 9, "offset": 84667 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 3100, "column": 9, "offset": 84667 }, + "end": { "line": 3100, "column": 10, "offset": 84668 } + } + } + ], + "position": { + "start": { "line": 3099, "column": 1, "offset": 84586 }, + "end": { "line": 3100, "column": 10, "offset": 84668 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "This function is also available under the ", + "position": { + "start": { "line": 3102, "column": 1, "offset": 84670 }, + "end": { "line": 3102, "column": 43, "offset": 84712 } + } + }, + { + "type": "inlineCode", + "value": "readUint16BE", + "position": { + "start": { "line": 3102, "column": 43, "offset": 84712 }, + "end": { "line": 3102, "column": 57, "offset": 84726 } + } + }, + { + "type": "text", + "value": " alias.", + "position": { + "start": { "line": 3102, "column": 57, "offset": 84726 }, + "end": { "line": 3102, "column": 64, "offset": 84733 } + } + } + ], + "position": { + "start": { "line": 3102, "column": 1, "offset": 84670 }, + "end": { "line": 3102, "column": 64, "offset": 84733 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from([0x12, 0x34, 0x56]);\n\nconsole.log(buf.readUInt16BE(0).toString(16));\n// Prints: 1234\nconsole.log(buf.readUInt16BE(1).toString(16));\n// Prints: 3456", + "position": { + "start": { "line": 3104, "column": 1, "offset": 84735 }, + "end": { "line": 3113, "column": 4, "offset": 84956 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from([0x12, 0x34, 0x56]);\n\nconsole.log(buf.readUInt16BE(0).toString(16));\n// Prints: 1234\nconsole.log(buf.readUInt16BE(1).toString(16));\n// Prints: 3456", + "position": { + "start": { "line": 3115, "column": 1, "offset": 84958 }, + "end": { "line": 3124, "column": 4, "offset": 85184 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.readUInt16LE([offset])", + "position": { + "start": { "line": 3126, "column": 5, "offset": 85190 }, + "end": { "line": 3126, "column": 33, "offset": 85218 } + } + } + ], + "position": { + "start": { "line": 3126, "column": 1, "offset": 85186 }, + "end": { "line": 3126, "column": 33, "offset": 85218 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 3128, "column": 1, "offset": 85220 }, + "end": { "line": 3140, "column": 4, "offset": 85614 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 3142, "column": 3, "offset": 85618 }, + "end": { "line": 3142, "column": 11, "offset": 85626 } + } + }, + { + "type": "text", + "value": " {integer} Number of bytes to skip before starting to read. Must\nsatisfy ", + "position": { + "start": { "line": 3142, "column": 11, "offset": 85626 }, + "end": { "line": 3143, "column": 11, "offset": 85701 } + } + }, + { + "type": "inlineCode", + "value": "0 <= offset <= buf.length - 2", + "position": { + "start": { "line": 3143, "column": 11, "offset": 85701 }, + "end": { "line": 3143, "column": 42, "offset": 85732 } + } + }, + { + "type": "text", + "value": ". ", + "position": { + "start": { "line": 3143, "column": 42, "offset": 85732 }, + "end": { "line": 3143, "column": 44, "offset": 85734 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { + "line": 3143, + "column": 46, + "offset": 85736 + }, + "end": { "line": 3143, "column": 54, "offset": 85744 } + } + } + ], + "position": { + "start": { "line": 3143, "column": 44, "offset": 85734 }, + "end": { "line": 3143, "column": 56, "offset": 85746 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 3143, "column": 56, "offset": 85746 }, + "end": { "line": 3143, "column": 57, "offset": 85747 } + } + }, + { + "type": "inlineCode", + "value": "0", + "position": { + "start": { "line": 3143, "column": 57, "offset": 85747 }, + "end": { "line": 3143, "column": 60, "offset": 85750 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 3143, "column": 60, "offset": 85750 }, + "end": { "line": 3143, "column": 61, "offset": 85751 } + } + } + ], + "position": { + "start": { "line": 3142, "column": 3, "offset": 85618 }, + "end": { "line": 3143, "column": 61, "offset": 85751 } + } + } + ], + "position": { + "start": { "line": 3142, "column": 1, "offset": 85616 }, + "end": { "line": 3143, "column": 61, "offset": 85751 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {integer}", + "position": { + "start": { "line": 3144, "column": 3, "offset": 85754 }, + "end": { "line": 3144, "column": 21, "offset": 85772 } + } + } + ], + "position": { + "start": { "line": 3144, "column": 3, "offset": 85754 }, + "end": { "line": 3144, "column": 21, "offset": 85772 } + } + } + ], + "position": { + "start": { "line": 3144, "column": 1, "offset": 85752 }, + "end": { "line": 3144, "column": 21, "offset": 85772 } + } + } + ], + "position": { + "start": { "line": 3142, "column": 1, "offset": 85616 }, + "end": { "line": 3144, "column": 21, "offset": 85772 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Reads an unsigned, little-endian 16-bit integer from ", + "position": { + "start": { "line": 3146, "column": 1, "offset": 85774 }, + "end": { "line": 3146, "column": 54, "offset": 85827 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 3146, "column": 54, "offset": 85827 }, + "end": { "line": 3146, "column": 59, "offset": 85832 } + } + }, + { + "type": "text", + "value": " at the specified\n", + "position": { + "start": { "line": 3146, "column": 59, "offset": 85832 }, + "end": { "line": 3147, "column": 1, "offset": 85850 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 3147, "column": 1, "offset": 85850 }, + "end": { "line": 3147, "column": 9, "offset": 85858 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 3147, "column": 9, "offset": 85858 }, + "end": { "line": 3147, "column": 10, "offset": 85859 } + } + } + ], + "position": { + "start": { "line": 3146, "column": 1, "offset": 85774 }, + "end": { "line": 3147, "column": 10, "offset": 85859 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "This function is also available under the ", + "position": { + "start": { "line": 3149, "column": 1, "offset": 85861 }, + "end": { "line": 3149, "column": 43, "offset": 85903 } + } + }, + { + "type": "inlineCode", + "value": "readUint16LE", + "position": { + "start": { "line": 3149, "column": 43, "offset": 85903 }, + "end": { "line": 3149, "column": 57, "offset": 85917 } + } + }, + { + "type": "text", + "value": " alias.", + "position": { + "start": { "line": 3149, "column": 57, "offset": 85917 }, + "end": { "line": 3149, "column": 64, "offset": 85924 } + } + } + ], + "position": { + "start": { "line": 3149, "column": 1, "offset": 85861 }, + "end": { "line": 3149, "column": 64, "offset": 85924 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from([0x12, 0x34, 0x56]);\n\nconsole.log(buf.readUInt16LE(0).toString(16));\n// Prints: 3412\nconsole.log(buf.readUInt16LE(1).toString(16));\n// Prints: 5634\nconsole.log(buf.readUInt16LE(2).toString(16));\n// Throws ERR_OUT_OF_RANGE.", + "position": { + "start": { "line": 3151, "column": 1, "offset": 85926 }, + "end": { "line": 3162, "column": 4, "offset": 86222 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from([0x12, 0x34, 0x56]);\n\nconsole.log(buf.readUInt16LE(0).toString(16));\n// Prints: 3412\nconsole.log(buf.readUInt16LE(1).toString(16));\n// Prints: 5634\nconsole.log(buf.readUInt16LE(2).toString(16));\n// Throws ERR_OUT_OF_RANGE.", + "position": { + "start": { "line": 3164, "column": 1, "offset": 86224 }, + "end": { "line": 3175, "column": 4, "offset": 86525 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.readUInt32BE([offset])", + "position": { + "start": { "line": 3177, "column": 5, "offset": 86531 }, + "end": { "line": 3177, "column": 33, "offset": 86559 } + } + } + ], + "position": { + "start": { "line": 3177, "column": 1, "offset": 86527 }, + "end": { "line": 3177, "column": 33, "offset": 86559 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 3179, "column": 1, "offset": 86561 }, + "end": { "line": 3191, "column": 4, "offset": 86955 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 3193, "column": 3, "offset": 86959 }, + "end": { "line": 3193, "column": 11, "offset": 86967 } + } + }, + { + "type": "text", + "value": " {integer} Number of bytes to skip before starting to read. Must\nsatisfy ", + "position": { + "start": { "line": 3193, "column": 11, "offset": 86967 }, + "end": { "line": 3194, "column": 11, "offset": 87042 } + } + }, + { + "type": "inlineCode", + "value": "0 <= offset <= buf.length - 4", + "position": { + "start": { "line": 3194, "column": 11, "offset": 87042 }, + "end": { "line": 3194, "column": 42, "offset": 87073 } + } + }, + { + "type": "text", + "value": ". ", + "position": { + "start": { "line": 3194, "column": 42, "offset": 87073 }, + "end": { "line": 3194, "column": 44, "offset": 87075 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { + "line": 3194, + "column": 46, + "offset": 87077 + }, + "end": { "line": 3194, "column": 54, "offset": 87085 } + } + } + ], + "position": { + "start": { "line": 3194, "column": 44, "offset": 87075 }, + "end": { "line": 3194, "column": 56, "offset": 87087 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 3194, "column": 56, "offset": 87087 }, + "end": { "line": 3194, "column": 57, "offset": 87088 } + } + }, + { + "type": "inlineCode", + "value": "0", + "position": { + "start": { "line": 3194, "column": 57, "offset": 87088 }, + "end": { "line": 3194, "column": 60, "offset": 87091 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 3194, "column": 60, "offset": 87091 }, + "end": { "line": 3194, "column": 61, "offset": 87092 } + } + } + ], + "position": { + "start": { "line": 3193, "column": 3, "offset": 86959 }, + "end": { "line": 3194, "column": 61, "offset": 87092 } + } + } + ], + "position": { + "start": { "line": 3193, "column": 1, "offset": 86957 }, + "end": { "line": 3194, "column": 61, "offset": 87092 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {integer}", + "position": { + "start": { "line": 3195, "column": 3, "offset": 87095 }, + "end": { "line": 3195, "column": 21, "offset": 87113 } + } + } + ], + "position": { + "start": { "line": 3195, "column": 3, "offset": 87095 }, + "end": { "line": 3195, "column": 21, "offset": 87113 } + } + } + ], + "position": { + "start": { "line": 3195, "column": 1, "offset": 87093 }, + "end": { "line": 3195, "column": 21, "offset": 87113 } + } + } + ], + "position": { + "start": { "line": 3193, "column": 1, "offset": 86957 }, + "end": { "line": 3195, "column": 21, "offset": 87113 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Reads an unsigned, big-endian 32-bit integer from ", + "position": { + "start": { "line": 3197, "column": 1, "offset": 87115 }, + "end": { "line": 3197, "column": 51, "offset": 87165 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 3197, "column": 51, "offset": 87165 }, + "end": { "line": 3197, "column": 56, "offset": 87170 } + } + }, + { + "type": "text", + "value": " at the specified\n", + "position": { + "start": { "line": 3197, "column": 56, "offset": 87170 }, + "end": { "line": 3198, "column": 1, "offset": 87188 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 3198, "column": 1, "offset": 87188 }, + "end": { "line": 3198, "column": 9, "offset": 87196 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 3198, "column": 9, "offset": 87196 }, + "end": { "line": 3198, "column": 10, "offset": 87197 } + } + } + ], + "position": { + "start": { "line": 3197, "column": 1, "offset": 87115 }, + "end": { "line": 3198, "column": 10, "offset": 87197 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "This function is also available under the ", + "position": { + "start": { "line": 3200, "column": 1, "offset": 87199 }, + "end": { "line": 3200, "column": 43, "offset": 87241 } + } + }, + { + "type": "inlineCode", + "value": "readUint32BE", + "position": { + "start": { "line": 3200, "column": 43, "offset": 87241 }, + "end": { "line": 3200, "column": 57, "offset": 87255 } + } + }, + { + "type": "text", + "value": " alias.", + "position": { + "start": { "line": 3200, "column": 57, "offset": 87255 }, + "end": { "line": 3200, "column": 64, "offset": 87262 } + } + } + ], + "position": { + "start": { "line": 3200, "column": 1, "offset": 87199 }, + "end": { "line": 3200, "column": 64, "offset": 87262 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from([0x12, 0x34, 0x56, 0x78]);\n\nconsole.log(buf.readUInt32BE(0).toString(16));\n// Prints: 12345678", + "position": { + "start": { "line": 3202, "column": 1, "offset": 87264 }, + "end": { "line": 3209, "column": 4, "offset": 87432 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from([0x12, 0x34, 0x56, 0x78]);\n\nconsole.log(buf.readUInt32BE(0).toString(16));\n// Prints: 12345678", + "position": { + "start": { "line": 3211, "column": 1, "offset": 87434 }, + "end": { "line": 3218, "column": 4, "offset": 87607 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.readUInt32LE([offset])", + "position": { + "start": { "line": 3220, "column": 5, "offset": 87613 }, + "end": { "line": 3220, "column": 33, "offset": 87641 } + } + } + ], + "position": { + "start": { "line": 3220, "column": 1, "offset": 87609 }, + "end": { "line": 3220, "column": 33, "offset": 87641 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 3222, "column": 1, "offset": 87643 }, + "end": { "line": 3234, "column": 4, "offset": 88037 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 3236, "column": 3, "offset": 88041 }, + "end": { "line": 3236, "column": 11, "offset": 88049 } + } + }, + { + "type": "text", + "value": " {integer} Number of bytes to skip before starting to read. Must\nsatisfy ", + "position": { + "start": { "line": 3236, "column": 11, "offset": 88049 }, + "end": { "line": 3237, "column": 11, "offset": 88124 } + } + }, + { + "type": "inlineCode", + "value": "0 <= offset <= buf.length - 4", + "position": { + "start": { "line": 3237, "column": 11, "offset": 88124 }, + "end": { "line": 3237, "column": 42, "offset": 88155 } + } + }, + { + "type": "text", + "value": ". ", + "position": { + "start": { "line": 3237, "column": 42, "offset": 88155 }, + "end": { "line": 3237, "column": 44, "offset": 88157 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { + "line": 3237, + "column": 46, + "offset": 88159 + }, + "end": { "line": 3237, "column": 54, "offset": 88167 } + } + } + ], + "position": { + "start": { "line": 3237, "column": 44, "offset": 88157 }, + "end": { "line": 3237, "column": 56, "offset": 88169 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 3237, "column": 56, "offset": 88169 }, + "end": { "line": 3237, "column": 57, "offset": 88170 } + } + }, + { + "type": "inlineCode", + "value": "0", + "position": { + "start": { "line": 3237, "column": 57, "offset": 88170 }, + "end": { "line": 3237, "column": 60, "offset": 88173 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 3237, "column": 60, "offset": 88173 }, + "end": { "line": 3237, "column": 61, "offset": 88174 } + } + } + ], + "position": { + "start": { "line": 3236, "column": 3, "offset": 88041 }, + "end": { "line": 3237, "column": 61, "offset": 88174 } + } + } + ], + "position": { + "start": { "line": 3236, "column": 1, "offset": 88039 }, + "end": { "line": 3237, "column": 61, "offset": 88174 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {integer}", + "position": { + "start": { "line": 3238, "column": 3, "offset": 88177 }, + "end": { "line": 3238, "column": 21, "offset": 88195 } + } + } + ], + "position": { + "start": { "line": 3238, "column": 3, "offset": 88177 }, + "end": { "line": 3238, "column": 21, "offset": 88195 } + } + } + ], + "position": { + "start": { "line": 3238, "column": 1, "offset": 88175 }, + "end": { "line": 3238, "column": 21, "offset": 88195 } + } + } + ], + "position": { + "start": { "line": 3236, "column": 1, "offset": 88039 }, + "end": { "line": 3238, "column": 21, "offset": 88195 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Reads an unsigned, little-endian 32-bit integer from ", + "position": { + "start": { "line": 3240, "column": 1, "offset": 88197 }, + "end": { "line": 3240, "column": 54, "offset": 88250 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 3240, "column": 54, "offset": 88250 }, + "end": { "line": 3240, "column": 59, "offset": 88255 } + } + }, + { + "type": "text", + "value": " at the specified\n", + "position": { + "start": { "line": 3240, "column": 59, "offset": 88255 }, + "end": { "line": 3241, "column": 1, "offset": 88273 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 3241, "column": 1, "offset": 88273 }, + "end": { "line": 3241, "column": 9, "offset": 88281 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 3241, "column": 9, "offset": 88281 }, + "end": { "line": 3241, "column": 10, "offset": 88282 } + } + } + ], + "position": { + "start": { "line": 3240, "column": 1, "offset": 88197 }, + "end": { "line": 3241, "column": 10, "offset": 88282 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "This function is also available under the ", + "position": { + "start": { "line": 3243, "column": 1, "offset": 88284 }, + "end": { "line": 3243, "column": 43, "offset": 88326 } + } + }, + { + "type": "inlineCode", + "value": "readUint32LE", + "position": { + "start": { "line": 3243, "column": 43, "offset": 88326 }, + "end": { "line": 3243, "column": 57, "offset": 88340 } + } + }, + { + "type": "text", + "value": " alias.", + "position": { + "start": { "line": 3243, "column": 57, "offset": 88340 }, + "end": { "line": 3243, "column": 64, "offset": 88347 } + } + } + ], + "position": { + "start": { "line": 3243, "column": 1, "offset": 88284 }, + "end": { "line": 3243, "column": 64, "offset": 88347 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from([0x12, 0x34, 0x56, 0x78]);\n\nconsole.log(buf.readUInt32LE(0).toString(16));\n// Prints: 78563412\nconsole.log(buf.readUInt32LE(1).toString(16));\n// Throws ERR_OUT_OF_RANGE.", + "position": { + "start": { "line": 3245, "column": 1, "offset": 88349 }, + "end": { "line": 3254, "column": 4, "offset": 88592 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from([0x12, 0x34, 0x56, 0x78]);\n\nconsole.log(buf.readUInt32LE(0).toString(16));\n// Prints: 78563412\nconsole.log(buf.readUInt32LE(1).toString(16));\n// Throws ERR_OUT_OF_RANGE.", + "position": { + "start": { "line": 3256, "column": 1, "offset": 88594 }, + "end": { "line": 3265, "column": 4, "offset": 88842 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.readUIntBE(offset, byteLength)", + "position": { + "start": { "line": 3267, "column": 5, "offset": 88848 }, + "end": { "line": 3267, "column": 41, "offset": 88884 } + } + } + ], + "position": { + "start": { "line": 3267, "column": 1, "offset": 88844 }, + "end": { "line": 3267, "column": 41, "offset": 88884 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 3269, "column": 1, "offset": 88886 }, + "end": { "line": 3281, "column": 4, "offset": 89297 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 3283, "column": 3, "offset": 89301 }, + "end": { "line": 3283, "column": 11, "offset": 89309 } + } + }, + { + "type": "text", + "value": " {integer} Number of bytes to skip before starting to read. Must\nsatisfy ", + "position": { + "start": { "line": 3283, "column": 11, "offset": 89309 }, + "end": { "line": 3284, "column": 11, "offset": 89384 } + } + }, + { + "type": "inlineCode", + "value": "0 <= offset <= buf.length - byteLength", + "position": { + "start": { "line": 3284, "column": 11, "offset": 89384 }, + "end": { "line": 3284, "column": 51, "offset": 89424 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 3284, "column": 51, "offset": 89424 }, + "end": { "line": 3284, "column": 52, "offset": 89425 } + } + } + ], + "position": { + "start": { "line": 3283, "column": 3, "offset": 89301 }, + "end": { "line": 3284, "column": 52, "offset": 89425 } + } + } + ], + "position": { + "start": { "line": 3283, "column": 1, "offset": 89299 }, + "end": { "line": 3284, "column": 52, "offset": 89425 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "byteLength", + "position": { + "start": { "line": 3285, "column": 3, "offset": 89428 }, + "end": { "line": 3285, "column": 15, "offset": 89440 } + } + }, + { + "type": "text", + "value": " {integer} Number of bytes to read. Must satisfy\n", + "position": { + "start": { "line": 3285, "column": 15, "offset": 89440 }, + "end": { "line": 3286, "column": 1, "offset": 89489 } + } + }, + { + "type": "inlineCode", + "value": "0 < byteLength <= 6", + "position": { + "start": { "line": 3286, "column": 3, "offset": 89491 }, + "end": { "line": 3286, "column": 24, "offset": 89512 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 3286, "column": 24, "offset": 89512 }, + "end": { "line": 3286, "column": 25, "offset": 89513 } + } + } + ], + "position": { + "start": { "line": 3285, "column": 3, "offset": 89428 }, + "end": { "line": 3286, "column": 25, "offset": 89513 } + } + } + ], + "position": { + "start": { "line": 3285, "column": 1, "offset": 89426 }, + "end": { "line": 3286, "column": 25, "offset": 89513 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {integer}", + "position": { + "start": { "line": 3287, "column": 3, "offset": 89516 }, + "end": { "line": 3287, "column": 21, "offset": 89534 } + } + } + ], + "position": { + "start": { "line": 3287, "column": 3, "offset": 89516 }, + "end": { "line": 3287, "column": 21, "offset": 89534 } + } + } + ], + "position": { + "start": { "line": 3287, "column": 1, "offset": 89514 }, + "end": { "line": 3287, "column": 21, "offset": 89534 } + } + } + ], + "position": { + "start": { "line": 3283, "column": 1, "offset": 89299 }, + "end": { "line": 3287, "column": 21, "offset": 89534 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Reads ", + "position": { + "start": { "line": 3289, "column": 1, "offset": 89536 }, + "end": { "line": 3289, "column": 7, "offset": 89542 } + } + }, + { + "type": "inlineCode", + "value": "byteLength", + "position": { + "start": { "line": 3289, "column": 7, "offset": 89542 }, + "end": { "line": 3289, "column": 19, "offset": 89554 } + } + }, + { + "type": "text", + "value": " number of bytes from ", + "position": { + "start": { "line": 3289, "column": 19, "offset": 89554 }, + "end": { "line": 3289, "column": 41, "offset": 89576 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 3289, "column": 41, "offset": 89576 }, + "end": { "line": 3289, "column": 46, "offset": 89581 } + } + }, + { + "type": "text", + "value": " at the specified ", + "position": { + "start": { "line": 3289, "column": 46, "offset": 89581 }, + "end": { "line": 3289, "column": 64, "offset": 89599 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 3289, "column": 64, "offset": 89599 }, + "end": { "line": 3289, "column": 72, "offset": 89607 } + } + }, + { + "type": "text", + "value": "\nand interprets the result as an unsigned big-endian integer supporting\nup to 48 bits of accuracy.", + "position": { + "start": { "line": 3289, "column": 72, "offset": 89607 }, + "end": { "line": 3291, "column": 27, "offset": 89705 } + } + } + ], + "position": { + "start": { "line": 3289, "column": 1, "offset": 89536 }, + "end": { "line": 3291, "column": 27, "offset": 89705 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "This function is also available under the ", + "position": { + "start": { "line": 3293, "column": 1, "offset": 89707 }, + "end": { "line": 3293, "column": 43, "offset": 89749 } + } + }, + { + "type": "inlineCode", + "value": "readUintBE", + "position": { + "start": { "line": 3293, "column": 43, "offset": 89749 }, + "end": { "line": 3293, "column": 55, "offset": 89761 } + } + }, + { + "type": "text", + "value": " alias.", + "position": { + "start": { "line": 3293, "column": 55, "offset": 89761 }, + "end": { "line": 3293, "column": 62, "offset": 89768 } + } + } + ], + "position": { + "start": { "line": 3293, "column": 1, "offset": 89707 }, + "end": { "line": 3293, "column": 62, "offset": 89768 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]);\n\nconsole.log(buf.readUIntBE(0, 6).toString(16));\n// Prints: 1234567890ab\nconsole.log(buf.readUIntBE(1, 6).toString(16));\n// Throws ERR_OUT_OF_RANGE.", + "position": { + "start": { "line": 3295, "column": 1, "offset": 89770 }, + "end": { "line": 3304, "column": 4, "offset": 90031 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]);\n\nconsole.log(buf.readUIntBE(0, 6).toString(16));\n// Prints: 1234567890ab\nconsole.log(buf.readUIntBE(1, 6).toString(16));\n// Throws ERR_OUT_OF_RANGE.", + "position": { + "start": { "line": 3306, "column": 1, "offset": 90033 }, + "end": { "line": 3315, "column": 4, "offset": 90299 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.readUIntLE(offset, byteLength)", + "position": { + "start": { "line": 3317, "column": 5, "offset": 90305 }, + "end": { "line": 3317, "column": 41, "offset": 90341 } + } + } + ], + "position": { + "start": { "line": 3317, "column": 1, "offset": 90301 }, + "end": { "line": 3317, "column": 41, "offset": 90341 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 3319, "column": 1, "offset": 90343 }, + "end": { "line": 3331, "column": 4, "offset": 90754 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 3333, "column": 3, "offset": 90758 }, + "end": { "line": 3333, "column": 11, "offset": 90766 } + } + }, + { + "type": "text", + "value": " {integer} Number of bytes to skip before starting to read. Must\nsatisfy ", + "position": { + "start": { "line": 3333, "column": 11, "offset": 90766 }, + "end": { "line": 3334, "column": 11, "offset": 90841 } + } + }, + { + "type": "inlineCode", + "value": "0 <= offset <= buf.length - byteLength", + "position": { + "start": { "line": 3334, "column": 11, "offset": 90841 }, + "end": { "line": 3334, "column": 51, "offset": 90881 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 3334, "column": 51, "offset": 90881 }, + "end": { "line": 3334, "column": 52, "offset": 90882 } + } + } + ], + "position": { + "start": { "line": 3333, "column": 3, "offset": 90758 }, + "end": { "line": 3334, "column": 52, "offset": 90882 } + } + } + ], + "position": { + "start": { "line": 3333, "column": 1, "offset": 90756 }, + "end": { "line": 3334, "column": 52, "offset": 90882 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "byteLength", + "position": { + "start": { "line": 3335, "column": 3, "offset": 90885 }, + "end": { "line": 3335, "column": 15, "offset": 90897 } + } + }, + { + "type": "text", + "value": " {integer} Number of bytes to read. Must satisfy\n", + "position": { + "start": { "line": 3335, "column": 15, "offset": 90897 }, + "end": { "line": 3336, "column": 1, "offset": 90946 } + } + }, + { + "type": "inlineCode", + "value": "0 < byteLength <= 6", + "position": { + "start": { "line": 3336, "column": 3, "offset": 90948 }, + "end": { "line": 3336, "column": 24, "offset": 90969 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 3336, "column": 24, "offset": 90969 }, + "end": { "line": 3336, "column": 25, "offset": 90970 } + } + } + ], + "position": { + "start": { "line": 3335, "column": 3, "offset": 90885 }, + "end": { "line": 3336, "column": 25, "offset": 90970 } + } + } + ], + "position": { + "start": { "line": 3335, "column": 1, "offset": 90883 }, + "end": { "line": 3336, "column": 25, "offset": 90970 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {integer}", + "position": { + "start": { "line": 3337, "column": 3, "offset": 90973 }, + "end": { "line": 3337, "column": 21, "offset": 90991 } + } + } + ], + "position": { + "start": { "line": 3337, "column": 3, "offset": 90973 }, + "end": { "line": 3337, "column": 21, "offset": 90991 } + } + } + ], + "position": { + "start": { "line": 3337, "column": 1, "offset": 90971 }, + "end": { "line": 3337, "column": 21, "offset": 90991 } + } + } + ], + "position": { + "start": { "line": 3333, "column": 1, "offset": 90756 }, + "end": { "line": 3337, "column": 21, "offset": 90991 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Reads ", + "position": { + "start": { "line": 3339, "column": 1, "offset": 90993 }, + "end": { "line": 3339, "column": 7, "offset": 90999 } + } + }, + { + "type": "inlineCode", + "value": "byteLength", + "position": { + "start": { "line": 3339, "column": 7, "offset": 90999 }, + "end": { "line": 3339, "column": 19, "offset": 91011 } + } + }, + { + "type": "text", + "value": " number of bytes from ", + "position": { + "start": { "line": 3339, "column": 19, "offset": 91011 }, + "end": { "line": 3339, "column": 41, "offset": 91033 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 3339, "column": 41, "offset": 91033 }, + "end": { "line": 3339, "column": 46, "offset": 91038 } + } + }, + { + "type": "text", + "value": " at the specified ", + "position": { + "start": { "line": 3339, "column": 46, "offset": 91038 }, + "end": { "line": 3339, "column": 64, "offset": 91056 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 3339, "column": 64, "offset": 91056 }, + "end": { "line": 3339, "column": 72, "offset": 91064 } + } + }, + { + "type": "text", + "value": "\nand interprets the result as an unsigned, little-endian integer supporting\nup to 48 bits of accuracy.", + "position": { + "start": { "line": 3339, "column": 72, "offset": 91064 }, + "end": { "line": 3341, "column": 27, "offset": 91166 } + } + } + ], + "position": { + "start": { "line": 3339, "column": 1, "offset": 90993 }, + "end": { "line": 3341, "column": 27, "offset": 91166 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "This function is also available under the ", + "position": { + "start": { "line": 3343, "column": 1, "offset": 91168 }, + "end": { "line": 3343, "column": 43, "offset": 91210 } + } + }, + { + "type": "inlineCode", + "value": "readUintLE", + "position": { + "start": { "line": 3343, "column": 43, "offset": 91210 }, + "end": { "line": 3343, "column": 55, "offset": 91222 } + } + }, + { + "type": "text", + "value": " alias.", + "position": { + "start": { "line": 3343, "column": 55, "offset": 91222 }, + "end": { "line": 3343, "column": 62, "offset": 91229 } + } + } + ], + "position": { + "start": { "line": 3343, "column": 1, "offset": 91168 }, + "end": { "line": 3343, "column": 62, "offset": 91229 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]);\n\nconsole.log(buf.readUIntLE(0, 6).toString(16));\n// Prints: ab9078563412", + "position": { + "start": { "line": 3345, "column": 1, "offset": 91231 }, + "end": { "line": 3352, "column": 4, "offset": 91416 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]);\n\nconsole.log(buf.readUIntLE(0, 6).toString(16));\n// Prints: ab9078563412", + "position": { + "start": { "line": 3354, "column": 1, "offset": 91418 }, + "end": { "line": 3361, "column": 4, "offset": 91608 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.subarray([start[, end]])", + "position": { + "start": { "line": 3363, "column": 5, "offset": 91614 }, + "end": { "line": 3363, "column": 35, "offset": 91644 } + } + } + ], + "position": { + "start": { "line": 3363, "column": 1, "offset": 91610 }, + "end": { "line": 3363, "column": 35, "offset": 91644 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 3365, "column": 1, "offset": 91646 }, + "end": { "line": 3367, "column": 4, "offset": 91673 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "start", + "position": { + "start": { "line": 3369, "column": 3, "offset": 91677 }, + "end": { "line": 3369, "column": 10, "offset": 91684 } + } + }, + { + "type": "text", + "value": " {integer} Where the new ", + "position": { + "start": { "line": 3369, "column": 10, "offset": 91684 }, + "end": { "line": 3369, "column": 35, "offset": 91709 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 3369, "column": 35, "offset": 91709 }, + "end": { "line": 3369, "column": 43, "offset": 91717 } + } + }, + { + "type": "text", + "value": " will start. ", + "position": { + "start": { "line": 3369, "column": 43, "offset": 91717 }, + "end": { "line": 3369, "column": 56, "offset": 91730 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { + "line": 3369, + "column": 58, + "offset": 91732 + }, + "end": { "line": 3369, "column": 66, "offset": 91740 } + } + } + ], + "position": { + "start": { "line": 3369, "column": 56, "offset": 91730 }, + "end": { "line": 3369, "column": 68, "offset": 91742 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 3369, "column": 68, "offset": 91742 }, + "end": { "line": 3369, "column": 69, "offset": 91743 } + } + }, + { + "type": "inlineCode", + "value": "0", + "position": { + "start": { "line": 3369, "column": 69, "offset": 91743 }, + "end": { "line": 3369, "column": 72, "offset": 91746 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 3369, "column": 72, "offset": 91746 }, + "end": { "line": 3369, "column": 73, "offset": 91747 } + } + } + ], + "position": { + "start": { "line": 3369, "column": 3, "offset": 91677 }, + "end": { "line": 3369, "column": 73, "offset": 91747 } + } + } + ], + "position": { + "start": { "line": 3369, "column": 1, "offset": 91675 }, + "end": { "line": 3369, "column": 73, "offset": 91747 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "end", + "position": { + "start": { "line": 3370, "column": 3, "offset": 91750 }, + "end": { "line": 3370, "column": 8, "offset": 91755 } + } + }, + { + "type": "text", + "value": " {integer} Where the new ", + "position": { + "start": { "line": 3370, "column": 8, "offset": 91755 }, + "end": { "line": 3370, "column": 33, "offset": 91780 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 3370, "column": 33, "offset": 91780 }, + "end": { "line": 3370, "column": 41, "offset": 91788 } + } + }, + { + "type": "text", + "value": " will end (not inclusive).\n", + "position": { + "start": { "line": 3370, "column": 41, "offset": 91788 }, + "end": { "line": 3371, "column": 1, "offset": 91815 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { "line": 3371, "column": 5, "offset": 91819 }, + "end": { "line": 3371, "column": 13, "offset": 91827 } + } + } + ], + "position": { + "start": { "line": 3371, "column": 3, "offset": 91817 }, + "end": { "line": 3371, "column": 15, "offset": 91829 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 3371, "column": 15, "offset": 91829 }, + "end": { "line": 3371, "column": 16, "offset": 91830 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "buf.length", + "position": { + "start": { + "line": 3371, + "column": 17, + "offset": 91831 + }, + "end": { "line": 3371, "column": 29, "offset": 91843 } + } + } + ], + "position": { + "start": { "line": 3371, "column": 16, "offset": 91830 }, + "end": { "line": 3371, "column": 32, "offset": 91846 } + }, + "label": "`buf.length`", + "identifier": "`buf.length`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 3371, "column": 32, "offset": 91846 }, + "end": { "line": 3371, "column": 33, "offset": 91847 } + } + } + ], + "position": { + "start": { "line": 3370, "column": 3, "offset": 91750 }, + "end": { "line": 3371, "column": 33, "offset": 91847 } + } + } + ], + "position": { + "start": { "line": 3370, "column": 1, "offset": 91748 }, + "end": { "line": 3371, "column": 33, "offset": 91847 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {Buffer}", + "position": { + "start": { "line": 3372, "column": 3, "offset": 91850 }, + "end": { "line": 3372, "column": 20, "offset": 91867 } + } + } + ], + "position": { + "start": { "line": 3372, "column": 3, "offset": 91850 }, + "end": { "line": 3372, "column": 20, "offset": 91867 } + } + } + ], + "position": { + "start": { "line": 3372, "column": 1, "offset": 91848 }, + "end": { "line": 3372, "column": 20, "offset": 91867 } + } + } + ], + "position": { + "start": { "line": 3369, "column": 1, "offset": 91675 }, + "end": { "line": 3372, "column": 20, "offset": 91867 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns a new ", + "position": { + "start": { "line": 3374, "column": 1, "offset": 91869 }, + "end": { "line": 3374, "column": 15, "offset": 91883 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 3374, "column": 15, "offset": 91883 }, + "end": { "line": 3374, "column": 23, "offset": 91891 } + } + }, + { + "type": "text", + "value": " that references the same memory as the original, but\noffset and cropped by the ", + "position": { + "start": { "line": 3374, "column": 23, "offset": 91891 }, + "end": { "line": 3375, "column": 27, "offset": 91971 } + } + }, + { + "type": "inlineCode", + "value": "start", + "position": { + "start": { "line": 3375, "column": 27, "offset": 91971 }, + "end": { "line": 3375, "column": 34, "offset": 91978 } + } + }, + { + "type": "text", + "value": " and ", + "position": { + "start": { "line": 3375, "column": 34, "offset": 91978 }, + "end": { "line": 3375, "column": 39, "offset": 91983 } + } + }, + { + "type": "inlineCode", + "value": "end", + "position": { + "start": { "line": 3375, "column": 39, "offset": 91983 }, + "end": { "line": 3375, "column": 44, "offset": 91988 } + } + }, + { + "type": "text", + "value": " indexes.", + "position": { + "start": { "line": 3375, "column": 44, "offset": 91988 }, + "end": { "line": 3375, "column": 53, "offset": 91997 } + } + } + ], + "position": { + "start": { "line": 3374, "column": 1, "offset": 91869 }, + "end": { "line": 3375, "column": 53, "offset": 91997 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Specifying ", + "position": { + "start": { "line": 3377, "column": 1, "offset": 91999 }, + "end": { "line": 3377, "column": 12, "offset": 92010 } + } + }, + { + "type": "inlineCode", + "value": "end", + "position": { + "start": { "line": 3377, "column": 12, "offset": 92010 }, + "end": { "line": 3377, "column": 17, "offset": 92015 } + } + }, + { + "type": "text", + "value": " greater than ", + "position": { + "start": { "line": 3377, "column": 17, "offset": 92015 }, + "end": { "line": 3377, "column": 31, "offset": 92029 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "buf.length", + "position": { + "start": { "line": 3377, "column": 32, "offset": 92030 }, + "end": { "line": 3377, "column": 44, "offset": 92042 } + } + } + ], + "position": { + "start": { "line": 3377, "column": 31, "offset": 92029 }, + "end": { "line": 3377, "column": 47, "offset": 92045 } + }, + "label": "`buf.length`", + "identifier": "`buf.length`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": " will return the same result as\nthat of ", + "position": { + "start": { "line": 3377, "column": 47, "offset": 92045 }, + "end": { "line": 3378, "column": 9, "offset": 92085 } + } + }, + { + "type": "inlineCode", + "value": "end", + "position": { + "start": { "line": 3378, "column": 9, "offset": 92085 }, + "end": { "line": 3378, "column": 14, "offset": 92090 } + } + }, + { + "type": "text", + "value": " equal to ", + "position": { + "start": { "line": 3378, "column": 14, "offset": 92090 }, + "end": { "line": 3378, "column": 24, "offset": 92100 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "buf.length", + "position": { + "start": { "line": 3378, "column": 25, "offset": 92101 }, + "end": { "line": 3378, "column": 37, "offset": 92113 } + } + } + ], + "position": { + "start": { "line": 3378, "column": 24, "offset": 92100 }, + "end": { "line": 3378, "column": 40, "offset": 92116 } + }, + "label": "`buf.length`", + "identifier": "`buf.length`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 3378, "column": 40, "offset": 92116 }, + "end": { "line": 3378, "column": 41, "offset": 92117 } + } + } + ], + "position": { + "start": { "line": 3377, "column": 1, "offset": 91999 }, + "end": { "line": 3378, "column": 41, "offset": 92117 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "This method is inherited from ", + "position": { + "start": { "line": 3380, "column": 1, "offset": 92119 }, + "end": { "line": 3380, "column": 31, "offset": 92149 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "TypedArray.prototype.subarray()", + "position": { + "start": { "line": 3380, "column": 32, "offset": 92150 }, + "end": { "line": 3380, "column": 65, "offset": 92183 } + } + } + ], + "position": { + "start": { "line": 3380, "column": 31, "offset": 92149 }, + "end": { "line": 3380, "column": 68, "offset": 92186 } + }, + "label": "`TypedArray.prototype.subarray()`", + "identifier": "`typedarray.prototype.subarray()`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 3380, "column": 68, "offset": 92186 }, + "end": { "line": 3380, "column": 69, "offset": 92187 } + } + } + ], + "position": { + "start": { "line": 3380, "column": 1, "offset": 92119 }, + "end": { "line": 3380, "column": 69, "offset": 92187 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Modifying the new ", + "position": { + "start": { "line": 3382, "column": 1, "offset": 92189 }, + "end": { "line": 3382, "column": 19, "offset": 92207 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 3382, "column": 19, "offset": 92207 }, + "end": { "line": 3382, "column": 27, "offset": 92215 } + } + }, + { + "type": "text", + "value": " slice will modify the memory in the original ", + "position": { + "start": { "line": 3382, "column": 27, "offset": 92215 }, + "end": { "line": 3382, "column": 73, "offset": 92261 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 3382, "column": 73, "offset": 92261 }, + "end": { "line": 3382, "column": 81, "offset": 92269 } + } + }, + { + "type": "text", + "value": "\nbecause the allocated memory of the two objects overlap.", + "position": { + "start": { "line": 3382, "column": 81, "offset": 92269 }, + "end": { "line": 3383, "column": 57, "offset": 92326 } + } + } + ], + "position": { + "start": { "line": 3382, "column": 1, "offset": 92189 }, + "end": { "line": 3383, "column": 57, "offset": 92326 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\n// Create a `Buffer` with the ASCII alphabet, take a slice, and modify one byte\n// from the original `Buffer`.\n\nconst buf1 = Buffer.allocUnsafe(26);\n\nfor (let i = 0; i < 26; i++) {\n // 97 is the decimal ASCII value for 'a'.\n buf1[i] = i + 97;\n}\n\nconst buf2 = buf1.subarray(0, 3);\n\nconsole.log(buf2.toString('ascii', 0, buf2.length));\n// Prints: abc\n\nbuf1[0] = 33;\n\nconsole.log(buf2.toString('ascii', 0, buf2.length));\n// Prints: !bc", + "position": { + "start": { "line": 3385, "column": 1, "offset": 92328 }, + "end": { "line": 3407, "column": 4, "offset": 92812 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\n// Create a `Buffer` with the ASCII alphabet, take a slice, and modify one byte\n// from the original `Buffer`.\n\nconst buf1 = Buffer.allocUnsafe(26);\n\nfor (let i = 0; i < 26; i++) {\n // 97 is the decimal ASCII value for 'a'.\n buf1[i] = i + 97;\n}\n\nconst buf2 = buf1.subarray(0, 3);\n\nconsole.log(buf2.toString('ascii', 0, buf2.length));\n// Prints: abc\n\nbuf1[0] = 33;\n\nconsole.log(buf2.toString('ascii', 0, buf2.length));\n// Prints: !bc", + "position": { + "start": { "line": 3409, "column": 1, "offset": 92814 }, + "end": { "line": 3431, "column": 4, "offset": 93303 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Specifying negative indexes causes the slice to be generated relative to the\nend of ", + "position": { + "start": { "line": 3433, "column": 1, "offset": 93305 }, + "end": { "line": 3434, "column": 8, "offset": 93389 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 3434, "column": 8, "offset": 93389 }, + "end": { "line": 3434, "column": 13, "offset": 93394 } + } + }, + { + "type": "text", + "value": " rather than the beginning.", + "position": { + "start": { "line": 3434, "column": 13, "offset": 93394 }, + "end": { "line": 3434, "column": 40, "offset": 93421 } + } + } + ], + "position": { + "start": { "line": 3433, "column": 1, "offset": 93305 }, + "end": { "line": 3434, "column": 40, "offset": 93421 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from('buffer');\n\nconsole.log(buf.subarray(-6, -1).toString());\n// Prints: buffe\n// (Equivalent to buf.subarray(0, 5).)\n\nconsole.log(buf.subarray(-6, -2).toString());\n// Prints: buff\n// (Equivalent to buf.subarray(0, 4).)\n\nconsole.log(buf.subarray(-5, -2).toString());\n// Prints: uff\n// (Equivalent to buf.subarray(1, 4).)", + "position": { + "start": { "line": 3436, "column": 1, "offset": 93423 }, + "end": { "line": 3452, "column": 4, "offset": 93813 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from('buffer');\n\nconsole.log(buf.subarray(-6, -1).toString());\n// Prints: buffe\n// (Equivalent to buf.subarray(0, 5).)\n\nconsole.log(buf.subarray(-6, -2).toString());\n// Prints: buff\n// (Equivalent to buf.subarray(0, 4).)\n\nconsole.log(buf.subarray(-5, -2).toString());\n// Prints: uff\n// (Equivalent to buf.subarray(1, 4).)", + "position": { + "start": { "line": 3454, "column": 1, "offset": 93815 }, + "end": { "line": 3470, "column": 4, "offset": 94210 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.slice([start[, end]])", + "position": { + "start": { "line": 3472, "column": 5, "offset": 94216 }, + "end": { "line": 3472, "column": 32, "offset": 94243 } + } + } + ], + "position": { + "start": { "line": 3472, "column": 1, "offset": 94212 }, + "end": { "line": 3472, "column": 32, "offset": 94243 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 3474, "column": 1, "offset": 94245 }, + "end": { "line": 3492, "column": 4, "offset": 94847 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "start", + "position": { + "start": { "line": 3494, "column": 3, "offset": 94851 }, + "end": { "line": 3494, "column": 10, "offset": 94858 } + } + }, + { + "type": "text", + "value": " {integer} Where the new ", + "position": { + "start": { "line": 3494, "column": 10, "offset": 94858 }, + "end": { "line": 3494, "column": 35, "offset": 94883 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 3494, "column": 35, "offset": 94883 }, + "end": { "line": 3494, "column": 43, "offset": 94891 } + } + }, + { + "type": "text", + "value": " will start. ", + "position": { + "start": { "line": 3494, "column": 43, "offset": 94891 }, + "end": { "line": 3494, "column": 56, "offset": 94904 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { + "line": 3494, + "column": 58, + "offset": 94906 + }, + "end": { "line": 3494, "column": 66, "offset": 94914 } + } + } + ], + "position": { + "start": { "line": 3494, "column": 56, "offset": 94904 }, + "end": { "line": 3494, "column": 68, "offset": 94916 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 3494, "column": 68, "offset": 94916 }, + "end": { "line": 3494, "column": 69, "offset": 94917 } + } + }, + { + "type": "inlineCode", + "value": "0", + "position": { + "start": { "line": 3494, "column": 69, "offset": 94917 }, + "end": { "line": 3494, "column": 72, "offset": 94920 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 3494, "column": 72, "offset": 94920 }, + "end": { "line": 3494, "column": 73, "offset": 94921 } + } + } + ], + "position": { + "start": { "line": 3494, "column": 3, "offset": 94851 }, + "end": { "line": 3494, "column": 73, "offset": 94921 } + } + } + ], + "position": { + "start": { "line": 3494, "column": 1, "offset": 94849 }, + "end": { "line": 3494, "column": 73, "offset": 94921 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "end", + "position": { + "start": { "line": 3495, "column": 3, "offset": 94924 }, + "end": { "line": 3495, "column": 8, "offset": 94929 } + } + }, + { + "type": "text", + "value": " {integer} Where the new ", + "position": { + "start": { "line": 3495, "column": 8, "offset": 94929 }, + "end": { "line": 3495, "column": 33, "offset": 94954 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 3495, "column": 33, "offset": 94954 }, + "end": { "line": 3495, "column": 41, "offset": 94962 } + } + }, + { + "type": "text", + "value": " will end (not inclusive).\n", + "position": { + "start": { "line": 3495, "column": 41, "offset": 94962 }, + "end": { "line": 3496, "column": 1, "offset": 94989 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { "line": 3496, "column": 5, "offset": 94993 }, + "end": { "line": 3496, "column": 13, "offset": 95001 } + } + } + ], + "position": { + "start": { "line": 3496, "column": 3, "offset": 94991 }, + "end": { "line": 3496, "column": 15, "offset": 95003 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 3496, "column": 15, "offset": 95003 }, + "end": { "line": 3496, "column": 16, "offset": 95004 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "buf.length", + "position": { + "start": { + "line": 3496, + "column": 17, + "offset": 95005 + }, + "end": { "line": 3496, "column": 29, "offset": 95017 } + } + } + ], + "position": { + "start": { "line": 3496, "column": 16, "offset": 95004 }, + "end": { "line": 3496, "column": 32, "offset": 95020 } + }, + "label": "`buf.length`", + "identifier": "`buf.length`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 3496, "column": 32, "offset": 95020 }, + "end": { "line": 3496, "column": 33, "offset": 95021 } + } + } + ], + "position": { + "start": { "line": 3495, "column": 3, "offset": 94924 }, + "end": { "line": 3496, "column": 33, "offset": 95021 } + } + } + ], + "position": { + "start": { "line": 3495, "column": 1, "offset": 94922 }, + "end": { "line": 3496, "column": 33, "offset": 95021 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {Buffer}", + "position": { + "start": { "line": 3497, "column": 3, "offset": 95024 }, + "end": { "line": 3497, "column": 20, "offset": 95041 } + } + } + ], + "position": { + "start": { "line": 3497, "column": 3, "offset": 95024 }, + "end": { "line": 3497, "column": 20, "offset": 95041 } + } + } + ], + "position": { + "start": { "line": 3497, "column": 1, "offset": 95022 }, + "end": { "line": 3497, "column": 20, "offset": 95041 } + } + } + ], + "position": { + "start": { "line": 3494, "column": 1, "offset": 94849 }, + "end": { "line": 3497, "column": 20, "offset": 95041 } + } + }, + { + "type": "blockquote", + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Stability: 0 - Deprecated: Use ", + "position": { + "start": { "line": 3499, "column": 3, "offset": 95045 }, + "end": { "line": 3499, "column": 34, "offset": 95076 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "buf.subarray", + "position": { + "start": { "line": 3499, "column": 35, "offset": 95077 }, + "end": { "line": 3499, "column": 49, "offset": 95091 } + } + } + ], + "position": { + "start": { "line": 3499, "column": 34, "offset": 95076 }, + "end": { "line": 3499, "column": 52, "offset": 95094 } + }, + "label": "`buf.subarray`", + "identifier": "`buf.subarray`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": " instead.", + "position": { + "start": { "line": 3499, "column": 52, "offset": 95094 }, + "end": { "line": 3499, "column": 61, "offset": 95103 } + } + } + ], + "position": { + "start": { "line": 3499, "column": 3, "offset": 95045 }, + "end": { "line": 3499, "column": 61, "offset": 95103 } + } + } + ], + "position": { + "start": { "line": 3499, "column": 1, "offset": 95043 }, + "end": { "line": 3499, "column": 61, "offset": 95103 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns a new ", + "position": { + "start": { "line": 3501, "column": 1, "offset": 95105 }, + "end": { "line": 3501, "column": 15, "offset": 95119 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 3501, "column": 15, "offset": 95119 }, + "end": { "line": 3501, "column": 23, "offset": 95127 } + } + }, + { + "type": "text", + "value": " that references the same memory as the original, but\noffset and cropped by the ", + "position": { + "start": { "line": 3501, "column": 23, "offset": 95127 }, + "end": { "line": 3502, "column": 27, "offset": 95207 } + } + }, + { + "type": "inlineCode", + "value": "start", + "position": { + "start": { "line": 3502, "column": 27, "offset": 95207 }, + "end": { "line": 3502, "column": 34, "offset": 95214 } + } + }, + { + "type": "text", + "value": " and ", + "position": { + "start": { "line": 3502, "column": 34, "offset": 95214 }, + "end": { "line": 3502, "column": 39, "offset": 95219 } + } + }, + { + "type": "inlineCode", + "value": "end", + "position": { + "start": { "line": 3502, "column": 39, "offset": 95219 }, + "end": { "line": 3502, "column": 44, "offset": 95224 } + } + }, + { + "type": "text", + "value": " indexes.", + "position": { + "start": { "line": 3502, "column": 44, "offset": 95224 }, + "end": { "line": 3502, "column": 53, "offset": 95233 } + } + } + ], + "position": { + "start": { "line": 3501, "column": 1, "offset": 95105 }, + "end": { "line": 3502, "column": 53, "offset": 95233 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "This method is not compatible with the ", + "position": { + "start": { "line": 3504, "column": 1, "offset": 95235 }, + "end": { "line": 3504, "column": 40, "offset": 95274 } + } + }, + { + "type": "inlineCode", + "value": "Uint8Array.prototype.slice()", + "position": { + "start": { "line": 3504, "column": 40, "offset": 95274 }, + "end": { "line": 3504, "column": 70, "offset": 95304 } + } + }, + { + "type": "text", + "value": ",\nwhich is a superclass of ", + "position": { + "start": { "line": 3504, "column": 70, "offset": 95304 }, + "end": { "line": 3505, "column": 26, "offset": 95331 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 3505, "column": 26, "offset": 95331 }, + "end": { "line": 3505, "column": 34, "offset": 95339 } + } + }, + { + "type": "text", + "value": ". To copy the slice, use\n", + "position": { + "start": { "line": 3505, "column": 34, "offset": 95339 }, + "end": { "line": 3506, "column": 1, "offset": 95364 } + } + }, + { + "type": "inlineCode", + "value": "Uint8Array.prototype.slice()", + "position": { + "start": { "line": 3506, "column": 1, "offset": 95364 }, + "end": { "line": 3506, "column": 31, "offset": 95394 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 3506, "column": 31, "offset": 95394 }, + "end": { "line": 3506, "column": 32, "offset": 95395 } + } + } + ], + "position": { + "start": { "line": 3504, "column": 1, "offset": 95235 }, + "end": { "line": 3506, "column": 32, "offset": 95395 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from('buffer');\n\nconst copiedBuf = Uint8Array.prototype.slice.call(buf);\ncopiedBuf[0]++;\nconsole.log(copiedBuf.toString());\n// Prints: cuffer\n\nconsole.log(buf.toString());\n// Prints: buffer\n\n// With buf.slice(), the original buffer is modified.\nconst notReallyCopiedBuf = buf.slice();\nnotReallyCopiedBuf[0]++;\nconsole.log(notReallyCopiedBuf.toString());\n// Prints: cuffer\nconsole.log(buf.toString());\n// Also prints: cuffer (!)", + "position": { + "start": { "line": 3508, "column": 1, "offset": 95397 }, + "end": { "line": 3528, "column": 4, "offset": 95893 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from('buffer');\n\nconst copiedBuf = Uint8Array.prototype.slice.call(buf);\ncopiedBuf[0]++;\nconsole.log(copiedBuf.toString());\n// Prints: cuffer\n\nconsole.log(buf.toString());\n// Prints: buffer\n\n// With buf.slice(), the original buffer is modified.\nconst notReallyCopiedBuf = buf.slice();\nnotReallyCopiedBuf[0]++;\nconsole.log(notReallyCopiedBuf.toString());\n// Prints: cuffer\nconsole.log(buf.toString());\n// Also prints: cuffer (!)", + "position": { + "start": { "line": 3530, "column": 1, "offset": 95895 }, + "end": { "line": 3550, "column": 4, "offset": 96396 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.swap16()", + "position": { + "start": { "line": 3552, "column": 5, "offset": 96402 }, + "end": { "line": 3552, "column": 19, "offset": 96416 } + } + } + ], + "position": { + "start": { "line": 3552, "column": 1, "offset": 96398 }, + "end": { "line": 3552, "column": 19, "offset": 96416 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 3554, "column": 1, "offset": 96418 }, + "end": { "line": 3556, "column": 4, "offset": 96446 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {Buffer} A reference to ", + "position": { + "start": { "line": 3558, "column": 3, "offset": 96450 }, + "end": { "line": 3558, "column": 36, "offset": 96483 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 3558, "column": 36, "offset": 96483 }, + "end": { "line": 3558, "column": 41, "offset": 96488 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 3558, "column": 41, "offset": 96488 }, + "end": { "line": 3558, "column": 42, "offset": 96489 } + } + } + ], + "position": { + "start": { "line": 3558, "column": 3, "offset": 96450 }, + "end": { "line": 3558, "column": 42, "offset": 96489 } + } + } + ], + "position": { + "start": { "line": 3558, "column": 1, "offset": 96448 }, + "end": { "line": 3558, "column": 42, "offset": 96489 } + } + } + ], + "position": { + "start": { "line": 3558, "column": 1, "offset": 96448 }, + "end": { "line": 3558, "column": 42, "offset": 96489 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Interprets ", + "position": { + "start": { "line": 3560, "column": 1, "offset": 96491 }, + "end": { "line": 3560, "column": 12, "offset": 96502 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 3560, "column": 12, "offset": 96502 }, + "end": { "line": 3560, "column": 17, "offset": 96507 } + } + }, + { + "type": "text", + "value": " as an array of unsigned 16-bit integers and swaps the\nbyte order ", + "position": { + "start": { "line": 3560, "column": 17, "offset": 96507 }, + "end": { "line": 3561, "column": 12, "offset": 96573 } + } + }, + { + "type": "emphasis", + "children": [ + { + "type": "text", + "value": "in-place", + "position": { + "start": { "line": 3561, "column": 13, "offset": 96574 }, + "end": { "line": 3561, "column": 21, "offset": 96582 } + } + } + ], + "position": { + "start": { "line": 3561, "column": 12, "offset": 96573 }, + "end": { "line": 3561, "column": 22, "offset": 96583 } + } + }, + { + "type": "text", + "value": ". Throws ", + "position": { + "start": { "line": 3561, "column": 22, "offset": 96583 }, + "end": { "line": 3561, "column": 31, "offset": 96592 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "ERR_INVALID_BUFFER_SIZE", + "position": { + "start": { "line": 3561, "column": 32, "offset": 96593 }, + "end": { "line": 3561, "column": 57, "offset": 96618 } + } + } + ], + "position": { + "start": { "line": 3561, "column": 31, "offset": 96592 }, + "end": { "line": 3561, "column": 60, "offset": 96621 } + }, + "label": "`ERR_INVALID_BUFFER_SIZE`", + "identifier": "`err_invalid_buffer_size`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": " if ", + "position": { + "start": { "line": 3561, "column": 60, "offset": 96621 }, + "end": { "line": 3561, "column": 64, "offset": 96625 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "buf.length", + "position": { + "start": { "line": 3561, "column": 65, "offset": 96626 }, + "end": { "line": 3561, "column": 77, "offset": 96638 } + } + } + ], + "position": { + "start": { "line": 3561, "column": 64, "offset": 96625 }, + "end": { "line": 3561, "column": 80, "offset": 96641 } + }, + "label": "`buf.length`", + "identifier": "`buf.length`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": "\nis not a multiple of 2.", + "position": { + "start": { "line": 3561, "column": 80, "offset": 96641 }, + "end": { "line": 3562, "column": 24, "offset": 96665 } + } + } + ], + "position": { + "start": { "line": 3560, "column": 1, "offset": 96491 }, + "end": { "line": 3562, "column": 24, "offset": 96665 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf1 = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8]);\n\nconsole.log(buf1);\n// Prints: \n\nbuf1.swap16();\n\nconsole.log(buf1);\n// Prints: \n\nconst buf2 = Buffer.from([0x1, 0x2, 0x3]);\n\nbuf2.swap16();\n// Throws ERR_INVALID_BUFFER_SIZE.", + "position": { + "start": { "line": 3564, "column": 1, "offset": 96667 }, + "end": { "line": 3581, "column": 4, "offset": 97023 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf1 = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8]);\n\nconsole.log(buf1);\n// Prints: \n\nbuf1.swap16();\n\nconsole.log(buf1);\n// Prints: \n\nconst buf2 = Buffer.from([0x1, 0x2, 0x3]);\n\nbuf2.swap16();\n// Throws ERR_INVALID_BUFFER_SIZE.", + "position": { + "start": { "line": 3583, "column": 1, "offset": 97025 }, + "end": { "line": 3600, "column": 4, "offset": 97386 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "One convenient use of ", + "position": { + "start": { "line": 3602, "column": 1, "offset": 97388 }, + "end": { "line": 3602, "column": 23, "offset": 97410 } + } + }, + { + "type": "inlineCode", + "value": "buf.swap16()", + "position": { + "start": { "line": 3602, "column": 23, "offset": 97410 }, + "end": { "line": 3602, "column": 37, "offset": 97424 } + } + }, + { + "type": "text", + "value": " is to perform a fast in-place conversion\nbetween UTF-16 little-endian and UTF-16 big-endian:", + "position": { + "start": { "line": 3602, "column": 37, "offset": 97424 }, + "end": { "line": 3603, "column": 52, "offset": 97517 } + } + } + ], + "position": { + "start": { "line": 3602, "column": 1, "offset": 97388 }, + "end": { "line": 3603, "column": 52, "offset": 97517 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from('This is little-endian UTF-16', 'utf16le');\nbuf.swap16(); // Convert to big-endian UTF-16 text.", + "position": { + "start": { "line": 3605, "column": 1, "offset": 97519 }, + "end": { "line": 3610, "column": 4, "offset": 97688 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from('This is little-endian UTF-16', 'utf16le');\nbuf.swap16(); // Convert to big-endian UTF-16 text.", + "position": { + "start": { "line": 3612, "column": 1, "offset": 97690 }, + "end": { "line": 3617, "column": 4, "offset": 97864 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.swap32()", + "position": { + "start": { "line": 3619, "column": 5, "offset": 97870 }, + "end": { "line": 3619, "column": 19, "offset": 97884 } + } + } + ], + "position": { + "start": { "line": 3619, "column": 1, "offset": 97866 }, + "end": { "line": 3619, "column": 19, "offset": 97884 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 3621, "column": 1, "offset": 97886 }, + "end": { "line": 3623, "column": 4, "offset": 97914 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {Buffer} A reference to ", + "position": { + "start": { "line": 3625, "column": 3, "offset": 97918 }, + "end": { "line": 3625, "column": 36, "offset": 97951 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 3625, "column": 36, "offset": 97951 }, + "end": { "line": 3625, "column": 41, "offset": 97956 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 3625, "column": 41, "offset": 97956 }, + "end": { "line": 3625, "column": 42, "offset": 97957 } + } + } + ], + "position": { + "start": { "line": 3625, "column": 3, "offset": 97918 }, + "end": { "line": 3625, "column": 42, "offset": 97957 } + } + } + ], + "position": { + "start": { "line": 3625, "column": 1, "offset": 97916 }, + "end": { "line": 3625, "column": 42, "offset": 97957 } + } + } + ], + "position": { + "start": { "line": 3625, "column": 1, "offset": 97916 }, + "end": { "line": 3625, "column": 42, "offset": 97957 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Interprets ", + "position": { + "start": { "line": 3627, "column": 1, "offset": 97959 }, + "end": { "line": 3627, "column": 12, "offset": 97970 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 3627, "column": 12, "offset": 97970 }, + "end": { "line": 3627, "column": 17, "offset": 97975 } + } + }, + { + "type": "text", + "value": " as an array of unsigned 32-bit integers and swaps the\nbyte order ", + "position": { + "start": { "line": 3627, "column": 17, "offset": 97975 }, + "end": { "line": 3628, "column": 12, "offset": 98041 } + } + }, + { + "type": "emphasis", + "children": [ + { + "type": "text", + "value": "in-place", + "position": { + "start": { "line": 3628, "column": 13, "offset": 98042 }, + "end": { "line": 3628, "column": 21, "offset": 98050 } + } + } + ], + "position": { + "start": { "line": 3628, "column": 12, "offset": 98041 }, + "end": { "line": 3628, "column": 22, "offset": 98051 } + } + }, + { + "type": "text", + "value": ". Throws ", + "position": { + "start": { "line": 3628, "column": 22, "offset": 98051 }, + "end": { "line": 3628, "column": 31, "offset": 98060 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "ERR_INVALID_BUFFER_SIZE", + "position": { + "start": { "line": 3628, "column": 32, "offset": 98061 }, + "end": { "line": 3628, "column": 57, "offset": 98086 } + } + } + ], + "position": { + "start": { "line": 3628, "column": 31, "offset": 98060 }, + "end": { "line": 3628, "column": 60, "offset": 98089 } + }, + "label": "`ERR_INVALID_BUFFER_SIZE`", + "identifier": "`err_invalid_buffer_size`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": " if ", + "position": { + "start": { "line": 3628, "column": 60, "offset": 98089 }, + "end": { "line": 3628, "column": 64, "offset": 98093 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "buf.length", + "position": { + "start": { "line": 3628, "column": 65, "offset": 98094 }, + "end": { "line": 3628, "column": 77, "offset": 98106 } + } + } + ], + "position": { + "start": { "line": 3628, "column": 64, "offset": 98093 }, + "end": { "line": 3628, "column": 80, "offset": 98109 } + }, + "label": "`buf.length`", + "identifier": "`buf.length`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": "\nis not a multiple of 4.", + "position": { + "start": { "line": 3628, "column": 80, "offset": 98109 }, + "end": { "line": 3629, "column": 24, "offset": 98133 } + } + } + ], + "position": { + "start": { "line": 3627, "column": 1, "offset": 97959 }, + "end": { "line": 3629, "column": 24, "offset": 98133 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf1 = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8]);\n\nconsole.log(buf1);\n// Prints: \n\nbuf1.swap32();\n\nconsole.log(buf1);\n// Prints: \n\nconst buf2 = Buffer.from([0x1, 0x2, 0x3]);\n\nbuf2.swap32();\n// Throws ERR_INVALID_BUFFER_SIZE.", + "position": { + "start": { "line": 3631, "column": 1, "offset": 98135 }, + "end": { "line": 3648, "column": 4, "offset": 98491 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf1 = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8]);\n\nconsole.log(buf1);\n// Prints: \n\nbuf1.swap32();\n\nconsole.log(buf1);\n// Prints: \n\nconst buf2 = Buffer.from([0x1, 0x2, 0x3]);\n\nbuf2.swap32();\n// Throws ERR_INVALID_BUFFER_SIZE.", + "position": { + "start": { "line": 3650, "column": 1, "offset": 98493 }, + "end": { "line": 3667, "column": 4, "offset": 98854 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.swap64()", + "position": { + "start": { "line": 3669, "column": 5, "offset": 98860 }, + "end": { "line": 3669, "column": 19, "offset": 98874 } + } + } + ], + "position": { + "start": { "line": 3669, "column": 1, "offset": 98856 }, + "end": { "line": 3669, "column": 19, "offset": 98874 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 3671, "column": 1, "offset": 98876 }, + "end": { "line": 3673, "column": 4, "offset": 98903 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {Buffer} A reference to ", + "position": { + "start": { "line": 3675, "column": 3, "offset": 98907 }, + "end": { "line": 3675, "column": 36, "offset": 98940 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 3675, "column": 36, "offset": 98940 }, + "end": { "line": 3675, "column": 41, "offset": 98945 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 3675, "column": 41, "offset": 98945 }, + "end": { "line": 3675, "column": 42, "offset": 98946 } + } + } + ], + "position": { + "start": { "line": 3675, "column": 3, "offset": 98907 }, + "end": { "line": 3675, "column": 42, "offset": 98946 } + } + } + ], + "position": { + "start": { "line": 3675, "column": 1, "offset": 98905 }, + "end": { "line": 3675, "column": 42, "offset": 98946 } + } + } + ], + "position": { + "start": { "line": 3675, "column": 1, "offset": 98905 }, + "end": { "line": 3675, "column": 42, "offset": 98946 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Interprets ", + "position": { + "start": { "line": 3677, "column": 1, "offset": 98948 }, + "end": { "line": 3677, "column": 12, "offset": 98959 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 3677, "column": 12, "offset": 98959 }, + "end": { "line": 3677, "column": 17, "offset": 98964 } + } + }, + { + "type": "text", + "value": " as an array of 64-bit numbers and swaps byte order ", + "position": { + "start": { "line": 3677, "column": 17, "offset": 98964 }, + "end": { "line": 3677, "column": 69, "offset": 99016 } + } + }, + { + "type": "emphasis", + "children": [ + { + "type": "text", + "value": "in-place", + "position": { + "start": { "line": 3677, "column": 70, "offset": 99017 }, + "end": { "line": 3677, "column": 78, "offset": 99025 } + } + } + ], + "position": { + "start": { "line": 3677, "column": 69, "offset": 99016 }, + "end": { "line": 3677, "column": 79, "offset": 99026 } + } + }, + { + "type": "text", + "value": ".\nThrows ", + "position": { + "start": { "line": 3677, "column": 79, "offset": 99026 }, + "end": { "line": 3678, "column": 8, "offset": 99035 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "ERR_INVALID_BUFFER_SIZE", + "position": { + "start": { "line": 3678, "column": 9, "offset": 99036 }, + "end": { "line": 3678, "column": 34, "offset": 99061 } + } + } + ], + "position": { + "start": { "line": 3678, "column": 8, "offset": 99035 }, + "end": { "line": 3678, "column": 37, "offset": 99064 } + }, + "label": "`ERR_INVALID_BUFFER_SIZE`", + "identifier": "`err_invalid_buffer_size`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": " if ", + "position": { + "start": { "line": 3678, "column": 37, "offset": 99064 }, + "end": { "line": 3678, "column": 41, "offset": 99068 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "buf.length", + "position": { + "start": { "line": 3678, "column": 42, "offset": 99069 }, + "end": { "line": 3678, "column": 54, "offset": 99081 } + } + } + ], + "position": { + "start": { "line": 3678, "column": 41, "offset": 99068 }, + "end": { "line": 3678, "column": 57, "offset": 99084 } + }, + "label": "`buf.length`", + "identifier": "`buf.length`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": " is not a multiple of 8.", + "position": { + "start": { "line": 3678, "column": 57, "offset": 99084 }, + "end": { "line": 3678, "column": 81, "offset": 99108 } + } + } + ], + "position": { + "start": { "line": 3677, "column": 1, "offset": 98948 }, + "end": { "line": 3678, "column": 81, "offset": 99108 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf1 = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8]);\n\nconsole.log(buf1);\n// Prints: \n\nbuf1.swap64();\n\nconsole.log(buf1);\n// Prints: \n\nconst buf2 = Buffer.from([0x1, 0x2, 0x3]);\n\nbuf2.swap64();\n// Throws ERR_INVALID_BUFFER_SIZE.", + "position": { + "start": { "line": 3680, "column": 1, "offset": 99110 }, + "end": { "line": 3697, "column": 4, "offset": 99466 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf1 = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8]);\n\nconsole.log(buf1);\n// Prints: \n\nbuf1.swap64();\n\nconsole.log(buf1);\n// Prints: \n\nconst buf2 = Buffer.from([0x1, 0x2, 0x3]);\n\nbuf2.swap64();\n// Throws ERR_INVALID_BUFFER_SIZE.", + "position": { + "start": { "line": 3699, "column": 1, "offset": 99468 }, + "end": { "line": 3716, "column": 4, "offset": 99829 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.toJSON()", + "position": { + "start": { "line": 3718, "column": 5, "offset": 99835 }, + "end": { "line": 3718, "column": 19, "offset": 99849 } + } + } + ], + "position": { + "start": { "line": 3718, "column": 1, "offset": 99831 }, + "end": { "line": 3718, "column": 19, "offset": 99849 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 3720, "column": 1, "offset": 99851 }, + "end": { "line": 3722, "column": 4, "offset": 99878 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {Object}", + "position": { + "start": { "line": 3724, "column": 3, "offset": 99882 }, + "end": { "line": 3724, "column": 20, "offset": 99899 } + } + } + ], + "position": { + "start": { "line": 3724, "column": 3, "offset": 99882 }, + "end": { "line": 3724, "column": 20, "offset": 99899 } + } + } + ], + "position": { + "start": { "line": 3724, "column": 1, "offset": 99880 }, + "end": { "line": 3724, "column": 20, "offset": 99899 } + } + } + ], + "position": { + "start": { "line": 3724, "column": 1, "offset": 99880 }, + "end": { "line": 3724, "column": 20, "offset": 99899 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns a JSON representation of ", + "position": { + "start": { "line": 3726, "column": 1, "offset": 99901 }, + "end": { "line": 3726, "column": 34, "offset": 99934 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 3726, "column": 34, "offset": 99934 }, + "end": { "line": 3726, "column": 39, "offset": 99939 } + } + }, + { + "type": "text", + "value": ". ", + "position": { + "start": { "line": 3726, "column": 39, "offset": 99939 }, + "end": { "line": 3726, "column": 41, "offset": 99941 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "JSON.stringify()", + "position": { + "start": { "line": 3726, "column": 42, "offset": 99942 }, + "end": { "line": 3726, "column": 60, "offset": 99960 } + } + } + ], + "position": { + "start": { "line": 3726, "column": 41, "offset": 99941 }, + "end": { "line": 3726, "column": 63, "offset": 99963 } + }, + "label": "`JSON.stringify()`", + "identifier": "`json.stringify()`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": " implicitly calls\nthis function when stringifying a ", + "position": { + "start": { "line": 3726, "column": 63, "offset": 99963 }, + "end": { "line": 3727, "column": 35, "offset": 100015 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 3727, "column": 35, "offset": 100015 }, + "end": { "line": 3727, "column": 43, "offset": 100023 } + } + }, + { + "type": "text", + "value": " instance.", + "position": { + "start": { "line": 3727, "column": 43, "offset": 100023 }, + "end": { "line": 3727, "column": 53, "offset": 100033 } + } + } + ], + "position": { + "start": { "line": 3726, "column": 1, "offset": 99901 }, + "end": { "line": 3727, "column": 53, "offset": 100033 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "Buffer.from()", + "position": { + "start": { "line": 3729, "column": 1, "offset": 100035 }, + "end": { "line": 3729, "column": 16, "offset": 100050 } + } + }, + { + "type": "text", + "value": " accepts objects in the format returned from this method.\nIn particular, ", + "position": { + "start": { "line": 3729, "column": 16, "offset": 100050 }, + "end": { "line": 3730, "column": 16, "offset": 100123 } + } + }, + { + "type": "inlineCode", + "value": "Buffer.from(buf.toJSON())", + "position": { + "start": { "line": 3730, "column": 16, "offset": 100123 }, + "end": { "line": 3730, "column": 43, "offset": 100150 } + } + }, + { + "type": "text", + "value": " works like ", + "position": { + "start": { "line": 3730, "column": 43, "offset": 100150 }, + "end": { "line": 3730, "column": 55, "offset": 100162 } + } + }, + { + "type": "inlineCode", + "value": "Buffer.from(buf)", + "position": { + "start": { "line": 3730, "column": 55, "offset": 100162 }, + "end": { "line": 3730, "column": 73, "offset": 100180 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 3730, "column": 73, "offset": 100180 }, + "end": { "line": 3730, "column": 74, "offset": 100181 } + } + } + ], + "position": { + "start": { "line": 3729, "column": 1, "offset": 100035 }, + "end": { "line": 3730, "column": 74, "offset": 100181 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5]);\nconst json = JSON.stringify(buf);\n\nconsole.log(json);\n// Prints: {\"type\":\"Buffer\",\"data\":[1,2,3,4,5]}\n\nconst copy = JSON.parse(json, (key, value) => {\n return value && value.type === 'Buffer' ?\n Buffer.from(value) :\n value;\n});\n\nconsole.log(copy);\n// Prints: ", + "position": { + "start": { "line": 3732, "column": 1, "offset": 100183 }, + "end": { "line": 3749, "column": 4, "offset": 100574 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5]);\nconst json = JSON.stringify(buf);\n\nconsole.log(json);\n// Prints: {\"type\":\"Buffer\",\"data\":[1,2,3,4,5]}\n\nconst copy = JSON.parse(json, (key, value) => {\n return value && value.type === 'Buffer' ?\n Buffer.from(value) :\n value;\n});\n\nconsole.log(copy);\n// Prints: ", + "position": { + "start": { "line": 3751, "column": 1, "offset": 100576 }, + "end": { "line": 3768, "column": 4, "offset": 100972 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.toString([encoding[, start[, end]]])", + "position": { + "start": { "line": 3770, "column": 5, "offset": 100978 }, + "end": { "line": 3770, "column": 47, "offset": 101020 } + } + } + ], + "position": { + "start": { "line": 3770, "column": 1, "offset": 100974 }, + "end": { "line": 3770, "column": 47, "offset": 101020 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 3772, "column": 1, "offset": 101022 }, + "end": { "line": 3774, "column": 4, "offset": 101050 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "encoding", + "position": { + "start": { "line": 3776, "column": 3, "offset": 101054 }, + "end": { "line": 3776, "column": 13, "offset": 101064 } + } + }, + { + "type": "text", + "value": " {string} The character encoding to use. ", + "position": { + "start": { "line": 3776, "column": 13, "offset": 101064 }, + "end": { "line": 3776, "column": 54, "offset": 101105 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { + "line": 3776, + "column": 56, + "offset": 101107 + }, + "end": { "line": 3776, "column": 64, "offset": 101115 } + } + } + ], + "position": { + "start": { "line": 3776, "column": 54, "offset": 101105 }, + "end": { "line": 3776, "column": 66, "offset": 101117 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 3776, "column": 66, "offset": 101117 }, + "end": { "line": 3776, "column": 67, "offset": 101118 } + } + }, + { + "type": "inlineCode", + "value": "'utf8'", + "position": { + "start": { "line": 3776, "column": 67, "offset": 101118 }, + "end": { "line": 3776, "column": 75, "offset": 101126 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 3776, "column": 75, "offset": 101126 }, + "end": { "line": 3776, "column": 76, "offset": 101127 } + } + } + ], + "position": { + "start": { "line": 3776, "column": 3, "offset": 101054 }, + "end": { "line": 3776, "column": 76, "offset": 101127 } + } + } + ], + "position": { + "start": { "line": 3776, "column": 1, "offset": 101052 }, + "end": { "line": 3776, "column": 76, "offset": 101127 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "start", + "position": { + "start": { "line": 3777, "column": 3, "offset": 101130 }, + "end": { "line": 3777, "column": 10, "offset": 101137 } + } + }, + { + "type": "text", + "value": " {integer} The byte offset to start decoding at. ", + "position": { + "start": { "line": 3777, "column": 10, "offset": 101137 }, + "end": { "line": 3777, "column": 59, "offset": 101186 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { + "line": 3777, + "column": 61, + "offset": 101188 + }, + "end": { "line": 3777, "column": 69, "offset": 101196 } + } + } + ], + "position": { + "start": { "line": 3777, "column": 59, "offset": 101186 }, + "end": { "line": 3777, "column": 71, "offset": 101198 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 3777, "column": 71, "offset": 101198 }, + "end": { "line": 3777, "column": 72, "offset": 101199 } + } + }, + { + "type": "inlineCode", + "value": "0", + "position": { + "start": { "line": 3777, "column": 72, "offset": 101199 }, + "end": { "line": 3777, "column": 75, "offset": 101202 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 3777, "column": 75, "offset": 101202 }, + "end": { "line": 3777, "column": 76, "offset": 101203 } + } + } + ], + "position": { + "start": { "line": 3777, "column": 3, "offset": 101130 }, + "end": { "line": 3777, "column": 76, "offset": 101203 } + } + } + ], + "position": { + "start": { "line": 3777, "column": 1, "offset": 101128 }, + "end": { "line": 3777, "column": 76, "offset": 101203 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "end", + "position": { + "start": { "line": 3778, "column": 3, "offset": 101206 }, + "end": { "line": 3778, "column": 8, "offset": 101211 } + } + }, + { + "type": "text", + "value": " {integer} The byte offset to stop decoding at (not inclusive).\n", + "position": { + "start": { "line": 3778, "column": 8, "offset": 101211 }, + "end": { "line": 3779, "column": 1, "offset": 101275 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { + "line": 3779, + "column": 5, + "offset": 101279 + }, + "end": { "line": 3779, "column": 13, "offset": 101287 } + } + } + ], + "position": { + "start": { "line": 3779, "column": 3, "offset": 101277 }, + "end": { "line": 3779, "column": 15, "offset": 101289 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 3779, "column": 15, "offset": 101289 }, + "end": { "line": 3779, "column": 16, "offset": 101290 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "buf.length", + "position": { + "start": { + "line": 3779, + "column": 17, + "offset": 101291 + }, + "end": { "line": 3779, "column": 29, "offset": 101303 } + } + } + ], + "position": { + "start": { "line": 3779, "column": 16, "offset": 101290 }, + "end": { "line": 3779, "column": 32, "offset": 101306 } + }, + "label": "`buf.length`", + "identifier": "`buf.length`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 3779, "column": 32, "offset": 101306 }, + "end": { "line": 3779, "column": 33, "offset": 101307 } + } + } + ], + "position": { + "start": { "line": 3778, "column": 3, "offset": 101206 }, + "end": { "line": 3779, "column": 33, "offset": 101307 } + } + } + ], + "position": { + "start": { "line": 3778, "column": 1, "offset": 101204 }, + "end": { "line": 3779, "column": 33, "offset": 101307 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {string}", + "position": { + "start": { "line": 3780, "column": 3, "offset": 101310 }, + "end": { "line": 3780, "column": 20, "offset": 101327 } + } + } + ], + "position": { + "start": { "line": 3780, "column": 3, "offset": 101310 }, + "end": { "line": 3780, "column": 20, "offset": 101327 } + } + } + ], + "position": { + "start": { "line": 3780, "column": 1, "offset": 101308 }, + "end": { "line": 3780, "column": 20, "offset": 101327 } + } + } + ], + "position": { + "start": { "line": 3776, "column": 1, "offset": 101052 }, + "end": { "line": 3780, "column": 20, "offset": 101327 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Decodes ", + "position": { + "start": { "line": 3782, "column": 1, "offset": 101329 }, + "end": { "line": 3782, "column": 9, "offset": 101337 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 3782, "column": 9, "offset": 101337 }, + "end": { "line": 3782, "column": 14, "offset": 101342 } + } + }, + { + "type": "text", + "value": " to a string according to the specified character encoding in\n", + "position": { + "start": { "line": 3782, "column": 14, "offset": 101342 }, + "end": { "line": 3783, "column": 1, "offset": 101404 } + } + }, + { + "type": "inlineCode", + "value": "encoding", + "position": { + "start": { "line": 3783, "column": 1, "offset": 101404 }, + "end": { "line": 3783, "column": 11, "offset": 101414 } + } + }, + { + "type": "text", + "value": ". ", + "position": { + "start": { "line": 3783, "column": 11, "offset": 101414 }, + "end": { "line": 3783, "column": 13, "offset": 101416 } + } + }, + { + "type": "inlineCode", + "value": "start", + "position": { + "start": { "line": 3783, "column": 13, "offset": 101416 }, + "end": { "line": 3783, "column": 20, "offset": 101423 } + } + }, + { + "type": "text", + "value": " and ", + "position": { + "start": { "line": 3783, "column": 20, "offset": 101423 }, + "end": { "line": 3783, "column": 25, "offset": 101428 } + } + }, + { + "type": "inlineCode", + "value": "end", + "position": { + "start": { "line": 3783, "column": 25, "offset": 101428 }, + "end": { "line": 3783, "column": 30, "offset": 101433 } + } + }, + { + "type": "text", + "value": " may be passed to decode only a subset of ", + "position": { + "start": { "line": 3783, "column": 30, "offset": 101433 }, + "end": { "line": 3783, "column": 72, "offset": 101475 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 3783, "column": 72, "offset": 101475 }, + "end": { "line": 3783, "column": 77, "offset": 101480 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 3783, "column": 77, "offset": 101480 }, + "end": { "line": 3783, "column": 78, "offset": 101481 } + } + } + ], + "position": { + "start": { "line": 3782, "column": 1, "offset": 101329 }, + "end": { "line": 3783, "column": 78, "offset": 101481 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "If ", + "position": { + "start": { "line": 3785, "column": 1, "offset": 101483 }, + "end": { "line": 3785, "column": 4, "offset": 101486 } + } + }, + { + "type": "inlineCode", + "value": "encoding", + "position": { + "start": { "line": 3785, "column": 4, "offset": 101486 }, + "end": { "line": 3785, "column": 14, "offset": 101496 } + } + }, + { + "type": "text", + "value": " is ", + "position": { + "start": { "line": 3785, "column": 14, "offset": 101496 }, + "end": { "line": 3785, "column": 18, "offset": 101500 } + } + }, + { + "type": "inlineCode", + "value": "'utf8'", + "position": { + "start": { "line": 3785, "column": 18, "offset": 101500 }, + "end": { "line": 3785, "column": 26, "offset": 101508 } + } + }, + { + "type": "text", + "value": " and a byte sequence in the input is not valid UTF-8,\nthen each invalid byte is replaced with the replacement character ", + "position": { + "start": { "line": 3785, "column": 26, "offset": 101508 }, + "end": { "line": 3786, "column": 67, "offset": 101628 } + } + }, + { + "type": "inlineCode", + "value": "U+FFFD", + "position": { + "start": { "line": 3786, "column": 67, "offset": 101628 }, + "end": { "line": 3786, "column": 75, "offset": 101636 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 3786, "column": 75, "offset": 101636 }, + "end": { "line": 3786, "column": 76, "offset": 101637 } + } + } + ], + "position": { + "start": { "line": 3785, "column": 1, "offset": 101483 }, + "end": { "line": 3786, "column": 76, "offset": 101637 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "The maximum length of a string instance (in UTF-16 code units) is available\nas ", + "position": { + "start": { "line": 3788, "column": 1, "offset": 101639 }, + "end": { "line": 3789, "column": 4, "offset": 101718 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "buffer.constants.MAX_STRING_LENGTH", + "position": { + "start": { "line": 3789, "column": 5, "offset": 101719 }, + "end": { "line": 3789, "column": 41, "offset": 101755 } + } + } + ], + "position": { + "start": { "line": 3789, "column": 4, "offset": 101718 }, + "end": { "line": 3789, "column": 44, "offset": 101758 } + }, + "label": "`buffer.constants.MAX_STRING_LENGTH`", + "identifier": "`buffer.constants.max_string_length`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 3789, "column": 44, "offset": 101758 }, + "end": { "line": 3789, "column": 45, "offset": 101759 } + } + } + ], + "position": { + "start": { "line": 3788, "column": 1, "offset": 101639 }, + "end": { "line": 3789, "column": 45, "offset": 101759 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf1 = Buffer.allocUnsafe(26);\n\nfor (let i = 0; i < 26; i++) {\n // 97 is the decimal ASCII value for 'a'.\n buf1[i] = i + 97;\n}\n\nconsole.log(buf1.toString('utf8'));\n// Prints: abcdefghijklmnopqrstuvwxyz\nconsole.log(buf1.toString('utf8', 0, 5));\n// Prints: abcde\n\nconst buf2 = Buffer.from('tést');\n\nconsole.log(buf2.toString('hex'));\n// Prints: 74c3a97374\nconsole.log(buf2.toString('utf8', 0, 3));\n// Prints: té\nconsole.log(buf2.toString(undefined, 0, 3));\n// Prints: té", + "position": { + "start": { "line": 3791, "column": 1, "offset": 101761 }, + "end": { "line": 3814, "column": 4, "offset": 102287 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf1 = Buffer.allocUnsafe(26);\n\nfor (let i = 0; i < 26; i++) {\n // 97 is the decimal ASCII value for 'a'.\n buf1[i] = i + 97;\n}\n\nconsole.log(buf1.toString('utf8'));\n// Prints: abcdefghijklmnopqrstuvwxyz\nconsole.log(buf1.toString('utf8', 0, 5));\n// Prints: abcde\n\nconst buf2 = Buffer.from('tést');\n\nconsole.log(buf2.toString('hex'));\n// Prints: 74c3a97374\nconsole.log(buf2.toString('utf8', 0, 3));\n// Prints: té\nconsole.log(buf2.toString(undefined, 0, 3));\n// Prints: té", + "position": { + "start": { "line": 3816, "column": 1, "offset": 102289 }, + "end": { "line": 3839, "column": 4, "offset": 102820 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.values()", + "position": { + "start": { "line": 3841, "column": 5, "offset": 102826 }, + "end": { "line": 3841, "column": 19, "offset": 102840 } + } + } + ], + "position": { + "start": { "line": 3841, "column": 1, "offset": 102822 }, + "end": { "line": 3841, "column": 19, "offset": 102840 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 3843, "column": 1, "offset": 102842 }, + "end": { "line": 3845, "column": 4, "offset": 102869 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {Iterator}", + "position": { + "start": { "line": 3847, "column": 3, "offset": 102873 }, + "end": { "line": 3847, "column": 22, "offset": 102892 } + } + } + ], + "position": { + "start": { "line": 3847, "column": 3, "offset": 102873 }, + "end": { "line": 3847, "column": 22, "offset": 102892 } + } + } + ], + "position": { + "start": { "line": 3847, "column": 1, "offset": 102871 }, + "end": { "line": 3847, "column": 22, "offset": 102892 } + } + } + ], + "position": { + "start": { "line": 3847, "column": 1, "offset": 102871 }, + "end": { "line": 3847, "column": 22, "offset": 102892 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Creates and returns an ", + "position": { + "start": { "line": 3849, "column": 1, "offset": 102894 }, + "end": { "line": 3849, "column": 24, "offset": 102917 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "text", + "value": "iterator", + "position": { + "start": { "line": 3849, "column": 25, "offset": 102918 }, + "end": { "line": 3849, "column": 33, "offset": 102926 } + } + } + ], + "position": { + "start": { "line": 3849, "column": 24, "offset": 102917 }, + "end": { "line": 3849, "column": 36, "offset": 102929 } + }, + "label": "iterator", + "identifier": "iterator", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": " for ", + "position": { + "start": { "line": 3849, "column": 36, "offset": 102929 }, + "end": { "line": 3849, "column": 41, "offset": 102934 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 3849, "column": 41, "offset": 102934 }, + "end": { "line": 3849, "column": 46, "offset": 102939 } + } + }, + { + "type": "text", + "value": " values (bytes). This function is\ncalled automatically when a ", + "position": { + "start": { "line": 3849, "column": 46, "offset": 102939 }, + "end": { "line": 3850, "column": 29, "offset": 103001 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 3850, "column": 29, "offset": 103001 }, + "end": { "line": 3850, "column": 37, "offset": 103009 } + } + }, + { + "type": "text", + "value": " is used in a ", + "position": { + "start": { "line": 3850, "column": 37, "offset": 103009 }, + "end": { "line": 3850, "column": 51, "offset": 103023 } + } + }, + { + "type": "inlineCode", + "value": "for..of", + "position": { + "start": { "line": 3850, "column": 51, "offset": 103023 }, + "end": { "line": 3850, "column": 60, "offset": 103032 } + } + }, + { + "type": "text", + "value": " statement.", + "position": { + "start": { "line": 3850, "column": 60, "offset": 103032 }, + "end": { "line": 3850, "column": 71, "offset": 103043 } + } + } + ], + "position": { + "start": { "line": 3849, "column": 1, "offset": 102894 }, + "end": { "line": 3850, "column": 71, "offset": 103043 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from('buffer');\n\nfor (const value of buf.values()) {\n console.log(value);\n}\n// Prints:\n// 98\n// 117\n// 102\n// 102\n// 101\n// 114\n\nfor (const value of buf) {\n console.log(value);\n}\n// Prints:\n// 98\n// 117\n// 102\n// 102\n// 101\n// 114", + "position": { + "start": { "line": 3852, "column": 1, "offset": 103045 }, + "end": { "line": 3878, "column": 4, "offset": 103370 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from('buffer');\n\nfor (const value of buf.values()) {\n console.log(value);\n}\n// Prints:\n// 98\n// 117\n// 102\n// 102\n// 101\n// 114\n\nfor (const value of buf) {\n console.log(value);\n}\n// Prints:\n// 98\n// 117\n// 102\n// 102\n// 101\n// 114", + "position": { + "start": { "line": 3880, "column": 1, "offset": 103372 }, + "end": { "line": 3906, "column": 4, "offset": 103702 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.write(string[, offset[, length]][, encoding])", + "position": { + "start": { "line": 3908, "column": 5, "offset": 103708 }, + "end": { "line": 3908, "column": 56, "offset": 103759 } + } + } + ], + "position": { + "start": { "line": 3908, "column": 1, "offset": 103704 }, + "end": { "line": 3908, "column": 56, "offset": 103759 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 3910, "column": 1, "offset": 103761 }, + "end": { "line": 3912, "column": 4, "offset": 103789 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "string", + "position": { + "start": { "line": 3914, "column": 3, "offset": 103793 }, + "end": { "line": 3914, "column": 11, "offset": 103801 } + } + }, + { + "type": "text", + "value": " {string} String to write to ", + "position": { + "start": { "line": 3914, "column": 11, "offset": 103801 }, + "end": { "line": 3914, "column": 40, "offset": 103830 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 3914, "column": 40, "offset": 103830 }, + "end": { "line": 3914, "column": 45, "offset": 103835 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 3914, "column": 45, "offset": 103835 }, + "end": { "line": 3914, "column": 46, "offset": 103836 } + } + } + ], + "position": { + "start": { "line": 3914, "column": 3, "offset": 103793 }, + "end": { "line": 3914, "column": 46, "offset": 103836 } + } + } + ], + "position": { + "start": { "line": 3914, "column": 1, "offset": 103791 }, + "end": { "line": 3914, "column": 46, "offset": 103836 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 3915, "column": 3, "offset": 103839 }, + "end": { "line": 3915, "column": 11, "offset": 103847 } + } + }, + { + "type": "text", + "value": " {integer} Number of bytes to skip before starting to write ", + "position": { + "start": { "line": 3915, "column": 11, "offset": 103847 }, + "end": { "line": 3915, "column": 71, "offset": 103907 } + } + }, + { + "type": "inlineCode", + "value": "string", + "position": { + "start": { "line": 3915, "column": 71, "offset": 103907 }, + "end": { "line": 3915, "column": 79, "offset": 103915 } + } + }, + { + "type": "text", + "value": ".\n", + "position": { + "start": { "line": 3915, "column": 79, "offset": 103915 }, + "end": { "line": 3916, "column": 1, "offset": 103917 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { + "line": 3916, + "column": 5, + "offset": 103921 + }, + "end": { "line": 3916, "column": 13, "offset": 103929 } + } + } + ], + "position": { + "start": { "line": 3916, "column": 3, "offset": 103919 }, + "end": { "line": 3916, "column": 15, "offset": 103931 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 3916, "column": 15, "offset": 103931 }, + "end": { "line": 3916, "column": 16, "offset": 103932 } + } + }, + { + "type": "inlineCode", + "value": "0", + "position": { + "start": { "line": 3916, "column": 16, "offset": 103932 }, + "end": { "line": 3916, "column": 19, "offset": 103935 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 3916, "column": 19, "offset": 103935 }, + "end": { "line": 3916, "column": 20, "offset": 103936 } + } + } + ], + "position": { + "start": { "line": 3915, "column": 3, "offset": 103839 }, + "end": { "line": 3916, "column": 20, "offset": 103936 } + } + } + ], + "position": { + "start": { "line": 3915, "column": 1, "offset": 103837 }, + "end": { "line": 3916, "column": 20, "offset": 103936 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "length", + "position": { + "start": { "line": 3917, "column": 3, "offset": 103939 }, + "end": { "line": 3917, "column": 11, "offset": 103947 } + } + }, + { + "type": "text", + "value": " {integer} Maximum number of bytes to write (written bytes will not\nexceed ", + "position": { + "start": { "line": 3917, "column": 11, "offset": 103947 }, + "end": { "line": 3918, "column": 10, "offset": 104024 } + } + }, + { + "type": "inlineCode", + "value": "buf.length - offset", + "position": { + "start": { "line": 3918, "column": 10, "offset": 104024 }, + "end": { "line": 3918, "column": 31, "offset": 104045 } + } + }, + { + "type": "text", + "value": "). ", + "position": { + "start": { "line": 3918, "column": 31, "offset": 104045 }, + "end": { "line": 3918, "column": 34, "offset": 104048 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { + "line": 3918, + "column": 36, + "offset": 104050 + }, + "end": { "line": 3918, "column": 44, "offset": 104058 } + } + } + ], + "position": { + "start": { "line": 3918, "column": 34, "offset": 104048 }, + "end": { "line": 3918, "column": 46, "offset": 104060 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 3918, "column": 46, "offset": 104060 }, + "end": { "line": 3918, "column": 47, "offset": 104061 } + } + }, + { + "type": "inlineCode", + "value": "buf.length - offset", + "position": { + "start": { "line": 3918, "column": 47, "offset": 104061 }, + "end": { "line": 3918, "column": 68, "offset": 104082 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 3918, "column": 68, "offset": 104082 }, + "end": { "line": 3918, "column": 69, "offset": 104083 } + } + } + ], + "position": { + "start": { "line": 3917, "column": 3, "offset": 103939 }, + "end": { "line": 3918, "column": 69, "offset": 104083 } + } + } + ], + "position": { + "start": { "line": 3917, "column": 1, "offset": 103937 }, + "end": { "line": 3918, "column": 69, "offset": 104083 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "encoding", + "position": { + "start": { "line": 3919, "column": 3, "offset": 104086 }, + "end": { "line": 3919, "column": 13, "offset": 104096 } + } + }, + { + "type": "text", + "value": " {string} The character encoding of ", + "position": { + "start": { "line": 3919, "column": 13, "offset": 104096 }, + "end": { "line": 3919, "column": 49, "offset": 104132 } + } + }, + { + "type": "inlineCode", + "value": "string", + "position": { + "start": { "line": 3919, "column": 49, "offset": 104132 }, + "end": { "line": 3919, "column": 57, "offset": 104140 } + } + }, + { + "type": "text", + "value": ". ", + "position": { + "start": { "line": 3919, "column": 57, "offset": 104140 }, + "end": { "line": 3919, "column": 59, "offset": 104142 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { + "line": 3919, + "column": 61, + "offset": 104144 + }, + "end": { "line": 3919, "column": 69, "offset": 104152 } + } + } + ], + "position": { + "start": { "line": 3919, "column": 59, "offset": 104142 }, + "end": { "line": 3919, "column": 71, "offset": 104154 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 3919, "column": 71, "offset": 104154 }, + "end": { "line": 3919, "column": 72, "offset": 104155 } + } + }, + { + "type": "inlineCode", + "value": "'utf8'", + "position": { + "start": { "line": 3919, "column": 72, "offset": 104155 }, + "end": { "line": 3919, "column": 80, "offset": 104163 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 3919, "column": 80, "offset": 104163 }, + "end": { "line": 3919, "column": 81, "offset": 104164 } + } + } + ], + "position": { + "start": { "line": 3919, "column": 3, "offset": 104086 }, + "end": { "line": 3919, "column": 81, "offset": 104164 } + } + } + ], + "position": { + "start": { "line": 3919, "column": 1, "offset": 104084 }, + "end": { "line": 3919, "column": 81, "offset": 104164 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {integer} Number of bytes written.", + "position": { + "start": { "line": 3920, "column": 3, "offset": 104167 }, + "end": { "line": 3920, "column": 46, "offset": 104210 } + } + } + ], + "position": { + "start": { "line": 3920, "column": 3, "offset": 104167 }, + "end": { "line": 3920, "column": 46, "offset": 104210 } + } + } + ], + "position": { + "start": { "line": 3920, "column": 1, "offset": 104165 }, + "end": { "line": 3920, "column": 46, "offset": 104210 } + } + } + ], + "position": { + "start": { "line": 3914, "column": 1, "offset": 103791 }, + "end": { "line": 3920, "column": 46, "offset": 104210 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Writes ", + "position": { + "start": { "line": 3922, "column": 1, "offset": 104212 }, + "end": { "line": 3922, "column": 8, "offset": 104219 } + } + }, + { + "type": "inlineCode", + "value": "string", + "position": { + "start": { "line": 3922, "column": 8, "offset": 104219 }, + "end": { "line": 3922, "column": 16, "offset": 104227 } + } + }, + { + "type": "text", + "value": " to ", + "position": { + "start": { "line": 3922, "column": 16, "offset": 104227 }, + "end": { "line": 3922, "column": 20, "offset": 104231 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 3922, "column": 20, "offset": 104231 }, + "end": { "line": 3922, "column": 25, "offset": 104236 } + } + }, + { + "type": "text", + "value": " at ", + "position": { + "start": { "line": 3922, "column": 25, "offset": 104236 }, + "end": { "line": 3922, "column": 29, "offset": 104240 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 3922, "column": 29, "offset": 104240 }, + "end": { "line": 3922, "column": 37, "offset": 104248 } + } + }, + { + "type": "text", + "value": " according to the character encoding in\n", + "position": { + "start": { "line": 3922, "column": 37, "offset": 104248 }, + "end": { "line": 3923, "column": 1, "offset": 104288 } + } + }, + { + "type": "inlineCode", + "value": "encoding", + "position": { + "start": { "line": 3923, "column": 1, "offset": 104288 }, + "end": { "line": 3923, "column": 11, "offset": 104298 } + } + }, + { + "type": "text", + "value": ". The ", + "position": { + "start": { "line": 3923, "column": 11, "offset": 104298 }, + "end": { "line": 3923, "column": 17, "offset": 104304 } + } + }, + { + "type": "inlineCode", + "value": "length", + "position": { + "start": { "line": 3923, "column": 17, "offset": 104304 }, + "end": { "line": 3923, "column": 25, "offset": 104312 } + } + }, + { + "type": "text", + "value": " parameter is the number of bytes to write. If ", + "position": { + "start": { "line": 3923, "column": 25, "offset": 104312 }, + "end": { "line": 3923, "column": 72, "offset": 104359 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 3923, "column": 72, "offset": 104359 }, + "end": { "line": 3923, "column": 77, "offset": 104364 } + } + }, + { + "type": "text", + "value": " did\nnot contain enough space to fit the entire string, only part of ", + "position": { + "start": { "line": 3923, "column": 77, "offset": 104364 }, + "end": { "line": 3924, "column": 65, "offset": 104433 } + } + }, + { + "type": "inlineCode", + "value": "string", + "position": { + "start": { "line": 3924, "column": 65, "offset": 104433 }, + "end": { "line": 3924, "column": 73, "offset": 104441 } + } + }, + { + "type": "text", + "value": " will be\nwritten. However, partially encoded characters will not be written.", + "position": { + "start": { "line": 3924, "column": 73, "offset": 104441 }, + "end": { "line": 3925, "column": 68, "offset": 104517 } + } + } + ], + "position": { + "start": { "line": 3922, "column": 1, "offset": 104212 }, + "end": { "line": 3925, "column": 68, "offset": 104517 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.alloc(256);\n\nconst len = buf.write('\\u00bd + \\u00bc = \\u00be', 0);\n\nconsole.log(`${len} bytes: ${buf.toString('utf8', 0, len)}`);\n// Prints: 12 bytes: ½ + ¼ = ¾\n\nconst buffer = Buffer.alloc(10);\n\nconst length = buffer.write('abcd', 8);\n\nconsole.log(`${length} bytes: ${buffer.toString('utf8', 8, 10)}`);\n// Prints: 2 bytes : ab", + "position": { + "start": { "line": 3927, "column": 1, "offset": 104519 }, + "end": { "line": 3943, "column": 4, "offset": 104915 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.alloc(256);\n\nconst len = buf.write('\\u00bd + \\u00bc = \\u00be', 0);\n\nconsole.log(`${len} bytes: ${buf.toString('utf8', 0, len)}`);\n// Prints: 12 bytes: ½ + ¼ = ¾\n\nconst buffer = Buffer.alloc(10);\n\nconst length = buffer.write('abcd', 8);\n\nconsole.log(`${length} bytes: ${buffer.toString('utf8', 8, 10)}`);\n// Prints: 2 bytes : ab", + "position": { + "start": { "line": 3945, "column": 1, "offset": 104917 }, + "end": { "line": 3961, "column": 4, "offset": 105318 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.writeBigInt64BE(value[, offset])", + "position": { + "start": { "line": 3963, "column": 5, "offset": 105324 }, + "end": { "line": 3963, "column": 43, "offset": 105362 } + } + } + ], + "position": { + "start": { "line": 3963, "column": 1, "offset": 105320 }, + "end": { "line": 3963, "column": 43, "offset": 105362 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 3965, "column": 1, "offset": 105364 }, + "end": { "line": 3969, "column": 4, "offset": 105407 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 3971, "column": 3, "offset": 105411 }, + "end": { "line": 3971, "column": 10, "offset": 105418 } + } + }, + { + "type": "text", + "value": " {bigint} Number to be written to ", + "position": { + "start": { "line": 3971, "column": 10, "offset": 105418 }, + "end": { "line": 3971, "column": 44, "offset": 105452 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 3971, "column": 44, "offset": 105452 }, + "end": { "line": 3971, "column": 49, "offset": 105457 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 3971, "column": 49, "offset": 105457 }, + "end": { "line": 3971, "column": 50, "offset": 105458 } + } + } + ], + "position": { + "start": { "line": 3971, "column": 3, "offset": 105411 }, + "end": { "line": 3971, "column": 50, "offset": 105458 } + } + } + ], + "position": { + "start": { "line": 3971, "column": 1, "offset": 105409 }, + "end": { "line": 3971, "column": 50, "offset": 105458 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 3972, "column": 3, "offset": 105461 }, + "end": { "line": 3972, "column": 11, "offset": 105469 } + } + }, + { + "type": "text", + "value": " {integer} Number of bytes to skip before starting to write. Must\nsatisfy: ", + "position": { + "start": { "line": 3972, "column": 11, "offset": 105469 }, + "end": { "line": 3973, "column": 12, "offset": 105546 } + } + }, + { + "type": "inlineCode", + "value": "0 <= offset <= buf.length - 8", + "position": { + "start": { "line": 3973, "column": 12, "offset": 105546 }, + "end": { "line": 3973, "column": 43, "offset": 105577 } + } + }, + { + "type": "text", + "value": ". ", + "position": { + "start": { "line": 3973, "column": 43, "offset": 105577 }, + "end": { "line": 3973, "column": 45, "offset": 105579 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { + "line": 3973, + "column": 47, + "offset": 105581 + }, + "end": { "line": 3973, "column": 55, "offset": 105589 } + } + } + ], + "position": { + "start": { "line": 3973, "column": 45, "offset": 105579 }, + "end": { "line": 3973, "column": 57, "offset": 105591 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 3973, "column": 57, "offset": 105591 }, + "end": { "line": 3973, "column": 58, "offset": 105592 } + } + }, + { + "type": "inlineCode", + "value": "0", + "position": { + "start": { "line": 3973, "column": 58, "offset": 105592 }, + "end": { "line": 3973, "column": 61, "offset": 105595 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 3973, "column": 61, "offset": 105595 }, + "end": { "line": 3973, "column": 62, "offset": 105596 } + } + } + ], + "position": { + "start": { "line": 3972, "column": 3, "offset": 105461 }, + "end": { "line": 3973, "column": 62, "offset": 105596 } + } + } + ], + "position": { + "start": { "line": 3972, "column": 1, "offset": 105459 }, + "end": { "line": 3973, "column": 62, "offset": 105596 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {integer} ", + "position": { + "start": { "line": 3974, "column": 3, "offset": 105599 }, + "end": { "line": 3974, "column": 22, "offset": 105618 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 3974, "column": 22, "offset": 105618 }, + "end": { "line": 3974, "column": 30, "offset": 105626 } + } + }, + { + "type": "text", + "value": " plus the number of bytes written.", + "position": { + "start": { "line": 3974, "column": 30, "offset": 105626 }, + "end": { "line": 3974, "column": 64, "offset": 105660 } + } + } + ], + "position": { + "start": { "line": 3974, "column": 3, "offset": 105599 }, + "end": { "line": 3974, "column": 64, "offset": 105660 } + } + } + ], + "position": { + "start": { "line": 3974, "column": 1, "offset": 105597 }, + "end": { "line": 3974, "column": 64, "offset": 105660 } + } + } + ], + "position": { + "start": { "line": 3971, "column": 1, "offset": 105409 }, + "end": { "line": 3974, "column": 64, "offset": 105660 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Writes ", + "position": { + "start": { "line": 3976, "column": 1, "offset": 105662 }, + "end": { "line": 3976, "column": 8, "offset": 105669 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 3976, "column": 8, "offset": 105669 }, + "end": { "line": 3976, "column": 15, "offset": 105676 } + } + }, + { + "type": "text", + "value": " to ", + "position": { + "start": { "line": 3976, "column": 15, "offset": 105676 }, + "end": { "line": 3976, "column": 19, "offset": 105680 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 3976, "column": 19, "offset": 105680 }, + "end": { "line": 3976, "column": 24, "offset": 105685 } + } + }, + { + "type": "text", + "value": " at the specified ", + "position": { + "start": { "line": 3976, "column": 24, "offset": 105685 }, + "end": { "line": 3976, "column": 42, "offset": 105703 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 3976, "column": 42, "offset": 105703 }, + "end": { "line": 3976, "column": 50, "offset": 105711 } + } + }, + { + "type": "text", + "value": " as big-endian.", + "position": { + "start": { "line": 3976, "column": 50, "offset": 105711 }, + "end": { "line": 3976, "column": 65, "offset": 105726 } + } + } + ], + "position": { + "start": { "line": 3976, "column": 1, "offset": 105662 }, + "end": { "line": 3976, "column": 65, "offset": 105726 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 3978, "column": 1, "offset": 105728 }, + "end": { "line": 3978, "column": 8, "offset": 105735 } + } + }, + { + "type": "text", + "value": " is interpreted and written as a two's complement signed integer.", + "position": { + "start": { "line": 3978, "column": 8, "offset": 105735 }, + "end": { "line": 3978, "column": 73, "offset": 105800 } + } + } + ], + "position": { + "start": { "line": 3978, "column": 1, "offset": 105728 }, + "end": { "line": 3978, "column": 73, "offset": 105800 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.allocUnsafe(8);\n\nbuf.writeBigInt64BE(0x0102030405060708n, 0);\n\nconsole.log(buf);\n// Prints: ", + "position": { + "start": { "line": 3980, "column": 1, "offset": 105802 }, + "end": { "line": 3989, "column": 4, "offset": 105995 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.allocUnsafe(8);\n\nbuf.writeBigInt64BE(0x0102030405060708n, 0);\n\nconsole.log(buf);\n// Prints: ", + "position": { + "start": { "line": 3991, "column": 1, "offset": 105997 }, + "end": { "line": 4000, "column": 4, "offset": 106195 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.writeBigInt64LE(value[, offset])", + "position": { + "start": { "line": 4002, "column": 5, "offset": 106201 }, + "end": { "line": 4002, "column": 43, "offset": 106239 } + } + } + ], + "position": { + "start": { "line": 4002, "column": 1, "offset": 106197 }, + "end": { "line": 4002, "column": 43, "offset": 106239 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 4004, "column": 1, "offset": 106241 }, + "end": { "line": 4008, "column": 4, "offset": 106284 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4010, "column": 3, "offset": 106288 }, + "end": { "line": 4010, "column": 10, "offset": 106295 } + } + }, + { + "type": "text", + "value": " {bigint} Number to be written to ", + "position": { + "start": { "line": 4010, "column": 10, "offset": 106295 }, + "end": { "line": 4010, "column": 44, "offset": 106329 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 4010, "column": 44, "offset": 106329 }, + "end": { "line": 4010, "column": 49, "offset": 106334 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 4010, "column": 49, "offset": 106334 }, + "end": { "line": 4010, "column": 50, "offset": 106335 } + } + } + ], + "position": { + "start": { "line": 4010, "column": 3, "offset": 106288 }, + "end": { "line": 4010, "column": 50, "offset": 106335 } + } + } + ], + "position": { + "start": { "line": 4010, "column": 1, "offset": 106286 }, + "end": { "line": 4010, "column": 50, "offset": 106335 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 4011, "column": 3, "offset": 106338 }, + "end": { "line": 4011, "column": 11, "offset": 106346 } + } + }, + { + "type": "text", + "value": " {integer} Number of bytes to skip before starting to write. Must\nsatisfy: ", + "position": { + "start": { "line": 4011, "column": 11, "offset": 106346 }, + "end": { "line": 4012, "column": 12, "offset": 106423 } + } + }, + { + "type": "inlineCode", + "value": "0 <= offset <= buf.length - 8", + "position": { + "start": { "line": 4012, "column": 12, "offset": 106423 }, + "end": { "line": 4012, "column": 43, "offset": 106454 } + } + }, + { + "type": "text", + "value": ". ", + "position": { + "start": { "line": 4012, "column": 43, "offset": 106454 }, + "end": { "line": 4012, "column": 45, "offset": 106456 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { + "line": 4012, + "column": 47, + "offset": 106458 + }, + "end": { "line": 4012, "column": 55, "offset": 106466 } + } + } + ], + "position": { + "start": { "line": 4012, "column": 45, "offset": 106456 }, + "end": { "line": 4012, "column": 57, "offset": 106468 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 4012, "column": 57, "offset": 106468 }, + "end": { "line": 4012, "column": 58, "offset": 106469 } + } + }, + { + "type": "inlineCode", + "value": "0", + "position": { + "start": { "line": 4012, "column": 58, "offset": 106469 }, + "end": { "line": 4012, "column": 61, "offset": 106472 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 4012, "column": 61, "offset": 106472 }, + "end": { "line": 4012, "column": 62, "offset": 106473 } + } + } + ], + "position": { + "start": { "line": 4011, "column": 3, "offset": 106338 }, + "end": { "line": 4012, "column": 62, "offset": 106473 } + } + } + ], + "position": { + "start": { "line": 4011, "column": 1, "offset": 106336 }, + "end": { "line": 4012, "column": 62, "offset": 106473 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {integer} ", + "position": { + "start": { "line": 4013, "column": 3, "offset": 106476 }, + "end": { "line": 4013, "column": 22, "offset": 106495 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 4013, "column": 22, "offset": 106495 }, + "end": { "line": 4013, "column": 30, "offset": 106503 } + } + }, + { + "type": "text", + "value": " plus the number of bytes written.", + "position": { + "start": { "line": 4013, "column": 30, "offset": 106503 }, + "end": { "line": 4013, "column": 64, "offset": 106537 } + } + } + ], + "position": { + "start": { "line": 4013, "column": 3, "offset": 106476 }, + "end": { "line": 4013, "column": 64, "offset": 106537 } + } + } + ], + "position": { + "start": { "line": 4013, "column": 1, "offset": 106474 }, + "end": { "line": 4013, "column": 64, "offset": 106537 } + } + } + ], + "position": { + "start": { "line": 4010, "column": 1, "offset": 106286 }, + "end": { "line": 4013, "column": 64, "offset": 106537 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Writes ", + "position": { + "start": { "line": 4015, "column": 1, "offset": 106539 }, + "end": { "line": 4015, "column": 8, "offset": 106546 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4015, "column": 8, "offset": 106546 }, + "end": { "line": 4015, "column": 15, "offset": 106553 } + } + }, + { + "type": "text", + "value": " to ", + "position": { + "start": { "line": 4015, "column": 15, "offset": 106553 }, + "end": { "line": 4015, "column": 19, "offset": 106557 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 4015, "column": 19, "offset": 106557 }, + "end": { "line": 4015, "column": 24, "offset": 106562 } + } + }, + { + "type": "text", + "value": " at the specified ", + "position": { + "start": { "line": 4015, "column": 24, "offset": 106562 }, + "end": { "line": 4015, "column": 42, "offset": 106580 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 4015, "column": 42, "offset": 106580 }, + "end": { "line": 4015, "column": 50, "offset": 106588 } + } + }, + { + "type": "text", + "value": " as little-endian.", + "position": { + "start": { "line": 4015, "column": 50, "offset": 106588 }, + "end": { "line": 4015, "column": 68, "offset": 106606 } + } + } + ], + "position": { + "start": { "line": 4015, "column": 1, "offset": 106539 }, + "end": { "line": 4015, "column": 68, "offset": 106606 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4017, "column": 1, "offset": 106608 }, + "end": { "line": 4017, "column": 8, "offset": 106615 } + } + }, + { + "type": "text", + "value": " is interpreted and written as a two's complement signed integer.", + "position": { + "start": { "line": 4017, "column": 8, "offset": 106615 }, + "end": { "line": 4017, "column": 73, "offset": 106680 } + } + } + ], + "position": { + "start": { "line": 4017, "column": 1, "offset": 106608 }, + "end": { "line": 4017, "column": 73, "offset": 106680 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.allocUnsafe(8);\n\nbuf.writeBigInt64LE(0x0102030405060708n, 0);\n\nconsole.log(buf);\n// Prints: ", + "position": { + "start": { "line": 4019, "column": 1, "offset": 106682 }, + "end": { "line": 4028, "column": 4, "offset": 106875 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.allocUnsafe(8);\n\nbuf.writeBigInt64LE(0x0102030405060708n, 0);\n\nconsole.log(buf);\n// Prints: ", + "position": { + "start": { "line": 4030, "column": 1, "offset": 106877 }, + "end": { "line": 4039, "column": 4, "offset": 107075 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.writeBigUInt64BE(value[, offset])", + "position": { + "start": { "line": 4041, "column": 5, "offset": 107081 }, + "end": { "line": 4041, "column": 44, "offset": 107120 } + } + } + ], + "position": { + "start": { "line": 4041, "column": 1, "offset": 107077 }, + "end": { "line": 4041, "column": 44, "offset": 107120 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 4043, "column": 1, "offset": 107122 }, + "end": { "line": 4053, "column": 4, "offset": 107349 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4055, "column": 3, "offset": 107353 }, + "end": { "line": 4055, "column": 10, "offset": 107360 } + } + }, + { + "type": "text", + "value": " {bigint} Number to be written to ", + "position": { + "start": { "line": 4055, "column": 10, "offset": 107360 }, + "end": { "line": 4055, "column": 44, "offset": 107394 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 4055, "column": 44, "offset": 107394 }, + "end": { "line": 4055, "column": 49, "offset": 107399 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 4055, "column": 49, "offset": 107399 }, + "end": { "line": 4055, "column": 50, "offset": 107400 } + } + } + ], + "position": { + "start": { "line": 4055, "column": 3, "offset": 107353 }, + "end": { "line": 4055, "column": 50, "offset": 107400 } + } + } + ], + "position": { + "start": { "line": 4055, "column": 1, "offset": 107351 }, + "end": { "line": 4055, "column": 50, "offset": 107400 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 4056, "column": 3, "offset": 107403 }, + "end": { "line": 4056, "column": 11, "offset": 107411 } + } + }, + { + "type": "text", + "value": " {integer} Number of bytes to skip before starting to write. Must\nsatisfy: ", + "position": { + "start": { "line": 4056, "column": 11, "offset": 107411 }, + "end": { "line": 4057, "column": 12, "offset": 107488 } + } + }, + { + "type": "inlineCode", + "value": "0 <= offset <= buf.length - 8", + "position": { + "start": { "line": 4057, "column": 12, "offset": 107488 }, + "end": { "line": 4057, "column": 43, "offset": 107519 } + } + }, + { + "type": "text", + "value": ". ", + "position": { + "start": { "line": 4057, "column": 43, "offset": 107519 }, + "end": { "line": 4057, "column": 45, "offset": 107521 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { + "line": 4057, + "column": 47, + "offset": 107523 + }, + "end": { "line": 4057, "column": 55, "offset": 107531 } + } + } + ], + "position": { + "start": { "line": 4057, "column": 45, "offset": 107521 }, + "end": { "line": 4057, "column": 57, "offset": 107533 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 4057, "column": 57, "offset": 107533 }, + "end": { "line": 4057, "column": 58, "offset": 107534 } + } + }, + { + "type": "inlineCode", + "value": "0", + "position": { + "start": { "line": 4057, "column": 58, "offset": 107534 }, + "end": { "line": 4057, "column": 61, "offset": 107537 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 4057, "column": 61, "offset": 107537 }, + "end": { "line": 4057, "column": 62, "offset": 107538 } + } + } + ], + "position": { + "start": { "line": 4056, "column": 3, "offset": 107403 }, + "end": { "line": 4057, "column": 62, "offset": 107538 } + } + } + ], + "position": { + "start": { "line": 4056, "column": 1, "offset": 107401 }, + "end": { "line": 4057, "column": 62, "offset": 107538 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {integer} ", + "position": { + "start": { "line": 4058, "column": 3, "offset": 107541 }, + "end": { "line": 4058, "column": 22, "offset": 107560 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 4058, "column": 22, "offset": 107560 }, + "end": { "line": 4058, "column": 30, "offset": 107568 } + } + }, + { + "type": "text", + "value": " plus the number of bytes written.", + "position": { + "start": { "line": 4058, "column": 30, "offset": 107568 }, + "end": { "line": 4058, "column": 64, "offset": 107602 } + } + } + ], + "position": { + "start": { "line": 4058, "column": 3, "offset": 107541 }, + "end": { "line": 4058, "column": 64, "offset": 107602 } + } + } + ], + "position": { + "start": { "line": 4058, "column": 1, "offset": 107539 }, + "end": { "line": 4058, "column": 64, "offset": 107602 } + } + } + ], + "position": { + "start": { "line": 4055, "column": 1, "offset": 107351 }, + "end": { "line": 4058, "column": 64, "offset": 107602 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Writes ", + "position": { + "start": { "line": 4060, "column": 1, "offset": 107604 }, + "end": { "line": 4060, "column": 8, "offset": 107611 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4060, "column": 8, "offset": 107611 }, + "end": { "line": 4060, "column": 15, "offset": 107618 } + } + }, + { + "type": "text", + "value": " to ", + "position": { + "start": { "line": 4060, "column": 15, "offset": 107618 }, + "end": { "line": 4060, "column": 19, "offset": 107622 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 4060, "column": 19, "offset": 107622 }, + "end": { "line": 4060, "column": 24, "offset": 107627 } + } + }, + { + "type": "text", + "value": " at the specified ", + "position": { + "start": { "line": 4060, "column": 24, "offset": 107627 }, + "end": { "line": 4060, "column": 42, "offset": 107645 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 4060, "column": 42, "offset": 107645 }, + "end": { "line": 4060, "column": 50, "offset": 107653 } + } + }, + { + "type": "text", + "value": " as big-endian.", + "position": { + "start": { "line": 4060, "column": 50, "offset": 107653 }, + "end": { "line": 4060, "column": 65, "offset": 107668 } + } + } + ], + "position": { + "start": { "line": 4060, "column": 1, "offset": 107604 }, + "end": { "line": 4060, "column": 65, "offset": 107668 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "This function is also available under the ", + "position": { + "start": { "line": 4062, "column": 1, "offset": 107670 }, + "end": { "line": 4062, "column": 43, "offset": 107712 } + } + }, + { + "type": "inlineCode", + "value": "writeBigUint64BE", + "position": { + "start": { "line": 4062, "column": 43, "offset": 107712 }, + "end": { "line": 4062, "column": 61, "offset": 107730 } + } + }, + { + "type": "text", + "value": " alias.", + "position": { + "start": { "line": 4062, "column": 61, "offset": 107730 }, + "end": { "line": 4062, "column": 68, "offset": 107737 } + } + } + ], + "position": { + "start": { "line": 4062, "column": 1, "offset": 107670 }, + "end": { "line": 4062, "column": 68, "offset": 107737 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.allocUnsafe(8);\n\nbuf.writeBigUInt64BE(0xdecafafecacefaden, 0);\n\nconsole.log(buf);\n// Prints: ", + "position": { + "start": { "line": 4064, "column": 1, "offset": 107739 }, + "end": { "line": 4073, "column": 4, "offset": 107933 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.allocUnsafe(8);\n\nbuf.writeBigUInt64BE(0xdecafafecacefaden, 0);\n\nconsole.log(buf);\n// Prints: ", + "position": { + "start": { "line": 4075, "column": 1, "offset": 107935 }, + "end": { "line": 4084, "column": 4, "offset": 108134 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.writeBigUInt64LE(value[, offset])", + "position": { + "start": { "line": 4086, "column": 5, "offset": 108140 }, + "end": { "line": 4086, "column": 44, "offset": 108179 } + } + } + ], + "position": { + "start": { "line": 4086, "column": 1, "offset": 108136 }, + "end": { "line": 4086, "column": 44, "offset": 108179 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 4088, "column": 1, "offset": 108181 }, + "end": { "line": 4098, "column": 4, "offset": 108408 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4100, "column": 3, "offset": 108412 }, + "end": { "line": 4100, "column": 10, "offset": 108419 } + } + }, + { + "type": "text", + "value": " {bigint} Number to be written to ", + "position": { + "start": { "line": 4100, "column": 10, "offset": 108419 }, + "end": { "line": 4100, "column": 44, "offset": 108453 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 4100, "column": 44, "offset": 108453 }, + "end": { "line": 4100, "column": 49, "offset": 108458 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 4100, "column": 49, "offset": 108458 }, + "end": { "line": 4100, "column": 50, "offset": 108459 } + } + } + ], + "position": { + "start": { "line": 4100, "column": 3, "offset": 108412 }, + "end": { "line": 4100, "column": 50, "offset": 108459 } + } + } + ], + "position": { + "start": { "line": 4100, "column": 1, "offset": 108410 }, + "end": { "line": 4100, "column": 50, "offset": 108459 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 4101, "column": 3, "offset": 108462 }, + "end": { "line": 4101, "column": 11, "offset": 108470 } + } + }, + { + "type": "text", + "value": " {integer} Number of bytes to skip before starting to write. Must\nsatisfy: ", + "position": { + "start": { "line": 4101, "column": 11, "offset": 108470 }, + "end": { "line": 4102, "column": 12, "offset": 108547 } + } + }, + { + "type": "inlineCode", + "value": "0 <= offset <= buf.length - 8", + "position": { + "start": { "line": 4102, "column": 12, "offset": 108547 }, + "end": { "line": 4102, "column": 43, "offset": 108578 } + } + }, + { + "type": "text", + "value": ". ", + "position": { + "start": { "line": 4102, "column": 43, "offset": 108578 }, + "end": { "line": 4102, "column": 45, "offset": 108580 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { + "line": 4102, + "column": 47, + "offset": 108582 + }, + "end": { "line": 4102, "column": 55, "offset": 108590 } + } + } + ], + "position": { + "start": { "line": 4102, "column": 45, "offset": 108580 }, + "end": { "line": 4102, "column": 57, "offset": 108592 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 4102, "column": 57, "offset": 108592 }, + "end": { "line": 4102, "column": 58, "offset": 108593 } + } + }, + { + "type": "inlineCode", + "value": "0", + "position": { + "start": { "line": 4102, "column": 58, "offset": 108593 }, + "end": { "line": 4102, "column": 61, "offset": 108596 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 4102, "column": 61, "offset": 108596 }, + "end": { "line": 4102, "column": 62, "offset": 108597 } + } + } + ], + "position": { + "start": { "line": 4101, "column": 3, "offset": 108462 }, + "end": { "line": 4102, "column": 62, "offset": 108597 } + } + } + ], + "position": { + "start": { "line": 4101, "column": 1, "offset": 108460 }, + "end": { "line": 4102, "column": 62, "offset": 108597 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {integer} ", + "position": { + "start": { "line": 4103, "column": 3, "offset": 108600 }, + "end": { "line": 4103, "column": 22, "offset": 108619 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 4103, "column": 22, "offset": 108619 }, + "end": { "line": 4103, "column": 30, "offset": 108627 } + } + }, + { + "type": "text", + "value": " plus the number of bytes written.", + "position": { + "start": { "line": 4103, "column": 30, "offset": 108627 }, + "end": { "line": 4103, "column": 64, "offset": 108661 } + } + } + ], + "position": { + "start": { "line": 4103, "column": 3, "offset": 108600 }, + "end": { "line": 4103, "column": 64, "offset": 108661 } + } + } + ], + "position": { + "start": { "line": 4103, "column": 1, "offset": 108598 }, + "end": { "line": 4103, "column": 64, "offset": 108661 } + } + } + ], + "position": { + "start": { "line": 4100, "column": 1, "offset": 108410 }, + "end": { "line": 4103, "column": 64, "offset": 108661 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Writes ", + "position": { + "start": { "line": 4105, "column": 1, "offset": 108663 }, + "end": { "line": 4105, "column": 8, "offset": 108670 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4105, "column": 8, "offset": 108670 }, + "end": { "line": 4105, "column": 15, "offset": 108677 } + } + }, + { + "type": "text", + "value": " to ", + "position": { + "start": { "line": 4105, "column": 15, "offset": 108677 }, + "end": { "line": 4105, "column": 19, "offset": 108681 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 4105, "column": 19, "offset": 108681 }, + "end": { "line": 4105, "column": 24, "offset": 108686 } + } + }, + { + "type": "text", + "value": " at the specified ", + "position": { + "start": { "line": 4105, "column": 24, "offset": 108686 }, + "end": { "line": 4105, "column": 42, "offset": 108704 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 4105, "column": 42, "offset": 108704 }, + "end": { "line": 4105, "column": 50, "offset": 108712 } + } + }, + { + "type": "text", + "value": " as little-endian", + "position": { + "start": { "line": 4105, "column": 50, "offset": 108712 }, + "end": { "line": 4105, "column": 67, "offset": 108729 } + } + } + ], + "position": { + "start": { "line": 4105, "column": 1, "offset": 108663 }, + "end": { "line": 4105, "column": 67, "offset": 108729 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.allocUnsafe(8);\n\nbuf.writeBigUInt64LE(0xdecafafecacefaden, 0);\n\nconsole.log(buf);\n// Prints: ", + "position": { + "start": { "line": 4107, "column": 1, "offset": 108731 }, + "end": { "line": 4116, "column": 4, "offset": 108925 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.allocUnsafe(8);\n\nbuf.writeBigUInt64LE(0xdecafafecacefaden, 0);\n\nconsole.log(buf);\n// Prints: ", + "position": { + "start": { "line": 4118, "column": 1, "offset": 108927 }, + "end": { "line": 4127, "column": 4, "offset": 109126 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "This function is also available under the ", + "position": { + "start": { "line": 4129, "column": 1, "offset": 109128 }, + "end": { "line": 4129, "column": 43, "offset": 109170 } + } + }, + { + "type": "inlineCode", + "value": "writeBigUint64LE", + "position": { + "start": { "line": 4129, "column": 43, "offset": 109170 }, + "end": { "line": 4129, "column": 61, "offset": 109188 } + } + }, + { + "type": "text", + "value": " alias.", + "position": { + "start": { "line": 4129, "column": 61, "offset": 109188 }, + "end": { "line": 4129, "column": 68, "offset": 109195 } + } + } + ], + "position": { + "start": { "line": 4129, "column": 1, "offset": 109128 }, + "end": { "line": 4129, "column": 68, "offset": 109195 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.writeDoubleBE(value[, offset])", + "position": { + "start": { "line": 4131, "column": 5, "offset": 109201 }, + "end": { "line": 4131, "column": 41, "offset": 109237 } + } + } + ], + "position": { + "start": { "line": 4131, "column": 1, "offset": 109197 }, + "end": { "line": 4131, "column": 41, "offset": 109237 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 4133, "column": 1, "offset": 109239 }, + "end": { "line": 4140, "column": 4, "offset": 109465 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4142, "column": 3, "offset": 109469 }, + "end": { "line": 4142, "column": 10, "offset": 109476 } + } + }, + { + "type": "text", + "value": " {number} Number to be written to ", + "position": { + "start": { "line": 4142, "column": 10, "offset": 109476 }, + "end": { "line": 4142, "column": 44, "offset": 109510 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 4142, "column": 44, "offset": 109510 }, + "end": { "line": 4142, "column": 49, "offset": 109515 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 4142, "column": 49, "offset": 109515 }, + "end": { "line": 4142, "column": 50, "offset": 109516 } + } + } + ], + "position": { + "start": { "line": 4142, "column": 3, "offset": 109469 }, + "end": { "line": 4142, "column": 50, "offset": 109516 } + } + } + ], + "position": { + "start": { "line": 4142, "column": 1, "offset": 109467 }, + "end": { "line": 4142, "column": 50, "offset": 109516 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 4143, "column": 3, "offset": 109519 }, + "end": { "line": 4143, "column": 11, "offset": 109527 } + } + }, + { + "type": "text", + "value": " {integer} Number of bytes to skip before starting to write. Must\nsatisfy ", + "position": { + "start": { "line": 4143, "column": 11, "offset": 109527 }, + "end": { "line": 4144, "column": 11, "offset": 109603 } + } + }, + { + "type": "inlineCode", + "value": "0 <= offset <= buf.length - 8", + "position": { + "start": { "line": 4144, "column": 11, "offset": 109603 }, + "end": { "line": 4144, "column": 42, "offset": 109634 } + } + }, + { + "type": "text", + "value": ". ", + "position": { + "start": { "line": 4144, "column": 42, "offset": 109634 }, + "end": { "line": 4144, "column": 44, "offset": 109636 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { + "line": 4144, + "column": 46, + "offset": 109638 + }, + "end": { "line": 4144, "column": 54, "offset": 109646 } + } + } + ], + "position": { + "start": { "line": 4144, "column": 44, "offset": 109636 }, + "end": { "line": 4144, "column": 56, "offset": 109648 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 4144, "column": 56, "offset": 109648 }, + "end": { "line": 4144, "column": 57, "offset": 109649 } + } + }, + { + "type": "inlineCode", + "value": "0", + "position": { + "start": { "line": 4144, "column": 57, "offset": 109649 }, + "end": { "line": 4144, "column": 60, "offset": 109652 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 4144, "column": 60, "offset": 109652 }, + "end": { "line": 4144, "column": 61, "offset": 109653 } + } + } + ], + "position": { + "start": { "line": 4143, "column": 3, "offset": 109519 }, + "end": { "line": 4144, "column": 61, "offset": 109653 } + } + } + ], + "position": { + "start": { "line": 4143, "column": 1, "offset": 109517 }, + "end": { "line": 4144, "column": 61, "offset": 109653 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {integer} ", + "position": { + "start": { "line": 4145, "column": 3, "offset": 109656 }, + "end": { "line": 4145, "column": 22, "offset": 109675 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 4145, "column": 22, "offset": 109675 }, + "end": { "line": 4145, "column": 30, "offset": 109683 } + } + }, + { + "type": "text", + "value": " plus the number of bytes written.", + "position": { + "start": { "line": 4145, "column": 30, "offset": 109683 }, + "end": { "line": 4145, "column": 64, "offset": 109717 } + } + } + ], + "position": { + "start": { "line": 4145, "column": 3, "offset": 109656 }, + "end": { "line": 4145, "column": 64, "offset": 109717 } + } + } + ], + "position": { + "start": { "line": 4145, "column": 1, "offset": 109654 }, + "end": { "line": 4145, "column": 64, "offset": 109717 } + } + } + ], + "position": { + "start": { "line": 4142, "column": 1, "offset": 109467 }, + "end": { "line": 4145, "column": 64, "offset": 109717 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Writes ", + "position": { + "start": { "line": 4147, "column": 1, "offset": 109719 }, + "end": { "line": 4147, "column": 8, "offset": 109726 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4147, "column": 8, "offset": 109726 }, + "end": { "line": 4147, "column": 15, "offset": 109733 } + } + }, + { + "type": "text", + "value": " to ", + "position": { + "start": { "line": 4147, "column": 15, "offset": 109733 }, + "end": { "line": 4147, "column": 19, "offset": 109737 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 4147, "column": 19, "offset": 109737 }, + "end": { "line": 4147, "column": 24, "offset": 109742 } + } + }, + { + "type": "text", + "value": " at the specified ", + "position": { + "start": { "line": 4147, "column": 24, "offset": 109742 }, + "end": { "line": 4147, "column": 42, "offset": 109760 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 4147, "column": 42, "offset": 109760 }, + "end": { "line": 4147, "column": 50, "offset": 109768 } + } + }, + { + "type": "text", + "value": " as big-endian. The ", + "position": { + "start": { "line": 4147, "column": 50, "offset": 109768 }, + "end": { "line": 4147, "column": 70, "offset": 109788 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4147, "column": 70, "offset": 109788 }, + "end": { "line": 4147, "column": 77, "offset": 109795 } + } + }, + { + "type": "text", + "value": "\nmust be a JavaScript number. Behavior is undefined when ", + "position": { + "start": { "line": 4147, "column": 77, "offset": 109795 }, + "end": { "line": 4148, "column": 57, "offset": 109852 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4148, "column": 57, "offset": 109852 }, + "end": { "line": 4148, "column": 64, "offset": 109859 } + } + }, + { + "type": "text", + "value": " is anything\nother than a JavaScript number.", + "position": { + "start": { "line": 4148, "column": 64, "offset": 109859 }, + "end": { "line": 4149, "column": 32, "offset": 109903 } + } + } + ], + "position": { + "start": { "line": 4147, "column": 1, "offset": 109719 }, + "end": { "line": 4149, "column": 32, "offset": 109903 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.allocUnsafe(8);\n\nbuf.writeDoubleBE(123.456, 0);\n\nconsole.log(buf);\n// Prints: ", + "position": { + "start": { "line": 4151, "column": 1, "offset": 109905 }, + "end": { "line": 4160, "column": 4, "offset": 110084 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.allocUnsafe(8);\n\nbuf.writeDoubleBE(123.456, 0);\n\nconsole.log(buf);\n// Prints: ", + "position": { + "start": { "line": 4162, "column": 1, "offset": 110086 }, + "end": { "line": 4171, "column": 4, "offset": 110270 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.writeDoubleLE(value[, offset])", + "position": { + "start": { "line": 4173, "column": 5, "offset": 110276 }, + "end": { "line": 4173, "column": 41, "offset": 110312 } + } + } + ], + "position": { + "start": { "line": 4173, "column": 1, "offset": 110272 }, + "end": { "line": 4173, "column": 41, "offset": 110312 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 4175, "column": 1, "offset": 110314 }, + "end": { "line": 4182, "column": 4, "offset": 110540 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4184, "column": 3, "offset": 110544 }, + "end": { "line": 4184, "column": 10, "offset": 110551 } + } + }, + { + "type": "text", + "value": " {number} Number to be written to ", + "position": { + "start": { "line": 4184, "column": 10, "offset": 110551 }, + "end": { "line": 4184, "column": 44, "offset": 110585 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 4184, "column": 44, "offset": 110585 }, + "end": { "line": 4184, "column": 49, "offset": 110590 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 4184, "column": 49, "offset": 110590 }, + "end": { "line": 4184, "column": 50, "offset": 110591 } + } + } + ], + "position": { + "start": { "line": 4184, "column": 3, "offset": 110544 }, + "end": { "line": 4184, "column": 50, "offset": 110591 } + } + } + ], + "position": { + "start": { "line": 4184, "column": 1, "offset": 110542 }, + "end": { "line": 4184, "column": 50, "offset": 110591 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 4185, "column": 3, "offset": 110594 }, + "end": { "line": 4185, "column": 11, "offset": 110602 } + } + }, + { + "type": "text", + "value": " {integer} Number of bytes to skip before starting to write. Must\nsatisfy ", + "position": { + "start": { "line": 4185, "column": 11, "offset": 110602 }, + "end": { "line": 4186, "column": 11, "offset": 110678 } + } + }, + { + "type": "inlineCode", + "value": "0 <= offset <= buf.length - 8", + "position": { + "start": { "line": 4186, "column": 11, "offset": 110678 }, + "end": { "line": 4186, "column": 42, "offset": 110709 } + } + }, + { + "type": "text", + "value": ". ", + "position": { + "start": { "line": 4186, "column": 42, "offset": 110709 }, + "end": { "line": 4186, "column": 44, "offset": 110711 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { + "line": 4186, + "column": 46, + "offset": 110713 + }, + "end": { "line": 4186, "column": 54, "offset": 110721 } + } + } + ], + "position": { + "start": { "line": 4186, "column": 44, "offset": 110711 }, + "end": { "line": 4186, "column": 56, "offset": 110723 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 4186, "column": 56, "offset": 110723 }, + "end": { "line": 4186, "column": 57, "offset": 110724 } + } + }, + { + "type": "inlineCode", + "value": "0", + "position": { + "start": { "line": 4186, "column": 57, "offset": 110724 }, + "end": { "line": 4186, "column": 60, "offset": 110727 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 4186, "column": 60, "offset": 110727 }, + "end": { "line": 4186, "column": 61, "offset": 110728 } + } + } + ], + "position": { + "start": { "line": 4185, "column": 3, "offset": 110594 }, + "end": { "line": 4186, "column": 61, "offset": 110728 } + } + } + ], + "position": { + "start": { "line": 4185, "column": 1, "offset": 110592 }, + "end": { "line": 4186, "column": 61, "offset": 110728 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {integer} ", + "position": { + "start": { "line": 4187, "column": 3, "offset": 110731 }, + "end": { "line": 4187, "column": 22, "offset": 110750 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 4187, "column": 22, "offset": 110750 }, + "end": { "line": 4187, "column": 30, "offset": 110758 } + } + }, + { + "type": "text", + "value": " plus the number of bytes written.", + "position": { + "start": { "line": 4187, "column": 30, "offset": 110758 }, + "end": { "line": 4187, "column": 64, "offset": 110792 } + } + } + ], + "position": { + "start": { "line": 4187, "column": 3, "offset": 110731 }, + "end": { "line": 4187, "column": 64, "offset": 110792 } + } + } + ], + "position": { + "start": { "line": 4187, "column": 1, "offset": 110729 }, + "end": { "line": 4187, "column": 64, "offset": 110792 } + } + } + ], + "position": { + "start": { "line": 4184, "column": 1, "offset": 110542 }, + "end": { "line": 4187, "column": 64, "offset": 110792 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Writes ", + "position": { + "start": { "line": 4189, "column": 1, "offset": 110794 }, + "end": { "line": 4189, "column": 8, "offset": 110801 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4189, "column": 8, "offset": 110801 }, + "end": { "line": 4189, "column": 15, "offset": 110808 } + } + }, + { + "type": "text", + "value": " to ", + "position": { + "start": { "line": 4189, "column": 15, "offset": 110808 }, + "end": { "line": 4189, "column": 19, "offset": 110812 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 4189, "column": 19, "offset": 110812 }, + "end": { "line": 4189, "column": 24, "offset": 110817 } + } + }, + { + "type": "text", + "value": " at the specified ", + "position": { + "start": { "line": 4189, "column": 24, "offset": 110817 }, + "end": { "line": 4189, "column": 42, "offset": 110835 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 4189, "column": 42, "offset": 110835 }, + "end": { "line": 4189, "column": 50, "offset": 110843 } + } + }, + { + "type": "text", + "value": " as little-endian. The ", + "position": { + "start": { "line": 4189, "column": 50, "offset": 110843 }, + "end": { "line": 4189, "column": 73, "offset": 110866 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4189, "column": 73, "offset": 110866 }, + "end": { "line": 4189, "column": 80, "offset": 110873 } + } + }, + { + "type": "text", + "value": "\nmust be a JavaScript number. Behavior is undefined when ", + "position": { + "start": { "line": 4189, "column": 80, "offset": 110873 }, + "end": { "line": 4190, "column": 57, "offset": 110930 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4190, "column": 57, "offset": 110930 }, + "end": { "line": 4190, "column": 64, "offset": 110937 } + } + }, + { + "type": "text", + "value": " is anything\nother than a JavaScript number.", + "position": { + "start": { "line": 4190, "column": 64, "offset": 110937 }, + "end": { "line": 4191, "column": 32, "offset": 110981 } + } + } + ], + "position": { + "start": { "line": 4189, "column": 1, "offset": 110794 }, + "end": { "line": 4191, "column": 32, "offset": 110981 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.allocUnsafe(8);\n\nbuf.writeDoubleLE(123.456, 0);\n\nconsole.log(buf);\n// Prints: ", + "position": { + "start": { "line": 4193, "column": 1, "offset": 110983 }, + "end": { "line": 4202, "column": 4, "offset": 111162 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.allocUnsafe(8);\n\nbuf.writeDoubleLE(123.456, 0);\n\nconsole.log(buf);\n// Prints: ", + "position": { + "start": { "line": 4204, "column": 1, "offset": 111164 }, + "end": { "line": 4213, "column": 4, "offset": 111348 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.writeFloatBE(value[, offset])", + "position": { + "start": { "line": 4215, "column": 5, "offset": 111354 }, + "end": { "line": 4215, "column": 40, "offset": 111389 } + } + } + ], + "position": { + "start": { "line": 4215, "column": 1, "offset": 111350 }, + "end": { "line": 4215, "column": 40, "offset": 111389 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 4217, "column": 1, "offset": 111391 }, + "end": { "line": 4224, "column": 4, "offset": 111617 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4226, "column": 3, "offset": 111621 }, + "end": { "line": 4226, "column": 10, "offset": 111628 } + } + }, + { + "type": "text", + "value": " {number} Number to be written to ", + "position": { + "start": { "line": 4226, "column": 10, "offset": 111628 }, + "end": { "line": 4226, "column": 44, "offset": 111662 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 4226, "column": 44, "offset": 111662 }, + "end": { "line": 4226, "column": 49, "offset": 111667 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 4226, "column": 49, "offset": 111667 }, + "end": { "line": 4226, "column": 50, "offset": 111668 } + } + } + ], + "position": { + "start": { "line": 4226, "column": 3, "offset": 111621 }, + "end": { "line": 4226, "column": 50, "offset": 111668 } + } + } + ], + "position": { + "start": { "line": 4226, "column": 1, "offset": 111619 }, + "end": { "line": 4226, "column": 50, "offset": 111668 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 4227, "column": 3, "offset": 111671 }, + "end": { "line": 4227, "column": 11, "offset": 111679 } + } + }, + { + "type": "text", + "value": " {integer} Number of bytes to skip before starting to write. Must\nsatisfy ", + "position": { + "start": { "line": 4227, "column": 11, "offset": 111679 }, + "end": { "line": 4228, "column": 11, "offset": 111755 } + } + }, + { + "type": "inlineCode", + "value": "0 <= offset <= buf.length - 4", + "position": { + "start": { "line": 4228, "column": 11, "offset": 111755 }, + "end": { "line": 4228, "column": 42, "offset": 111786 } + } + }, + { + "type": "text", + "value": ". ", + "position": { + "start": { "line": 4228, "column": 42, "offset": 111786 }, + "end": { "line": 4228, "column": 44, "offset": 111788 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { + "line": 4228, + "column": 46, + "offset": 111790 + }, + "end": { "line": 4228, "column": 54, "offset": 111798 } + } + } + ], + "position": { + "start": { "line": 4228, "column": 44, "offset": 111788 }, + "end": { "line": 4228, "column": 56, "offset": 111800 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 4228, "column": 56, "offset": 111800 }, + "end": { "line": 4228, "column": 57, "offset": 111801 } + } + }, + { + "type": "inlineCode", + "value": "0", + "position": { + "start": { "line": 4228, "column": 57, "offset": 111801 }, + "end": { "line": 4228, "column": 60, "offset": 111804 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 4228, "column": 60, "offset": 111804 }, + "end": { "line": 4228, "column": 61, "offset": 111805 } + } + } + ], + "position": { + "start": { "line": 4227, "column": 3, "offset": 111671 }, + "end": { "line": 4228, "column": 61, "offset": 111805 } + } + } + ], + "position": { + "start": { "line": 4227, "column": 1, "offset": 111669 }, + "end": { "line": 4228, "column": 61, "offset": 111805 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {integer} ", + "position": { + "start": { "line": 4229, "column": 3, "offset": 111808 }, + "end": { "line": 4229, "column": 22, "offset": 111827 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 4229, "column": 22, "offset": 111827 }, + "end": { "line": 4229, "column": 30, "offset": 111835 } + } + }, + { + "type": "text", + "value": " plus the number of bytes written.", + "position": { + "start": { "line": 4229, "column": 30, "offset": 111835 }, + "end": { "line": 4229, "column": 64, "offset": 111869 } + } + } + ], + "position": { + "start": { "line": 4229, "column": 3, "offset": 111808 }, + "end": { "line": 4229, "column": 64, "offset": 111869 } + } + } + ], + "position": { + "start": { "line": 4229, "column": 1, "offset": 111806 }, + "end": { "line": 4229, "column": 64, "offset": 111869 } + } + } + ], + "position": { + "start": { "line": 4226, "column": 1, "offset": 111619 }, + "end": { "line": 4229, "column": 64, "offset": 111869 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Writes ", + "position": { + "start": { "line": 4231, "column": 1, "offset": 111871 }, + "end": { "line": 4231, "column": 8, "offset": 111878 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4231, "column": 8, "offset": 111878 }, + "end": { "line": 4231, "column": 15, "offset": 111885 } + } + }, + { + "type": "text", + "value": " to ", + "position": { + "start": { "line": 4231, "column": 15, "offset": 111885 }, + "end": { "line": 4231, "column": 19, "offset": 111889 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 4231, "column": 19, "offset": 111889 }, + "end": { "line": 4231, "column": 24, "offset": 111894 } + } + }, + { + "type": "text", + "value": " at the specified ", + "position": { + "start": { "line": 4231, "column": 24, "offset": 111894 }, + "end": { "line": 4231, "column": 42, "offset": 111912 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 4231, "column": 42, "offset": 111912 }, + "end": { "line": 4231, "column": 50, "offset": 111920 } + } + }, + { + "type": "text", + "value": " as big-endian. Behavior is\nundefined when ", + "position": { + "start": { "line": 4231, "column": 50, "offset": 111920 }, + "end": { "line": 4232, "column": 16, "offset": 111963 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4232, "column": 16, "offset": 111963 }, + "end": { "line": 4232, "column": 23, "offset": 111970 } + } + }, + { + "type": "text", + "value": " is anything other than a JavaScript number.", + "position": { + "start": { "line": 4232, "column": 23, "offset": 111970 }, + "end": { "line": 4232, "column": 67, "offset": 112014 } + } + } + ], + "position": { + "start": { "line": 4231, "column": 1, "offset": 111871 }, + "end": { "line": 4232, "column": 67, "offset": 112014 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.allocUnsafe(4);\n\nbuf.writeFloatBE(0xcafebabe, 0);\n\nconsole.log(buf);\n// Prints: ", + "position": { + "start": { "line": 4234, "column": 1, "offset": 112016 }, + "end": { "line": 4243, "column": 4, "offset": 112185 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.allocUnsafe(4);\n\nbuf.writeFloatBE(0xcafebabe, 0);\n\nconsole.log(buf);\n// Prints: ", + "position": { + "start": { "line": 4245, "column": 1, "offset": 112187 }, + "end": { "line": 4254, "column": 4, "offset": 112361 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.writeFloatLE(value[, offset])", + "position": { + "start": { "line": 4256, "column": 5, "offset": 112367 }, + "end": { "line": 4256, "column": 40, "offset": 112402 } + } + } + ], + "position": { + "start": { "line": 4256, "column": 1, "offset": 112363 }, + "end": { "line": 4256, "column": 40, "offset": 112402 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 4258, "column": 1, "offset": 112404 }, + "end": { "line": 4265, "column": 4, "offset": 112630 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4267, "column": 3, "offset": 112634 }, + "end": { "line": 4267, "column": 10, "offset": 112641 } + } + }, + { + "type": "text", + "value": " {number} Number to be written to ", + "position": { + "start": { "line": 4267, "column": 10, "offset": 112641 }, + "end": { "line": 4267, "column": 44, "offset": 112675 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 4267, "column": 44, "offset": 112675 }, + "end": { "line": 4267, "column": 49, "offset": 112680 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 4267, "column": 49, "offset": 112680 }, + "end": { "line": 4267, "column": 50, "offset": 112681 } + } + } + ], + "position": { + "start": { "line": 4267, "column": 3, "offset": 112634 }, + "end": { "line": 4267, "column": 50, "offset": 112681 } + } + } + ], + "position": { + "start": { "line": 4267, "column": 1, "offset": 112632 }, + "end": { "line": 4267, "column": 50, "offset": 112681 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 4268, "column": 3, "offset": 112684 }, + "end": { "line": 4268, "column": 11, "offset": 112692 } + } + }, + { + "type": "text", + "value": " {integer} Number of bytes to skip before starting to write. Must\nsatisfy ", + "position": { + "start": { "line": 4268, "column": 11, "offset": 112692 }, + "end": { "line": 4269, "column": 11, "offset": 112768 } + } + }, + { + "type": "inlineCode", + "value": "0 <= offset <= buf.length - 4", + "position": { + "start": { "line": 4269, "column": 11, "offset": 112768 }, + "end": { "line": 4269, "column": 42, "offset": 112799 } + } + }, + { + "type": "text", + "value": ". ", + "position": { + "start": { "line": 4269, "column": 42, "offset": 112799 }, + "end": { "line": 4269, "column": 44, "offset": 112801 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { + "line": 4269, + "column": 46, + "offset": 112803 + }, + "end": { "line": 4269, "column": 54, "offset": 112811 } + } + } + ], + "position": { + "start": { "line": 4269, "column": 44, "offset": 112801 }, + "end": { "line": 4269, "column": 56, "offset": 112813 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 4269, "column": 56, "offset": 112813 }, + "end": { "line": 4269, "column": 57, "offset": 112814 } + } + }, + { + "type": "inlineCode", + "value": "0", + "position": { + "start": { "line": 4269, "column": 57, "offset": 112814 }, + "end": { "line": 4269, "column": 60, "offset": 112817 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 4269, "column": 60, "offset": 112817 }, + "end": { "line": 4269, "column": 61, "offset": 112818 } + } + } + ], + "position": { + "start": { "line": 4268, "column": 3, "offset": 112684 }, + "end": { "line": 4269, "column": 61, "offset": 112818 } + } + } + ], + "position": { + "start": { "line": 4268, "column": 1, "offset": 112682 }, + "end": { "line": 4269, "column": 61, "offset": 112818 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {integer} ", + "position": { + "start": { "line": 4270, "column": 3, "offset": 112821 }, + "end": { "line": 4270, "column": 22, "offset": 112840 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 4270, "column": 22, "offset": 112840 }, + "end": { "line": 4270, "column": 30, "offset": 112848 } + } + }, + { + "type": "text", + "value": " plus the number of bytes written.", + "position": { + "start": { "line": 4270, "column": 30, "offset": 112848 }, + "end": { "line": 4270, "column": 64, "offset": 112882 } + } + } + ], + "position": { + "start": { "line": 4270, "column": 3, "offset": 112821 }, + "end": { "line": 4270, "column": 64, "offset": 112882 } + } + } + ], + "position": { + "start": { "line": 4270, "column": 1, "offset": 112819 }, + "end": { "line": 4270, "column": 64, "offset": 112882 } + } + } + ], + "position": { + "start": { "line": 4267, "column": 1, "offset": 112632 }, + "end": { "line": 4270, "column": 64, "offset": 112882 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Writes ", + "position": { + "start": { "line": 4272, "column": 1, "offset": 112884 }, + "end": { "line": 4272, "column": 8, "offset": 112891 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4272, "column": 8, "offset": 112891 }, + "end": { "line": 4272, "column": 15, "offset": 112898 } + } + }, + { + "type": "text", + "value": " to ", + "position": { + "start": { "line": 4272, "column": 15, "offset": 112898 }, + "end": { "line": 4272, "column": 19, "offset": 112902 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 4272, "column": 19, "offset": 112902 }, + "end": { "line": 4272, "column": 24, "offset": 112907 } + } + }, + { + "type": "text", + "value": " at the specified ", + "position": { + "start": { "line": 4272, "column": 24, "offset": 112907 }, + "end": { "line": 4272, "column": 42, "offset": 112925 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 4272, "column": 42, "offset": 112925 }, + "end": { "line": 4272, "column": 50, "offset": 112933 } + } + }, + { + "type": "text", + "value": " as little-endian. Behavior is\nundefined when ", + "position": { + "start": { "line": 4272, "column": 50, "offset": 112933 }, + "end": { "line": 4273, "column": 16, "offset": 112979 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4273, "column": 16, "offset": 112979 }, + "end": { "line": 4273, "column": 23, "offset": 112986 } + } + }, + { + "type": "text", + "value": " is anything other than a JavaScript number.", + "position": { + "start": { "line": 4273, "column": 23, "offset": 112986 }, + "end": { "line": 4273, "column": 67, "offset": 113030 } + } + } + ], + "position": { + "start": { "line": 4272, "column": 1, "offset": 112884 }, + "end": { "line": 4273, "column": 67, "offset": 113030 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.allocUnsafe(4);\n\nbuf.writeFloatLE(0xcafebabe, 0);\n\nconsole.log(buf);\n// Prints: ", + "position": { + "start": { "line": 4275, "column": 1, "offset": 113032 }, + "end": { "line": 4284, "column": 4, "offset": 113201 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.allocUnsafe(4);\n\nbuf.writeFloatLE(0xcafebabe, 0);\n\nconsole.log(buf);\n// Prints: ", + "position": { + "start": { "line": 4286, "column": 1, "offset": 113203 }, + "end": { "line": 4295, "column": 4, "offset": 113377 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.writeInt8(value[, offset])", + "position": { + "start": { "line": 4297, "column": 5, "offset": 113383 }, + "end": { "line": 4297, "column": 37, "offset": 113415 } + } + } + ], + "position": { + "start": { "line": 4297, "column": 1, "offset": 113379 }, + "end": { "line": 4297, "column": 37, "offset": 113415 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 4299, "column": 1, "offset": 113417 }, + "end": { "line": 4306, "column": 4, "offset": 113641 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4308, "column": 3, "offset": 113645 }, + "end": { "line": 4308, "column": 10, "offset": 113652 } + } + }, + { + "type": "text", + "value": " {integer} Number to be written to ", + "position": { + "start": { "line": 4308, "column": 10, "offset": 113652 }, + "end": { "line": 4308, "column": 45, "offset": 113687 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 4308, "column": 45, "offset": 113687 }, + "end": { "line": 4308, "column": 50, "offset": 113692 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 4308, "column": 50, "offset": 113692 }, + "end": { "line": 4308, "column": 51, "offset": 113693 } + } + } + ], + "position": { + "start": { "line": 4308, "column": 3, "offset": 113645 }, + "end": { "line": 4308, "column": 51, "offset": 113693 } + } + } + ], + "position": { + "start": { "line": 4308, "column": 1, "offset": 113643 }, + "end": { "line": 4308, "column": 51, "offset": 113693 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 4309, "column": 3, "offset": 113696 }, + "end": { "line": 4309, "column": 11, "offset": 113704 } + } + }, + { + "type": "text", + "value": " {integer} Number of bytes to skip before starting to write. Must\nsatisfy ", + "position": { + "start": { "line": 4309, "column": 11, "offset": 113704 }, + "end": { "line": 4310, "column": 11, "offset": 113780 } + } + }, + { + "type": "inlineCode", + "value": "0 <= offset <= buf.length - 1", + "position": { + "start": { "line": 4310, "column": 11, "offset": 113780 }, + "end": { "line": 4310, "column": 42, "offset": 113811 } + } + }, + { + "type": "text", + "value": ". ", + "position": { + "start": { "line": 4310, "column": 42, "offset": 113811 }, + "end": { "line": 4310, "column": 44, "offset": 113813 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { + "line": 4310, + "column": 46, + "offset": 113815 + }, + "end": { "line": 4310, "column": 54, "offset": 113823 } + } + } + ], + "position": { + "start": { "line": 4310, "column": 44, "offset": 113813 }, + "end": { "line": 4310, "column": 56, "offset": 113825 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 4310, "column": 56, "offset": 113825 }, + "end": { "line": 4310, "column": 57, "offset": 113826 } + } + }, + { + "type": "inlineCode", + "value": "0", + "position": { + "start": { "line": 4310, "column": 57, "offset": 113826 }, + "end": { "line": 4310, "column": 60, "offset": 113829 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 4310, "column": 60, "offset": 113829 }, + "end": { "line": 4310, "column": 61, "offset": 113830 } + } + } + ], + "position": { + "start": { "line": 4309, "column": 3, "offset": 113696 }, + "end": { "line": 4310, "column": 61, "offset": 113830 } + } + } + ], + "position": { + "start": { "line": 4309, "column": 1, "offset": 113694 }, + "end": { "line": 4310, "column": 61, "offset": 113830 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {integer} ", + "position": { + "start": { "line": 4311, "column": 3, "offset": 113833 }, + "end": { "line": 4311, "column": 22, "offset": 113852 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 4311, "column": 22, "offset": 113852 }, + "end": { "line": 4311, "column": 30, "offset": 113860 } + } + }, + { + "type": "text", + "value": " plus the number of bytes written.", + "position": { + "start": { "line": 4311, "column": 30, "offset": 113860 }, + "end": { "line": 4311, "column": 64, "offset": 113894 } + } + } + ], + "position": { + "start": { "line": 4311, "column": 3, "offset": 113833 }, + "end": { "line": 4311, "column": 64, "offset": 113894 } + } + } + ], + "position": { + "start": { "line": 4311, "column": 1, "offset": 113831 }, + "end": { "line": 4311, "column": 64, "offset": 113894 } + } + } + ], + "position": { + "start": { "line": 4308, "column": 1, "offset": 113643 }, + "end": { "line": 4311, "column": 64, "offset": 113894 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Writes ", + "position": { + "start": { "line": 4313, "column": 1, "offset": 113896 }, + "end": { "line": 4313, "column": 8, "offset": 113903 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4313, "column": 8, "offset": 113903 }, + "end": { "line": 4313, "column": 15, "offset": 113910 } + } + }, + { + "type": "text", + "value": " to ", + "position": { + "start": { "line": 4313, "column": 15, "offset": 113910 }, + "end": { "line": 4313, "column": 19, "offset": 113914 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 4313, "column": 19, "offset": 113914 }, + "end": { "line": 4313, "column": 24, "offset": 113919 } + } + }, + { + "type": "text", + "value": " at the specified ", + "position": { + "start": { "line": 4313, "column": 24, "offset": 113919 }, + "end": { "line": 4313, "column": 42, "offset": 113937 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 4313, "column": 42, "offset": 113937 }, + "end": { "line": 4313, "column": 50, "offset": 113945 } + } + }, + { + "type": "text", + "value": ". ", + "position": { + "start": { "line": 4313, "column": 50, "offset": 113945 }, + "end": { "line": 4313, "column": 52, "offset": 113947 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4313, "column": 52, "offset": 113947 }, + "end": { "line": 4313, "column": 59, "offset": 113954 } + } + }, + { + "type": "text", + "value": " must be a valid\nsigned 8-bit integer. Behavior is undefined when ", + "position": { + "start": { "line": 4313, "column": 59, "offset": 113954 }, + "end": { "line": 4314, "column": 50, "offset": 114020 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4314, "column": 50, "offset": 114020 }, + "end": { "line": 4314, "column": 57, "offset": 114027 } + } + }, + { + "type": "text", + "value": " is anything other than\na signed 8-bit integer.", + "position": { + "start": { "line": 4314, "column": 57, "offset": 114027 }, + "end": { "line": 4315, "column": 24, "offset": 114074 } + } + } + ], + "position": { + "start": { "line": 4313, "column": 1, "offset": 113896 }, + "end": { "line": 4315, "column": 24, "offset": 114074 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4317, "column": 1, "offset": 114076 }, + "end": { "line": 4317, "column": 8, "offset": 114083 } + } + }, + { + "type": "text", + "value": " is interpreted and written as a two's complement signed integer.", + "position": { + "start": { "line": 4317, "column": 8, "offset": 114083 }, + "end": { "line": 4317, "column": 73, "offset": 114148 } + } + } + ], + "position": { + "start": { "line": 4317, "column": 1, "offset": 114076 }, + "end": { "line": 4317, "column": 73, "offset": 114148 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.allocUnsafe(2);\n\nbuf.writeInt8(2, 0);\nbuf.writeInt8(-2, 1);\n\nconsole.log(buf);\n// Prints: ", + "position": { + "start": { "line": 4319, "column": 1, "offset": 114150 }, + "end": { "line": 4329, "column": 4, "offset": 114323 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.allocUnsafe(2);\n\nbuf.writeInt8(2, 0);\nbuf.writeInt8(-2, 1);\n\nconsole.log(buf);\n// Prints: ", + "position": { + "start": { "line": 4331, "column": 1, "offset": 114325 }, + "end": { "line": 4341, "column": 4, "offset": 114503 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.writeInt16BE(value[, offset])", + "position": { + "start": { "line": 4343, "column": 5, "offset": 114509 }, + "end": { "line": 4343, "column": 40, "offset": 114544 } + } + } + ], + "position": { + "start": { "line": 4343, "column": 1, "offset": 114505 }, + "end": { "line": 4343, "column": 40, "offset": 114544 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 4345, "column": 1, "offset": 114546 }, + "end": { "line": 4352, "column": 4, "offset": 114770 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4354, "column": 3, "offset": 114774 }, + "end": { "line": 4354, "column": 10, "offset": 114781 } + } + }, + { + "type": "text", + "value": " {integer} Number to be written to ", + "position": { + "start": { "line": 4354, "column": 10, "offset": 114781 }, + "end": { "line": 4354, "column": 45, "offset": 114816 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 4354, "column": 45, "offset": 114816 }, + "end": { "line": 4354, "column": 50, "offset": 114821 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 4354, "column": 50, "offset": 114821 }, + "end": { "line": 4354, "column": 51, "offset": 114822 } + } + } + ], + "position": { + "start": { "line": 4354, "column": 3, "offset": 114774 }, + "end": { "line": 4354, "column": 51, "offset": 114822 } + } + } + ], + "position": { + "start": { "line": 4354, "column": 1, "offset": 114772 }, + "end": { "line": 4354, "column": 51, "offset": 114822 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 4355, "column": 3, "offset": 114825 }, + "end": { "line": 4355, "column": 11, "offset": 114833 } + } + }, + { + "type": "text", + "value": " {integer} Number of bytes to skip before starting to write. Must\nsatisfy ", + "position": { + "start": { "line": 4355, "column": 11, "offset": 114833 }, + "end": { "line": 4356, "column": 11, "offset": 114909 } + } + }, + { + "type": "inlineCode", + "value": "0 <= offset <= buf.length - 2", + "position": { + "start": { "line": 4356, "column": 11, "offset": 114909 }, + "end": { "line": 4356, "column": 42, "offset": 114940 } + } + }, + { + "type": "text", + "value": ". ", + "position": { + "start": { "line": 4356, "column": 42, "offset": 114940 }, + "end": { "line": 4356, "column": 44, "offset": 114942 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { + "line": 4356, + "column": 46, + "offset": 114944 + }, + "end": { "line": 4356, "column": 54, "offset": 114952 } + } + } + ], + "position": { + "start": { "line": 4356, "column": 44, "offset": 114942 }, + "end": { "line": 4356, "column": 56, "offset": 114954 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 4356, "column": 56, "offset": 114954 }, + "end": { "line": 4356, "column": 57, "offset": 114955 } + } + }, + { + "type": "inlineCode", + "value": "0", + "position": { + "start": { "line": 4356, "column": 57, "offset": 114955 }, + "end": { "line": 4356, "column": 60, "offset": 114958 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 4356, "column": 60, "offset": 114958 }, + "end": { "line": 4356, "column": 61, "offset": 114959 } + } + } + ], + "position": { + "start": { "line": 4355, "column": 3, "offset": 114825 }, + "end": { "line": 4356, "column": 61, "offset": 114959 } + } + } + ], + "position": { + "start": { "line": 4355, "column": 1, "offset": 114823 }, + "end": { "line": 4356, "column": 61, "offset": 114959 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {integer} ", + "position": { + "start": { "line": 4357, "column": 3, "offset": 114962 }, + "end": { "line": 4357, "column": 22, "offset": 114981 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 4357, "column": 22, "offset": 114981 }, + "end": { "line": 4357, "column": 30, "offset": 114989 } + } + }, + { + "type": "text", + "value": " plus the number of bytes written.", + "position": { + "start": { "line": 4357, "column": 30, "offset": 114989 }, + "end": { "line": 4357, "column": 64, "offset": 115023 } + } + } + ], + "position": { + "start": { "line": 4357, "column": 3, "offset": 114962 }, + "end": { "line": 4357, "column": 64, "offset": 115023 } + } + } + ], + "position": { + "start": { "line": 4357, "column": 1, "offset": 114960 }, + "end": { "line": 4357, "column": 64, "offset": 115023 } + } + } + ], + "position": { + "start": { "line": 4354, "column": 1, "offset": 114772 }, + "end": { "line": 4357, "column": 64, "offset": 115023 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Writes ", + "position": { + "start": { "line": 4359, "column": 1, "offset": 115025 }, + "end": { "line": 4359, "column": 8, "offset": 115032 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4359, "column": 8, "offset": 115032 }, + "end": { "line": 4359, "column": 15, "offset": 115039 } + } + }, + { + "type": "text", + "value": " to ", + "position": { + "start": { "line": 4359, "column": 15, "offset": 115039 }, + "end": { "line": 4359, "column": 19, "offset": 115043 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 4359, "column": 19, "offset": 115043 }, + "end": { "line": 4359, "column": 24, "offset": 115048 } + } + }, + { + "type": "text", + "value": " at the specified ", + "position": { + "start": { "line": 4359, "column": 24, "offset": 115048 }, + "end": { "line": 4359, "column": 42, "offset": 115066 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 4359, "column": 42, "offset": 115066 }, + "end": { "line": 4359, "column": 50, "offset": 115074 } + } + }, + { + "type": "text", + "value": " as big-endian. The ", + "position": { + "start": { "line": 4359, "column": 50, "offset": 115074 }, + "end": { "line": 4359, "column": 71, "offset": 115095 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4359, "column": 71, "offset": 115095 }, + "end": { "line": 4359, "column": 78, "offset": 115102 } + } + }, + { + "type": "text", + "value": "\nmust be a valid signed 16-bit integer. Behavior is undefined when ", + "position": { + "start": { "line": 4359, "column": 78, "offset": 115102 }, + "end": { "line": 4360, "column": 67, "offset": 115169 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4360, "column": 67, "offset": 115169 }, + "end": { "line": 4360, "column": 74, "offset": 115176 } + } + }, + { + "type": "text", + "value": " is\nanything other than a signed 16-bit integer.", + "position": { + "start": { "line": 4360, "column": 74, "offset": 115176 }, + "end": { "line": 4361, "column": 45, "offset": 115224 } + } + } + ], + "position": { + "start": { "line": 4359, "column": 1, "offset": 115025 }, + "end": { "line": 4361, "column": 45, "offset": 115224 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "The ", + "position": { + "start": { "line": 4363, "column": 1, "offset": 115226 }, + "end": { "line": 4363, "column": 5, "offset": 115230 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4363, "column": 5, "offset": 115230 }, + "end": { "line": 4363, "column": 12, "offset": 115237 } + } + }, + { + "type": "text", + "value": " is interpreted and written as a two's complement signed integer.", + "position": { + "start": { "line": 4363, "column": 12, "offset": 115237 }, + "end": { "line": 4363, "column": 77, "offset": 115302 } + } + } + ], + "position": { + "start": { "line": 4363, "column": 1, "offset": 115226 }, + "end": { "line": 4363, "column": 77, "offset": 115302 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.allocUnsafe(2);\n\nbuf.writeInt16BE(0x0102, 0);\n\nconsole.log(buf);\n// Prints: ", + "position": { + "start": { "line": 4365, "column": 1, "offset": 115304 }, + "end": { "line": 4374, "column": 4, "offset": 115463 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.allocUnsafe(2);\n\nbuf.writeInt16BE(0x0102, 0);\n\nconsole.log(buf);\n// Prints: ", + "position": { + "start": { "line": 4376, "column": 1, "offset": 115465 }, + "end": { "line": 4385, "column": 4, "offset": 115629 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.writeInt16LE(value[, offset])", + "position": { + "start": { "line": 4387, "column": 5, "offset": 115635 }, + "end": { "line": 4387, "column": 40, "offset": 115670 } + } + } + ], + "position": { + "start": { "line": 4387, "column": 1, "offset": 115631 }, + "end": { "line": 4387, "column": 40, "offset": 115670 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 4389, "column": 1, "offset": 115672 }, + "end": { "line": 4396, "column": 4, "offset": 115896 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4398, "column": 3, "offset": 115900 }, + "end": { "line": 4398, "column": 10, "offset": 115907 } + } + }, + { + "type": "text", + "value": " {integer} Number to be written to ", + "position": { + "start": { "line": 4398, "column": 10, "offset": 115907 }, + "end": { "line": 4398, "column": 45, "offset": 115942 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 4398, "column": 45, "offset": 115942 }, + "end": { "line": 4398, "column": 50, "offset": 115947 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 4398, "column": 50, "offset": 115947 }, + "end": { "line": 4398, "column": 51, "offset": 115948 } + } + } + ], + "position": { + "start": { "line": 4398, "column": 3, "offset": 115900 }, + "end": { "line": 4398, "column": 51, "offset": 115948 } + } + } + ], + "position": { + "start": { "line": 4398, "column": 1, "offset": 115898 }, + "end": { "line": 4398, "column": 51, "offset": 115948 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 4399, "column": 3, "offset": 115951 }, + "end": { "line": 4399, "column": 11, "offset": 115959 } + } + }, + { + "type": "text", + "value": " {integer} Number of bytes to skip before starting to write. Must\nsatisfy ", + "position": { + "start": { "line": 4399, "column": 11, "offset": 115959 }, + "end": { "line": 4400, "column": 11, "offset": 116035 } + } + }, + { + "type": "inlineCode", + "value": "0 <= offset <= buf.length - 2", + "position": { + "start": { "line": 4400, "column": 11, "offset": 116035 }, + "end": { "line": 4400, "column": 42, "offset": 116066 } + } + }, + { + "type": "text", + "value": ". ", + "position": { + "start": { "line": 4400, "column": 42, "offset": 116066 }, + "end": { "line": 4400, "column": 44, "offset": 116068 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { + "line": 4400, + "column": 46, + "offset": 116070 + }, + "end": { "line": 4400, "column": 54, "offset": 116078 } + } + } + ], + "position": { + "start": { "line": 4400, "column": 44, "offset": 116068 }, + "end": { "line": 4400, "column": 56, "offset": 116080 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 4400, "column": 56, "offset": 116080 }, + "end": { "line": 4400, "column": 57, "offset": 116081 } + } + }, + { + "type": "inlineCode", + "value": "0", + "position": { + "start": { "line": 4400, "column": 57, "offset": 116081 }, + "end": { "line": 4400, "column": 60, "offset": 116084 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 4400, "column": 60, "offset": 116084 }, + "end": { "line": 4400, "column": 61, "offset": 116085 } + } + } + ], + "position": { + "start": { "line": 4399, "column": 3, "offset": 115951 }, + "end": { "line": 4400, "column": 61, "offset": 116085 } + } + } + ], + "position": { + "start": { "line": 4399, "column": 1, "offset": 115949 }, + "end": { "line": 4400, "column": 61, "offset": 116085 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {integer} ", + "position": { + "start": { "line": 4401, "column": 3, "offset": 116088 }, + "end": { "line": 4401, "column": 22, "offset": 116107 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 4401, "column": 22, "offset": 116107 }, + "end": { "line": 4401, "column": 30, "offset": 116115 } + } + }, + { + "type": "text", + "value": " plus the number of bytes written.", + "position": { + "start": { "line": 4401, "column": 30, "offset": 116115 }, + "end": { "line": 4401, "column": 64, "offset": 116149 } + } + } + ], + "position": { + "start": { "line": 4401, "column": 3, "offset": 116088 }, + "end": { "line": 4401, "column": 64, "offset": 116149 } + } + } + ], + "position": { + "start": { "line": 4401, "column": 1, "offset": 116086 }, + "end": { "line": 4401, "column": 64, "offset": 116149 } + } + } + ], + "position": { + "start": { "line": 4398, "column": 1, "offset": 115898 }, + "end": { "line": 4401, "column": 64, "offset": 116149 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Writes ", + "position": { + "start": { "line": 4403, "column": 1, "offset": 116151 }, + "end": { "line": 4403, "column": 8, "offset": 116158 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4403, "column": 8, "offset": 116158 }, + "end": { "line": 4403, "column": 15, "offset": 116165 } + } + }, + { + "type": "text", + "value": " to ", + "position": { + "start": { "line": 4403, "column": 15, "offset": 116165 }, + "end": { "line": 4403, "column": 19, "offset": 116169 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 4403, "column": 19, "offset": 116169 }, + "end": { "line": 4403, "column": 24, "offset": 116174 } + } + }, + { + "type": "text", + "value": " at the specified ", + "position": { + "start": { "line": 4403, "column": 24, "offset": 116174 }, + "end": { "line": 4403, "column": 42, "offset": 116192 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 4403, "column": 42, "offset": 116192 }, + "end": { "line": 4403, "column": 50, "offset": 116200 } + } + }, + { + "type": "text", + "value": " as little-endian. The ", + "position": { + "start": { "line": 4403, "column": 50, "offset": 116200 }, + "end": { "line": 4403, "column": 74, "offset": 116224 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4403, "column": 74, "offset": 116224 }, + "end": { "line": 4403, "column": 81, "offset": 116231 } + } + }, + { + "type": "text", + "value": "\nmust be a valid signed 16-bit integer. Behavior is undefined when ", + "position": { + "start": { "line": 4403, "column": 81, "offset": 116231 }, + "end": { "line": 4404, "column": 67, "offset": 116298 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4404, "column": 67, "offset": 116298 }, + "end": { "line": 4404, "column": 74, "offset": 116305 } + } + }, + { + "type": "text", + "value": " is\nanything other than a signed 16-bit integer.", + "position": { + "start": { "line": 4404, "column": 74, "offset": 116305 }, + "end": { "line": 4405, "column": 45, "offset": 116353 } + } + } + ], + "position": { + "start": { "line": 4403, "column": 1, "offset": 116151 }, + "end": { "line": 4405, "column": 45, "offset": 116353 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "The ", + "position": { + "start": { "line": 4407, "column": 1, "offset": 116355 }, + "end": { "line": 4407, "column": 5, "offset": 116359 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4407, "column": 5, "offset": 116359 }, + "end": { "line": 4407, "column": 12, "offset": 116366 } + } + }, + { + "type": "text", + "value": " is interpreted and written as a two's complement signed integer.", + "position": { + "start": { "line": 4407, "column": 12, "offset": 116366 }, + "end": { "line": 4407, "column": 77, "offset": 116431 } + } + } + ], + "position": { + "start": { "line": 4407, "column": 1, "offset": 116355 }, + "end": { "line": 4407, "column": 77, "offset": 116431 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.allocUnsafe(2);\n\nbuf.writeInt16LE(0x0304, 0);\n\nconsole.log(buf);\n// Prints: ", + "position": { + "start": { "line": 4409, "column": 1, "offset": 116433 }, + "end": { "line": 4418, "column": 4, "offset": 116592 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.allocUnsafe(2);\n\nbuf.writeInt16LE(0x0304, 0);\n\nconsole.log(buf);\n// Prints: ", + "position": { + "start": { "line": 4420, "column": 1, "offset": 116594 }, + "end": { "line": 4429, "column": 4, "offset": 116758 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.writeInt32BE(value[, offset])", + "position": { + "start": { "line": 4431, "column": 5, "offset": 116764 }, + "end": { "line": 4431, "column": 40, "offset": 116799 } + } + } + ], + "position": { + "start": { "line": 4431, "column": 1, "offset": 116760 }, + "end": { "line": 4431, "column": 40, "offset": 116799 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 4433, "column": 1, "offset": 116801 }, + "end": { "line": 4440, "column": 4, "offset": 117025 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4442, "column": 3, "offset": 117029 }, + "end": { "line": 4442, "column": 10, "offset": 117036 } + } + }, + { + "type": "text", + "value": " {integer} Number to be written to ", + "position": { + "start": { "line": 4442, "column": 10, "offset": 117036 }, + "end": { "line": 4442, "column": 45, "offset": 117071 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 4442, "column": 45, "offset": 117071 }, + "end": { "line": 4442, "column": 50, "offset": 117076 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 4442, "column": 50, "offset": 117076 }, + "end": { "line": 4442, "column": 51, "offset": 117077 } + } + } + ], + "position": { + "start": { "line": 4442, "column": 3, "offset": 117029 }, + "end": { "line": 4442, "column": 51, "offset": 117077 } + } + } + ], + "position": { + "start": { "line": 4442, "column": 1, "offset": 117027 }, + "end": { "line": 4442, "column": 51, "offset": 117077 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 4443, "column": 3, "offset": 117080 }, + "end": { "line": 4443, "column": 11, "offset": 117088 } + } + }, + { + "type": "text", + "value": " {integer} Number of bytes to skip before starting to write. Must\nsatisfy ", + "position": { + "start": { "line": 4443, "column": 11, "offset": 117088 }, + "end": { "line": 4444, "column": 11, "offset": 117164 } + } + }, + { + "type": "inlineCode", + "value": "0 <= offset <= buf.length - 4", + "position": { + "start": { "line": 4444, "column": 11, "offset": 117164 }, + "end": { "line": 4444, "column": 42, "offset": 117195 } + } + }, + { + "type": "text", + "value": ". ", + "position": { + "start": { "line": 4444, "column": 42, "offset": 117195 }, + "end": { "line": 4444, "column": 44, "offset": 117197 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { + "line": 4444, + "column": 46, + "offset": 117199 + }, + "end": { "line": 4444, "column": 54, "offset": 117207 } + } + } + ], + "position": { + "start": { "line": 4444, "column": 44, "offset": 117197 }, + "end": { "line": 4444, "column": 56, "offset": 117209 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 4444, "column": 56, "offset": 117209 }, + "end": { "line": 4444, "column": 57, "offset": 117210 } + } + }, + { + "type": "inlineCode", + "value": "0", + "position": { + "start": { "line": 4444, "column": 57, "offset": 117210 }, + "end": { "line": 4444, "column": 60, "offset": 117213 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 4444, "column": 60, "offset": 117213 }, + "end": { "line": 4444, "column": 61, "offset": 117214 } + } + } + ], + "position": { + "start": { "line": 4443, "column": 3, "offset": 117080 }, + "end": { "line": 4444, "column": 61, "offset": 117214 } + } + } + ], + "position": { + "start": { "line": 4443, "column": 1, "offset": 117078 }, + "end": { "line": 4444, "column": 61, "offset": 117214 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {integer} ", + "position": { + "start": { "line": 4445, "column": 3, "offset": 117217 }, + "end": { "line": 4445, "column": 22, "offset": 117236 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 4445, "column": 22, "offset": 117236 }, + "end": { "line": 4445, "column": 30, "offset": 117244 } + } + }, + { + "type": "text", + "value": " plus the number of bytes written.", + "position": { + "start": { "line": 4445, "column": 30, "offset": 117244 }, + "end": { "line": 4445, "column": 64, "offset": 117278 } + } + } + ], + "position": { + "start": { "line": 4445, "column": 3, "offset": 117217 }, + "end": { "line": 4445, "column": 64, "offset": 117278 } + } + } + ], + "position": { + "start": { "line": 4445, "column": 1, "offset": 117215 }, + "end": { "line": 4445, "column": 64, "offset": 117278 } + } + } + ], + "position": { + "start": { "line": 4442, "column": 1, "offset": 117027 }, + "end": { "line": 4445, "column": 64, "offset": 117278 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Writes ", + "position": { + "start": { "line": 4447, "column": 1, "offset": 117280 }, + "end": { "line": 4447, "column": 8, "offset": 117287 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4447, "column": 8, "offset": 117287 }, + "end": { "line": 4447, "column": 15, "offset": 117294 } + } + }, + { + "type": "text", + "value": " to ", + "position": { + "start": { "line": 4447, "column": 15, "offset": 117294 }, + "end": { "line": 4447, "column": 19, "offset": 117298 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 4447, "column": 19, "offset": 117298 }, + "end": { "line": 4447, "column": 24, "offset": 117303 } + } + }, + { + "type": "text", + "value": " at the specified ", + "position": { + "start": { "line": 4447, "column": 24, "offset": 117303 }, + "end": { "line": 4447, "column": 42, "offset": 117321 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 4447, "column": 42, "offset": 117321 }, + "end": { "line": 4447, "column": 50, "offset": 117329 } + } + }, + { + "type": "text", + "value": " as big-endian. The ", + "position": { + "start": { "line": 4447, "column": 50, "offset": 117329 }, + "end": { "line": 4447, "column": 70, "offset": 117349 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4447, "column": 70, "offset": 117349 }, + "end": { "line": 4447, "column": 77, "offset": 117356 } + } + }, + { + "type": "text", + "value": "\nmust be a valid signed 32-bit integer. Behavior is undefined when ", + "position": { + "start": { "line": 4447, "column": 77, "offset": 117356 }, + "end": { "line": 4448, "column": 67, "offset": 117423 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4448, "column": 67, "offset": 117423 }, + "end": { "line": 4448, "column": 74, "offset": 117430 } + } + }, + { + "type": "text", + "value": " is\nanything other than a signed 32-bit integer.", + "position": { + "start": { "line": 4448, "column": 74, "offset": 117430 }, + "end": { "line": 4449, "column": 45, "offset": 117478 } + } + } + ], + "position": { + "start": { "line": 4447, "column": 1, "offset": 117280 }, + "end": { "line": 4449, "column": 45, "offset": 117478 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "The ", + "position": { + "start": { "line": 4451, "column": 1, "offset": 117480 }, + "end": { "line": 4451, "column": 5, "offset": 117484 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4451, "column": 5, "offset": 117484 }, + "end": { "line": 4451, "column": 12, "offset": 117491 } + } + }, + { + "type": "text", + "value": " is interpreted and written as a two's complement signed integer.", + "position": { + "start": { "line": 4451, "column": 12, "offset": 117491 }, + "end": { "line": 4451, "column": 77, "offset": 117556 } + } + } + ], + "position": { + "start": { "line": 4451, "column": 1, "offset": 117480 }, + "end": { "line": 4451, "column": 77, "offset": 117556 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.allocUnsafe(4);\n\nbuf.writeInt32BE(0x01020304, 0);\n\nconsole.log(buf);\n// Prints: ", + "position": { + "start": { "line": 4453, "column": 1, "offset": 117558 }, + "end": { "line": 4462, "column": 4, "offset": 117727 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.allocUnsafe(4);\n\nbuf.writeInt32BE(0x01020304, 0);\n\nconsole.log(buf);\n// Prints: ", + "position": { + "start": { "line": 4464, "column": 1, "offset": 117729 }, + "end": { "line": 4473, "column": 4, "offset": 117903 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.writeInt32LE(value[, offset])", + "position": { + "start": { "line": 4475, "column": 5, "offset": 117909 }, + "end": { "line": 4475, "column": 40, "offset": 117944 } + } + } + ], + "position": { + "start": { "line": 4475, "column": 1, "offset": 117905 }, + "end": { "line": 4475, "column": 40, "offset": 117944 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 4477, "column": 1, "offset": 117946 }, + "end": { "line": 4484, "column": 4, "offset": 118170 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4486, "column": 3, "offset": 118174 }, + "end": { "line": 4486, "column": 10, "offset": 118181 } + } + }, + { + "type": "text", + "value": " {integer} Number to be written to ", + "position": { + "start": { "line": 4486, "column": 10, "offset": 118181 }, + "end": { "line": 4486, "column": 45, "offset": 118216 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 4486, "column": 45, "offset": 118216 }, + "end": { "line": 4486, "column": 50, "offset": 118221 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 4486, "column": 50, "offset": 118221 }, + "end": { "line": 4486, "column": 51, "offset": 118222 } + } + } + ], + "position": { + "start": { "line": 4486, "column": 3, "offset": 118174 }, + "end": { "line": 4486, "column": 51, "offset": 118222 } + } + } + ], + "position": { + "start": { "line": 4486, "column": 1, "offset": 118172 }, + "end": { "line": 4486, "column": 51, "offset": 118222 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 4487, "column": 3, "offset": 118225 }, + "end": { "line": 4487, "column": 11, "offset": 118233 } + } + }, + { + "type": "text", + "value": " {integer} Number of bytes to skip before starting to write. Must\nsatisfy ", + "position": { + "start": { "line": 4487, "column": 11, "offset": 118233 }, + "end": { "line": 4488, "column": 11, "offset": 118309 } + } + }, + { + "type": "inlineCode", + "value": "0 <= offset <= buf.length - 4", + "position": { + "start": { "line": 4488, "column": 11, "offset": 118309 }, + "end": { "line": 4488, "column": 42, "offset": 118340 } + } + }, + { + "type": "text", + "value": ". ", + "position": { + "start": { "line": 4488, "column": 42, "offset": 118340 }, + "end": { "line": 4488, "column": 44, "offset": 118342 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { + "line": 4488, + "column": 46, + "offset": 118344 + }, + "end": { "line": 4488, "column": 54, "offset": 118352 } + } + } + ], + "position": { + "start": { "line": 4488, "column": 44, "offset": 118342 }, + "end": { "line": 4488, "column": 56, "offset": 118354 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 4488, "column": 56, "offset": 118354 }, + "end": { "line": 4488, "column": 57, "offset": 118355 } + } + }, + { + "type": "inlineCode", + "value": "0", + "position": { + "start": { "line": 4488, "column": 57, "offset": 118355 }, + "end": { "line": 4488, "column": 60, "offset": 118358 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 4488, "column": 60, "offset": 118358 }, + "end": { "line": 4488, "column": 61, "offset": 118359 } + } + } + ], + "position": { + "start": { "line": 4487, "column": 3, "offset": 118225 }, + "end": { "line": 4488, "column": 61, "offset": 118359 } + } + } + ], + "position": { + "start": { "line": 4487, "column": 1, "offset": 118223 }, + "end": { "line": 4488, "column": 61, "offset": 118359 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {integer} ", + "position": { + "start": { "line": 4489, "column": 3, "offset": 118362 }, + "end": { "line": 4489, "column": 22, "offset": 118381 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 4489, "column": 22, "offset": 118381 }, + "end": { "line": 4489, "column": 30, "offset": 118389 } + } + }, + { + "type": "text", + "value": " plus the number of bytes written.", + "position": { + "start": { "line": 4489, "column": 30, "offset": 118389 }, + "end": { "line": 4489, "column": 64, "offset": 118423 } + } + } + ], + "position": { + "start": { "line": 4489, "column": 3, "offset": 118362 }, + "end": { "line": 4489, "column": 64, "offset": 118423 } + } + } + ], + "position": { + "start": { "line": 4489, "column": 1, "offset": 118360 }, + "end": { "line": 4489, "column": 64, "offset": 118423 } + } + } + ], + "position": { + "start": { "line": 4486, "column": 1, "offset": 118172 }, + "end": { "line": 4489, "column": 64, "offset": 118423 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Writes ", + "position": { + "start": { "line": 4491, "column": 1, "offset": 118425 }, + "end": { "line": 4491, "column": 8, "offset": 118432 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4491, "column": 8, "offset": 118432 }, + "end": { "line": 4491, "column": 15, "offset": 118439 } + } + }, + { + "type": "text", + "value": " to ", + "position": { + "start": { "line": 4491, "column": 15, "offset": 118439 }, + "end": { "line": 4491, "column": 19, "offset": 118443 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 4491, "column": 19, "offset": 118443 }, + "end": { "line": 4491, "column": 24, "offset": 118448 } + } + }, + { + "type": "text", + "value": " at the specified ", + "position": { + "start": { "line": 4491, "column": 24, "offset": 118448 }, + "end": { "line": 4491, "column": 42, "offset": 118466 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 4491, "column": 42, "offset": 118466 }, + "end": { "line": 4491, "column": 50, "offset": 118474 } + } + }, + { + "type": "text", + "value": " as little-endian. The ", + "position": { + "start": { "line": 4491, "column": 50, "offset": 118474 }, + "end": { "line": 4491, "column": 73, "offset": 118497 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4491, "column": 73, "offset": 118497 }, + "end": { "line": 4491, "column": 80, "offset": 118504 } + } + }, + { + "type": "text", + "value": "\nmust be a valid signed 32-bit integer. Behavior is undefined when ", + "position": { + "start": { "line": 4491, "column": 80, "offset": 118504 }, + "end": { "line": 4492, "column": 67, "offset": 118571 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4492, "column": 67, "offset": 118571 }, + "end": { "line": 4492, "column": 74, "offset": 118578 } + } + }, + { + "type": "text", + "value": " is\nanything other than a signed 32-bit integer.", + "position": { + "start": { "line": 4492, "column": 74, "offset": 118578 }, + "end": { "line": 4493, "column": 45, "offset": 118626 } + } + } + ], + "position": { + "start": { "line": 4491, "column": 1, "offset": 118425 }, + "end": { "line": 4493, "column": 45, "offset": 118626 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "The ", + "position": { + "start": { "line": 4495, "column": 1, "offset": 118628 }, + "end": { "line": 4495, "column": 5, "offset": 118632 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4495, "column": 5, "offset": 118632 }, + "end": { "line": 4495, "column": 12, "offset": 118639 } + } + }, + { + "type": "text", + "value": " is interpreted and written as a two's complement signed integer.", + "position": { + "start": { "line": 4495, "column": 12, "offset": 118639 }, + "end": { "line": 4495, "column": 77, "offset": 118704 } + } + } + ], + "position": { + "start": { "line": 4495, "column": 1, "offset": 118628 }, + "end": { "line": 4495, "column": 77, "offset": 118704 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.allocUnsafe(4);\n\nbuf.writeInt32LE(0x05060708, 0);\n\nconsole.log(buf);\n// Prints: ", + "position": { + "start": { "line": 4497, "column": 1, "offset": 118706 }, + "end": { "line": 4506, "column": 4, "offset": 118875 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.allocUnsafe(4);\n\nbuf.writeInt32LE(0x05060708, 0);\n\nconsole.log(buf);\n// Prints: ", + "position": { + "start": { "line": 4508, "column": 1, "offset": 118877 }, + "end": { "line": 4517, "column": 4, "offset": 119051 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.writeIntBE(value, offset, byteLength)", + "position": { + "start": { "line": 4519, "column": 5, "offset": 119057 }, + "end": { "line": 4519, "column": 48, "offset": 119100 } + } + } + ], + "position": { + "start": { "line": 4519, "column": 1, "offset": 119053 }, + "end": { "line": 4519, "column": 48, "offset": 119100 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 4521, "column": 1, "offset": 119102 }, + "end": { "line": 4528, "column": 4, "offset": 119345 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4530, "column": 3, "offset": 119349 }, + "end": { "line": 4530, "column": 10, "offset": 119356 } + } + }, + { + "type": "text", + "value": " {integer} Number to be written to ", + "position": { + "start": { "line": 4530, "column": 10, "offset": 119356 }, + "end": { "line": 4530, "column": 45, "offset": 119391 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 4530, "column": 45, "offset": 119391 }, + "end": { "line": 4530, "column": 50, "offset": 119396 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 4530, "column": 50, "offset": 119396 }, + "end": { "line": 4530, "column": 51, "offset": 119397 } + } + } + ], + "position": { + "start": { "line": 4530, "column": 3, "offset": 119349 }, + "end": { "line": 4530, "column": 51, "offset": 119397 } + } + } + ], + "position": { + "start": { "line": 4530, "column": 1, "offset": 119347 }, + "end": { "line": 4530, "column": 51, "offset": 119397 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 4531, "column": 3, "offset": 119400 }, + "end": { "line": 4531, "column": 11, "offset": 119408 } + } + }, + { + "type": "text", + "value": " {integer} Number of bytes to skip before starting to write. Must\nsatisfy ", + "position": { + "start": { "line": 4531, "column": 11, "offset": 119408 }, + "end": { "line": 4532, "column": 11, "offset": 119484 } + } + }, + { + "type": "inlineCode", + "value": "0 <= offset <= buf.length - byteLength", + "position": { + "start": { "line": 4532, "column": 11, "offset": 119484 }, + "end": { "line": 4532, "column": 51, "offset": 119524 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 4532, "column": 51, "offset": 119524 }, + "end": { "line": 4532, "column": 52, "offset": 119525 } + } + } + ], + "position": { + "start": { "line": 4531, "column": 3, "offset": 119400 }, + "end": { "line": 4532, "column": 52, "offset": 119525 } + } + } + ], + "position": { + "start": { "line": 4531, "column": 1, "offset": 119398 }, + "end": { "line": 4532, "column": 52, "offset": 119525 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "byteLength", + "position": { + "start": { "line": 4533, "column": 3, "offset": 119528 }, + "end": { "line": 4533, "column": 15, "offset": 119540 } + } + }, + { + "type": "text", + "value": " {integer} Number of bytes to write. Must satisfy\n", + "position": { + "start": { "line": 4533, "column": 15, "offset": 119540 }, + "end": { "line": 4534, "column": 1, "offset": 119590 } + } + }, + { + "type": "inlineCode", + "value": "0 < byteLength <= 6", + "position": { + "start": { "line": 4534, "column": 3, "offset": 119592 }, + "end": { "line": 4534, "column": 24, "offset": 119613 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 4534, "column": 24, "offset": 119613 }, + "end": { "line": 4534, "column": 25, "offset": 119614 } + } + } + ], + "position": { + "start": { "line": 4533, "column": 3, "offset": 119528 }, + "end": { "line": 4534, "column": 25, "offset": 119614 } + } + } + ], + "position": { + "start": { "line": 4533, "column": 1, "offset": 119526 }, + "end": { "line": 4534, "column": 25, "offset": 119614 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {integer} ", + "position": { + "start": { "line": 4535, "column": 3, "offset": 119617 }, + "end": { "line": 4535, "column": 22, "offset": 119636 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 4535, "column": 22, "offset": 119636 }, + "end": { "line": 4535, "column": 30, "offset": 119644 } + } + }, + { + "type": "text", + "value": " plus the number of bytes written.", + "position": { + "start": { "line": 4535, "column": 30, "offset": 119644 }, + "end": { "line": 4535, "column": 64, "offset": 119678 } + } + } + ], + "position": { + "start": { "line": 4535, "column": 3, "offset": 119617 }, + "end": { "line": 4535, "column": 64, "offset": 119678 } + } + } + ], + "position": { + "start": { "line": 4535, "column": 1, "offset": 119615 }, + "end": { "line": 4535, "column": 64, "offset": 119678 } + } + } + ], + "position": { + "start": { "line": 4530, "column": 1, "offset": 119347 }, + "end": { "line": 4535, "column": 64, "offset": 119678 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Writes ", + "position": { + "start": { "line": 4537, "column": 1, "offset": 119680 }, + "end": { "line": 4537, "column": 8, "offset": 119687 } + } + }, + { + "type": "inlineCode", + "value": "byteLength", + "position": { + "start": { "line": 4537, "column": 8, "offset": 119687 }, + "end": { "line": 4537, "column": 20, "offset": 119699 } + } + }, + { + "type": "text", + "value": " bytes of ", + "position": { + "start": { "line": 4537, "column": 20, "offset": 119699 }, + "end": { "line": 4537, "column": 30, "offset": 119709 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4537, "column": 30, "offset": 119709 }, + "end": { "line": 4537, "column": 37, "offset": 119716 } + } + }, + { + "type": "text", + "value": " to ", + "position": { + "start": { "line": 4537, "column": 37, "offset": 119716 }, + "end": { "line": 4537, "column": 41, "offset": 119720 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 4537, "column": 41, "offset": 119720 }, + "end": { "line": 4537, "column": 46, "offset": 119725 } + } + }, + { + "type": "text", + "value": " at the specified ", + "position": { + "start": { "line": 4537, "column": 46, "offset": 119725 }, + "end": { "line": 4537, "column": 64, "offset": 119743 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 4537, "column": 64, "offset": 119743 }, + "end": { "line": 4537, "column": 72, "offset": 119751 } + } + }, + { + "type": "text", + "value": "\nas big-endian. Supports up to 48 bits of accuracy. Behavior is undefined when\n", + "position": { + "start": { "line": 4537, "column": 72, "offset": 119751 }, + "end": { "line": 4539, "column": 1, "offset": 119830 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4539, "column": 1, "offset": 119830 }, + "end": { "line": 4539, "column": 8, "offset": 119837 } + } + }, + { + "type": "text", + "value": " is anything other than a signed integer.", + "position": { + "start": { "line": 4539, "column": 8, "offset": 119837 }, + "end": { "line": 4539, "column": 49, "offset": 119878 } + } + } + ], + "position": { + "start": { "line": 4537, "column": 1, "offset": 119680 }, + "end": { "line": 4539, "column": 49, "offset": 119878 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.allocUnsafe(6);\n\nbuf.writeIntBE(0x1234567890ab, 0, 6);\n\nconsole.log(buf);\n// Prints: ", + "position": { + "start": { "line": 4541, "column": 1, "offset": 119880 }, + "end": { "line": 4550, "column": 4, "offset": 120060 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.allocUnsafe(6);\n\nbuf.writeIntBE(0x1234567890ab, 0, 6);\n\nconsole.log(buf);\n// Prints: ", + "position": { + "start": { "line": 4552, "column": 1, "offset": 120062 }, + "end": { "line": 4561, "column": 4, "offset": 120247 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.writeIntLE(value, offset, byteLength)", + "position": { + "start": { "line": 4563, "column": 5, "offset": 120253 }, + "end": { "line": 4563, "column": 48, "offset": 120296 } + } + } + ], + "position": { + "start": { "line": 4563, "column": 1, "offset": 120249 }, + "end": { "line": 4563, "column": 48, "offset": 120296 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 4565, "column": 1, "offset": 120298 }, + "end": { "line": 4572, "column": 4, "offset": 120541 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4574, "column": 3, "offset": 120545 }, + "end": { "line": 4574, "column": 10, "offset": 120552 } + } + }, + { + "type": "text", + "value": " {integer} Number to be written to ", + "position": { + "start": { "line": 4574, "column": 10, "offset": 120552 }, + "end": { "line": 4574, "column": 45, "offset": 120587 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 4574, "column": 45, "offset": 120587 }, + "end": { "line": 4574, "column": 50, "offset": 120592 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 4574, "column": 50, "offset": 120592 }, + "end": { "line": 4574, "column": 51, "offset": 120593 } + } + } + ], + "position": { + "start": { "line": 4574, "column": 3, "offset": 120545 }, + "end": { "line": 4574, "column": 51, "offset": 120593 } + } + } + ], + "position": { + "start": { "line": 4574, "column": 1, "offset": 120543 }, + "end": { "line": 4574, "column": 51, "offset": 120593 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 4575, "column": 3, "offset": 120596 }, + "end": { "line": 4575, "column": 11, "offset": 120604 } + } + }, + { + "type": "text", + "value": " {integer} Number of bytes to skip before starting to write. Must\nsatisfy ", + "position": { + "start": { "line": 4575, "column": 11, "offset": 120604 }, + "end": { "line": 4576, "column": 11, "offset": 120680 } + } + }, + { + "type": "inlineCode", + "value": "0 <= offset <= buf.length - byteLength", + "position": { + "start": { "line": 4576, "column": 11, "offset": 120680 }, + "end": { "line": 4576, "column": 51, "offset": 120720 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 4576, "column": 51, "offset": 120720 }, + "end": { "line": 4576, "column": 52, "offset": 120721 } + } + } + ], + "position": { + "start": { "line": 4575, "column": 3, "offset": 120596 }, + "end": { "line": 4576, "column": 52, "offset": 120721 } + } + } + ], + "position": { + "start": { "line": 4575, "column": 1, "offset": 120594 }, + "end": { "line": 4576, "column": 52, "offset": 120721 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "byteLength", + "position": { + "start": { "line": 4577, "column": 3, "offset": 120724 }, + "end": { "line": 4577, "column": 15, "offset": 120736 } + } + }, + { + "type": "text", + "value": " {integer} Number of bytes to write. Must satisfy\n", + "position": { + "start": { "line": 4577, "column": 15, "offset": 120736 }, + "end": { "line": 4578, "column": 1, "offset": 120786 } + } + }, + { + "type": "inlineCode", + "value": "0 < byteLength <= 6", + "position": { + "start": { "line": 4578, "column": 3, "offset": 120788 }, + "end": { "line": 4578, "column": 24, "offset": 120809 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 4578, "column": 24, "offset": 120809 }, + "end": { "line": 4578, "column": 25, "offset": 120810 } + } + } + ], + "position": { + "start": { "line": 4577, "column": 3, "offset": 120724 }, + "end": { "line": 4578, "column": 25, "offset": 120810 } + } + } + ], + "position": { + "start": { "line": 4577, "column": 1, "offset": 120722 }, + "end": { "line": 4578, "column": 25, "offset": 120810 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {integer} ", + "position": { + "start": { "line": 4579, "column": 3, "offset": 120813 }, + "end": { "line": 4579, "column": 22, "offset": 120832 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 4579, "column": 22, "offset": 120832 }, + "end": { "line": 4579, "column": 30, "offset": 120840 } + } + }, + { + "type": "text", + "value": " plus the number of bytes written.", + "position": { + "start": { "line": 4579, "column": 30, "offset": 120840 }, + "end": { "line": 4579, "column": 64, "offset": 120874 } + } + } + ], + "position": { + "start": { "line": 4579, "column": 3, "offset": 120813 }, + "end": { "line": 4579, "column": 64, "offset": 120874 } + } + } + ], + "position": { + "start": { "line": 4579, "column": 1, "offset": 120811 }, + "end": { "line": 4579, "column": 64, "offset": 120874 } + } + } + ], + "position": { + "start": { "line": 4574, "column": 1, "offset": 120543 }, + "end": { "line": 4579, "column": 64, "offset": 120874 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Writes ", + "position": { + "start": { "line": 4581, "column": 1, "offset": 120876 }, + "end": { "line": 4581, "column": 8, "offset": 120883 } + } + }, + { + "type": "inlineCode", + "value": "byteLength", + "position": { + "start": { "line": 4581, "column": 8, "offset": 120883 }, + "end": { "line": 4581, "column": 20, "offset": 120895 } + } + }, + { + "type": "text", + "value": " bytes of ", + "position": { + "start": { "line": 4581, "column": 20, "offset": 120895 }, + "end": { "line": 4581, "column": 30, "offset": 120905 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4581, "column": 30, "offset": 120905 }, + "end": { "line": 4581, "column": 37, "offset": 120912 } + } + }, + { + "type": "text", + "value": " to ", + "position": { + "start": { "line": 4581, "column": 37, "offset": 120912 }, + "end": { "line": 4581, "column": 41, "offset": 120916 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 4581, "column": 41, "offset": 120916 }, + "end": { "line": 4581, "column": 46, "offset": 120921 } + } + }, + { + "type": "text", + "value": " at the specified ", + "position": { + "start": { "line": 4581, "column": 46, "offset": 120921 }, + "end": { "line": 4581, "column": 64, "offset": 120939 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 4581, "column": 64, "offset": 120939 }, + "end": { "line": 4581, "column": 72, "offset": 120947 } + } + }, + { + "type": "text", + "value": "\nas little-endian. Supports up to 48 bits of accuracy. Behavior is undefined\nwhen ", + "position": { + "start": { "line": 4581, "column": 72, "offset": 120947 }, + "end": { "line": 4583, "column": 6, "offset": 121029 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4583, "column": 6, "offset": 121029 }, + "end": { "line": 4583, "column": 13, "offset": 121036 } + } + }, + { + "type": "text", + "value": " is anything other than a signed integer.", + "position": { + "start": { "line": 4583, "column": 13, "offset": 121036 }, + "end": { "line": 4583, "column": 54, "offset": 121077 } + } + } + ], + "position": { + "start": { "line": 4581, "column": 1, "offset": 120876 }, + "end": { "line": 4583, "column": 54, "offset": 121077 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.allocUnsafe(6);\n\nbuf.writeIntLE(0x1234567890ab, 0, 6);\n\nconsole.log(buf);\n// Prints: ", + "position": { + "start": { "line": 4585, "column": 1, "offset": 121079 }, + "end": { "line": 4594, "column": 4, "offset": 121259 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.allocUnsafe(6);\n\nbuf.writeIntLE(0x1234567890ab, 0, 6);\n\nconsole.log(buf);\n// Prints: ", + "position": { + "start": { "line": 4596, "column": 1, "offset": 121261 }, + "end": { "line": 4605, "column": 4, "offset": 121446 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.writeUInt8(value[, offset])", + "position": { + "start": { "line": 4607, "column": 5, "offset": 121452 }, + "end": { "line": 4607, "column": 38, "offset": 121485 } + } + } + ], + "position": { + "start": { "line": 4607, "column": 1, "offset": 121448 }, + "end": { "line": 4607, "column": 38, "offset": 121485 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 4609, "column": 1, "offset": 121487 }, + "end": { "line": 4621, "column": 4, "offset": 121879 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4623, "column": 3, "offset": 121883 }, + "end": { "line": 4623, "column": 10, "offset": 121890 } + } + }, + { + "type": "text", + "value": " {integer} Number to be written to ", + "position": { + "start": { "line": 4623, "column": 10, "offset": 121890 }, + "end": { "line": 4623, "column": 45, "offset": 121925 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 4623, "column": 45, "offset": 121925 }, + "end": { "line": 4623, "column": 50, "offset": 121930 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 4623, "column": 50, "offset": 121930 }, + "end": { "line": 4623, "column": 51, "offset": 121931 } + } + } + ], + "position": { + "start": { "line": 4623, "column": 3, "offset": 121883 }, + "end": { "line": 4623, "column": 51, "offset": 121931 } + } + } + ], + "position": { + "start": { "line": 4623, "column": 1, "offset": 121881 }, + "end": { "line": 4623, "column": 51, "offset": 121931 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 4624, "column": 3, "offset": 121934 }, + "end": { "line": 4624, "column": 11, "offset": 121942 } + } + }, + { + "type": "text", + "value": " {integer} Number of bytes to skip before starting to write. Must\nsatisfy ", + "position": { + "start": { "line": 4624, "column": 11, "offset": 121942 }, + "end": { "line": 4625, "column": 11, "offset": 122018 } + } + }, + { + "type": "inlineCode", + "value": "0 <= offset <= buf.length - 1", + "position": { + "start": { "line": 4625, "column": 11, "offset": 122018 }, + "end": { "line": 4625, "column": 42, "offset": 122049 } + } + }, + { + "type": "text", + "value": ". ", + "position": { + "start": { "line": 4625, "column": 42, "offset": 122049 }, + "end": { "line": 4625, "column": 44, "offset": 122051 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { + "line": 4625, + "column": 46, + "offset": 122053 + }, + "end": { "line": 4625, "column": 54, "offset": 122061 } + } + } + ], + "position": { + "start": { "line": 4625, "column": 44, "offset": 122051 }, + "end": { "line": 4625, "column": 56, "offset": 122063 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 4625, "column": 56, "offset": 122063 }, + "end": { "line": 4625, "column": 57, "offset": 122064 } + } + }, + { + "type": "inlineCode", + "value": "0", + "position": { + "start": { "line": 4625, "column": 57, "offset": 122064 }, + "end": { "line": 4625, "column": 60, "offset": 122067 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 4625, "column": 60, "offset": 122067 }, + "end": { "line": 4625, "column": 61, "offset": 122068 } + } + } + ], + "position": { + "start": { "line": 4624, "column": 3, "offset": 121934 }, + "end": { "line": 4625, "column": 61, "offset": 122068 } + } + } + ], + "position": { + "start": { "line": 4624, "column": 1, "offset": 121932 }, + "end": { "line": 4625, "column": 61, "offset": 122068 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {integer} ", + "position": { + "start": { "line": 4626, "column": 3, "offset": 122071 }, + "end": { "line": 4626, "column": 22, "offset": 122090 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 4626, "column": 22, "offset": 122090 }, + "end": { "line": 4626, "column": 30, "offset": 122098 } + } + }, + { + "type": "text", + "value": " plus the number of bytes written.", + "position": { + "start": { "line": 4626, "column": 30, "offset": 122098 }, + "end": { "line": 4626, "column": 64, "offset": 122132 } + } + } + ], + "position": { + "start": { "line": 4626, "column": 3, "offset": 122071 }, + "end": { "line": 4626, "column": 64, "offset": 122132 } + } + } + ], + "position": { + "start": { "line": 4626, "column": 1, "offset": 122069 }, + "end": { "line": 4626, "column": 64, "offset": 122132 } + } + } + ], + "position": { + "start": { "line": 4623, "column": 1, "offset": 121881 }, + "end": { "line": 4626, "column": 64, "offset": 122132 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Writes ", + "position": { + "start": { "line": 4628, "column": 1, "offset": 122134 }, + "end": { "line": 4628, "column": 8, "offset": 122141 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4628, "column": 8, "offset": 122141 }, + "end": { "line": 4628, "column": 15, "offset": 122148 } + } + }, + { + "type": "text", + "value": " to ", + "position": { + "start": { "line": 4628, "column": 15, "offset": 122148 }, + "end": { "line": 4628, "column": 19, "offset": 122152 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 4628, "column": 19, "offset": 122152 }, + "end": { "line": 4628, "column": 24, "offset": 122157 } + } + }, + { + "type": "text", + "value": " at the specified ", + "position": { + "start": { "line": 4628, "column": 24, "offset": 122157 }, + "end": { "line": 4628, "column": 42, "offset": 122175 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 4628, "column": 42, "offset": 122175 }, + "end": { "line": 4628, "column": 50, "offset": 122183 } + } + }, + { + "type": "text", + "value": ". ", + "position": { + "start": { "line": 4628, "column": 50, "offset": 122183 }, + "end": { "line": 4628, "column": 52, "offset": 122185 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4628, "column": 52, "offset": 122185 }, + "end": { "line": 4628, "column": 59, "offset": 122192 } + } + }, + { + "type": "text", + "value": " must be a\nvalid unsigned 8-bit integer. Behavior is undefined when ", + "position": { + "start": { "line": 4628, "column": 59, "offset": 122192 }, + "end": { "line": 4629, "column": 58, "offset": 122260 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4629, "column": 58, "offset": 122260 }, + "end": { "line": 4629, "column": 65, "offset": 122267 } + } + }, + { + "type": "text", + "value": " is anything\nother than an unsigned 8-bit integer.", + "position": { + "start": { "line": 4629, "column": 65, "offset": 122267 }, + "end": { "line": 4630, "column": 38, "offset": 122317 } + } + } + ], + "position": { + "start": { "line": 4628, "column": 1, "offset": 122134 }, + "end": { "line": 4630, "column": 38, "offset": 122317 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "This function is also available under the ", + "position": { + "start": { "line": 4632, "column": 1, "offset": 122319 }, + "end": { "line": 4632, "column": 43, "offset": 122361 } + } + }, + { + "type": "inlineCode", + "value": "writeUint8", + "position": { + "start": { "line": 4632, "column": 43, "offset": 122361 }, + "end": { "line": 4632, "column": 55, "offset": 122373 } + } + }, + { + "type": "text", + "value": " alias.", + "position": { + "start": { "line": 4632, "column": 55, "offset": 122373 }, + "end": { "line": 4632, "column": 62, "offset": 122380 } + } + } + ], + "position": { + "start": { "line": 4632, "column": 1, "offset": 122319 }, + "end": { "line": 4632, "column": 62, "offset": 122380 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.allocUnsafe(4);\n\nbuf.writeUInt8(0x3, 0);\nbuf.writeUInt8(0x4, 1);\nbuf.writeUInt8(0x23, 2);\nbuf.writeUInt8(0x42, 3);\n\nconsole.log(buf);\n// Prints: ", + "position": { + "start": { "line": 4634, "column": 1, "offset": 122382 }, + "end": { "line": 4646, "column": 4, "offset": 122616 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.allocUnsafe(4);\n\nbuf.writeUInt8(0x3, 0);\nbuf.writeUInt8(0x4, 1);\nbuf.writeUInt8(0x23, 2);\nbuf.writeUInt8(0x42, 3);\n\nconsole.log(buf);\n// Prints: ", + "position": { + "start": { "line": 4648, "column": 1, "offset": 122618 }, + "end": { "line": 4660, "column": 4, "offset": 122857 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.writeUInt16BE(value[, offset])", + "position": { + "start": { "line": 4662, "column": 5, "offset": 122863 }, + "end": { "line": 4662, "column": 41, "offset": 122899 } + } + } + ], + "position": { + "start": { "line": 4662, "column": 1, "offset": 122859 }, + "end": { "line": 4662, "column": 41, "offset": 122899 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 4664, "column": 1, "offset": 122901 }, + "end": { "line": 4676, "column": 4, "offset": 123296 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4678, "column": 3, "offset": 123300 }, + "end": { "line": 4678, "column": 10, "offset": 123307 } + } + }, + { + "type": "text", + "value": " {integer} Number to be written to ", + "position": { + "start": { "line": 4678, "column": 10, "offset": 123307 }, + "end": { "line": 4678, "column": 45, "offset": 123342 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 4678, "column": 45, "offset": 123342 }, + "end": { "line": 4678, "column": 50, "offset": 123347 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 4678, "column": 50, "offset": 123347 }, + "end": { "line": 4678, "column": 51, "offset": 123348 } + } + } + ], + "position": { + "start": { "line": 4678, "column": 3, "offset": 123300 }, + "end": { "line": 4678, "column": 51, "offset": 123348 } + } + } + ], + "position": { + "start": { "line": 4678, "column": 1, "offset": 123298 }, + "end": { "line": 4678, "column": 51, "offset": 123348 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 4679, "column": 3, "offset": 123351 }, + "end": { "line": 4679, "column": 11, "offset": 123359 } + } + }, + { + "type": "text", + "value": " {integer} Number of bytes to skip before starting to write. Must\nsatisfy ", + "position": { + "start": { "line": 4679, "column": 11, "offset": 123359 }, + "end": { "line": 4680, "column": 11, "offset": 123435 } + } + }, + { + "type": "inlineCode", + "value": "0 <= offset <= buf.length - 2", + "position": { + "start": { "line": 4680, "column": 11, "offset": 123435 }, + "end": { "line": 4680, "column": 42, "offset": 123466 } + } + }, + { + "type": "text", + "value": ". ", + "position": { + "start": { "line": 4680, "column": 42, "offset": 123466 }, + "end": { "line": 4680, "column": 44, "offset": 123468 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { + "line": 4680, + "column": 46, + "offset": 123470 + }, + "end": { "line": 4680, "column": 54, "offset": 123478 } + } + } + ], + "position": { + "start": { "line": 4680, "column": 44, "offset": 123468 }, + "end": { "line": 4680, "column": 56, "offset": 123480 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 4680, "column": 56, "offset": 123480 }, + "end": { "line": 4680, "column": 57, "offset": 123481 } + } + }, + { + "type": "inlineCode", + "value": "0", + "position": { + "start": { "line": 4680, "column": 57, "offset": 123481 }, + "end": { "line": 4680, "column": 60, "offset": 123484 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 4680, "column": 60, "offset": 123484 }, + "end": { "line": 4680, "column": 61, "offset": 123485 } + } + } + ], + "position": { + "start": { "line": 4679, "column": 3, "offset": 123351 }, + "end": { "line": 4680, "column": 61, "offset": 123485 } + } + } + ], + "position": { + "start": { "line": 4679, "column": 1, "offset": 123349 }, + "end": { "line": 4680, "column": 61, "offset": 123485 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {integer} ", + "position": { + "start": { "line": 4681, "column": 3, "offset": 123488 }, + "end": { "line": 4681, "column": 22, "offset": 123507 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 4681, "column": 22, "offset": 123507 }, + "end": { "line": 4681, "column": 30, "offset": 123515 } + } + }, + { + "type": "text", + "value": " plus the number of bytes written.", + "position": { + "start": { "line": 4681, "column": 30, "offset": 123515 }, + "end": { "line": 4681, "column": 64, "offset": 123549 } + } + } + ], + "position": { + "start": { "line": 4681, "column": 3, "offset": 123488 }, + "end": { "line": 4681, "column": 64, "offset": 123549 } + } + } + ], + "position": { + "start": { "line": 4681, "column": 1, "offset": 123486 }, + "end": { "line": 4681, "column": 64, "offset": 123549 } + } + } + ], + "position": { + "start": { "line": 4678, "column": 1, "offset": 123298 }, + "end": { "line": 4681, "column": 64, "offset": 123549 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Writes ", + "position": { + "start": { "line": 4683, "column": 1, "offset": 123551 }, + "end": { "line": 4683, "column": 8, "offset": 123558 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4683, "column": 8, "offset": 123558 }, + "end": { "line": 4683, "column": 15, "offset": 123565 } + } + }, + { + "type": "text", + "value": " to ", + "position": { + "start": { "line": 4683, "column": 15, "offset": 123565 }, + "end": { "line": 4683, "column": 19, "offset": 123569 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 4683, "column": 19, "offset": 123569 }, + "end": { "line": 4683, "column": 24, "offset": 123574 } + } + }, + { + "type": "text", + "value": " at the specified ", + "position": { + "start": { "line": 4683, "column": 24, "offset": 123574 }, + "end": { "line": 4683, "column": 42, "offset": 123592 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 4683, "column": 42, "offset": 123592 }, + "end": { "line": 4683, "column": 50, "offset": 123600 } + } + }, + { + "type": "text", + "value": " as big-endian. The ", + "position": { + "start": { "line": 4683, "column": 50, "offset": 123600 }, + "end": { "line": 4683, "column": 70, "offset": 123620 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4683, "column": 70, "offset": 123620 }, + "end": { "line": 4683, "column": 77, "offset": 123627 } + } + }, + { + "type": "text", + "value": "\nmust be a valid unsigned 16-bit integer. Behavior is undefined when ", + "position": { + "start": { "line": 4683, "column": 77, "offset": 123627 }, + "end": { "line": 4684, "column": 69, "offset": 123696 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4684, "column": 69, "offset": 123696 }, + "end": { "line": 4684, "column": 76, "offset": 123703 } + } + }, + { + "type": "text", + "value": "\nis anything other than an unsigned 16-bit integer.", + "position": { + "start": { "line": 4684, "column": 76, "offset": 123703 }, + "end": { "line": 4685, "column": 51, "offset": 123754 } + } + } + ], + "position": { + "start": { "line": 4683, "column": 1, "offset": 123551 }, + "end": { "line": 4685, "column": 51, "offset": 123754 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "This function is also available under the ", + "position": { + "start": { "line": 4687, "column": 1, "offset": 123756 }, + "end": { "line": 4687, "column": 43, "offset": 123798 } + } + }, + { + "type": "inlineCode", + "value": "writeUint16BE", + "position": { + "start": { "line": 4687, "column": 43, "offset": 123798 }, + "end": { "line": 4687, "column": 58, "offset": 123813 } + } + }, + { + "type": "text", + "value": " alias.", + "position": { + "start": { "line": 4687, "column": 58, "offset": 123813 }, + "end": { "line": 4687, "column": 65, "offset": 123820 } + } + } + ], + "position": { + "start": { "line": 4687, "column": 1, "offset": 123756 }, + "end": { "line": 4687, "column": 65, "offset": 123820 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.allocUnsafe(4);\n\nbuf.writeUInt16BE(0xdead, 0);\nbuf.writeUInt16BE(0xbeef, 2);\n\nconsole.log(buf);\n// Prints: ", + "position": { + "start": { "line": 4689, "column": 1, "offset": 123822 }, + "end": { "line": 4699, "column": 4, "offset": 124018 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.allocUnsafe(4);\n\nbuf.writeUInt16BE(0xdead, 0);\nbuf.writeUInt16BE(0xbeef, 2);\n\nconsole.log(buf);\n// Prints: ", + "position": { + "start": { "line": 4701, "column": 1, "offset": 124020 }, + "end": { "line": 4711, "column": 4, "offset": 124221 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.writeUInt16LE(value[, offset])", + "position": { + "start": { "line": 4713, "column": 5, "offset": 124227 }, + "end": { "line": 4713, "column": 41, "offset": 124263 } + } + } + ], + "position": { + "start": { "line": 4713, "column": 1, "offset": 124223 }, + "end": { "line": 4713, "column": 41, "offset": 124263 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 4715, "column": 1, "offset": 124265 }, + "end": { "line": 4727, "column": 4, "offset": 124660 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4729, "column": 3, "offset": 124664 }, + "end": { "line": 4729, "column": 10, "offset": 124671 } + } + }, + { + "type": "text", + "value": " {integer} Number to be written to ", + "position": { + "start": { "line": 4729, "column": 10, "offset": 124671 }, + "end": { "line": 4729, "column": 45, "offset": 124706 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 4729, "column": 45, "offset": 124706 }, + "end": { "line": 4729, "column": 50, "offset": 124711 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 4729, "column": 50, "offset": 124711 }, + "end": { "line": 4729, "column": 51, "offset": 124712 } + } + } + ], + "position": { + "start": { "line": 4729, "column": 3, "offset": 124664 }, + "end": { "line": 4729, "column": 51, "offset": 124712 } + } + } + ], + "position": { + "start": { "line": 4729, "column": 1, "offset": 124662 }, + "end": { "line": 4729, "column": 51, "offset": 124712 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 4730, "column": 3, "offset": 124715 }, + "end": { "line": 4730, "column": 11, "offset": 124723 } + } + }, + { + "type": "text", + "value": " {integer} Number of bytes to skip before starting to write. Must\nsatisfy ", + "position": { + "start": { "line": 4730, "column": 11, "offset": 124723 }, + "end": { "line": 4731, "column": 11, "offset": 124799 } + } + }, + { + "type": "inlineCode", + "value": "0 <= offset <= buf.length - 2", + "position": { + "start": { "line": 4731, "column": 11, "offset": 124799 }, + "end": { "line": 4731, "column": 42, "offset": 124830 } + } + }, + { + "type": "text", + "value": ". ", + "position": { + "start": { "line": 4731, "column": 42, "offset": 124830 }, + "end": { "line": 4731, "column": 44, "offset": 124832 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { + "line": 4731, + "column": 46, + "offset": 124834 + }, + "end": { "line": 4731, "column": 54, "offset": 124842 } + } + } + ], + "position": { + "start": { "line": 4731, "column": 44, "offset": 124832 }, + "end": { "line": 4731, "column": 56, "offset": 124844 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 4731, "column": 56, "offset": 124844 }, + "end": { "line": 4731, "column": 57, "offset": 124845 } + } + }, + { + "type": "inlineCode", + "value": "0", + "position": { + "start": { "line": 4731, "column": 57, "offset": 124845 }, + "end": { "line": 4731, "column": 60, "offset": 124848 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 4731, "column": 60, "offset": 124848 }, + "end": { "line": 4731, "column": 61, "offset": 124849 } + } + } + ], + "position": { + "start": { "line": 4730, "column": 3, "offset": 124715 }, + "end": { "line": 4731, "column": 61, "offset": 124849 } + } + } + ], + "position": { + "start": { "line": 4730, "column": 1, "offset": 124713 }, + "end": { "line": 4731, "column": 61, "offset": 124849 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {integer} ", + "position": { + "start": { "line": 4732, "column": 3, "offset": 124852 }, + "end": { "line": 4732, "column": 22, "offset": 124871 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 4732, "column": 22, "offset": 124871 }, + "end": { "line": 4732, "column": 30, "offset": 124879 } + } + }, + { + "type": "text", + "value": " plus the number of bytes written.", + "position": { + "start": { "line": 4732, "column": 30, "offset": 124879 }, + "end": { "line": 4732, "column": 64, "offset": 124913 } + } + } + ], + "position": { + "start": { "line": 4732, "column": 3, "offset": 124852 }, + "end": { "line": 4732, "column": 64, "offset": 124913 } + } + } + ], + "position": { + "start": { "line": 4732, "column": 1, "offset": 124850 }, + "end": { "line": 4732, "column": 64, "offset": 124913 } + } + } + ], + "position": { + "start": { "line": 4729, "column": 1, "offset": 124662 }, + "end": { "line": 4732, "column": 64, "offset": 124913 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Writes ", + "position": { + "start": { "line": 4734, "column": 1, "offset": 124915 }, + "end": { "line": 4734, "column": 8, "offset": 124922 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4734, "column": 8, "offset": 124922 }, + "end": { "line": 4734, "column": 15, "offset": 124929 } + } + }, + { + "type": "text", + "value": " to ", + "position": { + "start": { "line": 4734, "column": 15, "offset": 124929 }, + "end": { "line": 4734, "column": 19, "offset": 124933 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 4734, "column": 19, "offset": 124933 }, + "end": { "line": 4734, "column": 24, "offset": 124938 } + } + }, + { + "type": "text", + "value": " at the specified ", + "position": { + "start": { "line": 4734, "column": 24, "offset": 124938 }, + "end": { "line": 4734, "column": 42, "offset": 124956 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 4734, "column": 42, "offset": 124956 }, + "end": { "line": 4734, "column": 50, "offset": 124964 } + } + }, + { + "type": "text", + "value": " as little-endian. The ", + "position": { + "start": { "line": 4734, "column": 50, "offset": 124964 }, + "end": { "line": 4734, "column": 73, "offset": 124987 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4734, "column": 73, "offset": 124987 }, + "end": { "line": 4734, "column": 80, "offset": 124994 } + } + }, + { + "type": "text", + "value": "\nmust be a valid unsigned 16-bit integer. Behavior is undefined when ", + "position": { + "start": { "line": 4734, "column": 80, "offset": 124994 }, + "end": { "line": 4735, "column": 69, "offset": 125063 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4735, "column": 69, "offset": 125063 }, + "end": { "line": 4735, "column": 76, "offset": 125070 } + } + }, + { + "type": "text", + "value": " is\nanything other than an unsigned 16-bit integer.", + "position": { + "start": { "line": 4735, "column": 76, "offset": 125070 }, + "end": { "line": 4736, "column": 48, "offset": 125121 } + } + } + ], + "position": { + "start": { "line": 4734, "column": 1, "offset": 124915 }, + "end": { "line": 4736, "column": 48, "offset": 125121 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "This function is also available under the ", + "position": { + "start": { "line": 4738, "column": 1, "offset": 125123 }, + "end": { "line": 4738, "column": 43, "offset": 125165 } + } + }, + { + "type": "inlineCode", + "value": "writeUint16LE", + "position": { + "start": { "line": 4738, "column": 43, "offset": 125165 }, + "end": { "line": 4738, "column": 58, "offset": 125180 } + } + }, + { + "type": "text", + "value": " alias.", + "position": { + "start": { "line": 4738, "column": 58, "offset": 125180 }, + "end": { "line": 4738, "column": 65, "offset": 125187 } + } + } + ], + "position": { + "start": { "line": 4738, "column": 1, "offset": 125123 }, + "end": { "line": 4738, "column": 65, "offset": 125187 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.allocUnsafe(4);\n\nbuf.writeUInt16LE(0xdead, 0);\nbuf.writeUInt16LE(0xbeef, 2);\n\nconsole.log(buf);\n// Prints: ", + "position": { + "start": { "line": 4740, "column": 1, "offset": 125189 }, + "end": { "line": 4750, "column": 4, "offset": 125385 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.allocUnsafe(4);\n\nbuf.writeUInt16LE(0xdead, 0);\nbuf.writeUInt16LE(0xbeef, 2);\n\nconsole.log(buf);\n// Prints: ", + "position": { + "start": { "line": 4752, "column": 1, "offset": 125387 }, + "end": { "line": 4762, "column": 4, "offset": 125588 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.writeUInt32BE(value[, offset])", + "position": { + "start": { "line": 4764, "column": 5, "offset": 125594 }, + "end": { "line": 4764, "column": 41, "offset": 125630 } + } + } + ], + "position": { + "start": { "line": 4764, "column": 1, "offset": 125590 }, + "end": { "line": 4764, "column": 41, "offset": 125630 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 4766, "column": 1, "offset": 125632 }, + "end": { "line": 4778, "column": 4, "offset": 126027 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4780, "column": 3, "offset": 126031 }, + "end": { "line": 4780, "column": 10, "offset": 126038 } + } + }, + { + "type": "text", + "value": " {integer} Number to be written to ", + "position": { + "start": { "line": 4780, "column": 10, "offset": 126038 }, + "end": { "line": 4780, "column": 45, "offset": 126073 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 4780, "column": 45, "offset": 126073 }, + "end": { "line": 4780, "column": 50, "offset": 126078 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 4780, "column": 50, "offset": 126078 }, + "end": { "line": 4780, "column": 51, "offset": 126079 } + } + } + ], + "position": { + "start": { "line": 4780, "column": 3, "offset": 126031 }, + "end": { "line": 4780, "column": 51, "offset": 126079 } + } + } + ], + "position": { + "start": { "line": 4780, "column": 1, "offset": 126029 }, + "end": { "line": 4780, "column": 51, "offset": 126079 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 4781, "column": 3, "offset": 126082 }, + "end": { "line": 4781, "column": 11, "offset": 126090 } + } + }, + { + "type": "text", + "value": " {integer} Number of bytes to skip before starting to write. Must\nsatisfy ", + "position": { + "start": { "line": 4781, "column": 11, "offset": 126090 }, + "end": { "line": 4782, "column": 11, "offset": 126166 } + } + }, + { + "type": "inlineCode", + "value": "0 <= offset <= buf.length - 4", + "position": { + "start": { "line": 4782, "column": 11, "offset": 126166 }, + "end": { "line": 4782, "column": 42, "offset": 126197 } + } + }, + { + "type": "text", + "value": ". ", + "position": { + "start": { "line": 4782, "column": 42, "offset": 126197 }, + "end": { "line": 4782, "column": 44, "offset": 126199 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { + "line": 4782, + "column": 46, + "offset": 126201 + }, + "end": { "line": 4782, "column": 54, "offset": 126209 } + } + } + ], + "position": { + "start": { "line": 4782, "column": 44, "offset": 126199 }, + "end": { "line": 4782, "column": 56, "offset": 126211 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 4782, "column": 56, "offset": 126211 }, + "end": { "line": 4782, "column": 57, "offset": 126212 } + } + }, + { + "type": "inlineCode", + "value": "0", + "position": { + "start": { "line": 4782, "column": 57, "offset": 126212 }, + "end": { "line": 4782, "column": 60, "offset": 126215 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 4782, "column": 60, "offset": 126215 }, + "end": { "line": 4782, "column": 61, "offset": 126216 } + } + } + ], + "position": { + "start": { "line": 4781, "column": 3, "offset": 126082 }, + "end": { "line": 4782, "column": 61, "offset": 126216 } + } + } + ], + "position": { + "start": { "line": 4781, "column": 1, "offset": 126080 }, + "end": { "line": 4782, "column": 61, "offset": 126216 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {integer} ", + "position": { + "start": { "line": 4783, "column": 3, "offset": 126219 }, + "end": { "line": 4783, "column": 22, "offset": 126238 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 4783, "column": 22, "offset": 126238 }, + "end": { "line": 4783, "column": 30, "offset": 126246 } + } + }, + { + "type": "text", + "value": " plus the number of bytes written.", + "position": { + "start": { "line": 4783, "column": 30, "offset": 126246 }, + "end": { "line": 4783, "column": 64, "offset": 126280 } + } + } + ], + "position": { + "start": { "line": 4783, "column": 3, "offset": 126219 }, + "end": { "line": 4783, "column": 64, "offset": 126280 } + } + } + ], + "position": { + "start": { "line": 4783, "column": 1, "offset": 126217 }, + "end": { "line": 4783, "column": 64, "offset": 126280 } + } + } + ], + "position": { + "start": { "line": 4780, "column": 1, "offset": 126029 }, + "end": { "line": 4783, "column": 64, "offset": 126280 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Writes ", + "position": { + "start": { "line": 4785, "column": 1, "offset": 126282 }, + "end": { "line": 4785, "column": 8, "offset": 126289 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4785, "column": 8, "offset": 126289 }, + "end": { "line": 4785, "column": 15, "offset": 126296 } + } + }, + { + "type": "text", + "value": " to ", + "position": { + "start": { "line": 4785, "column": 15, "offset": 126296 }, + "end": { "line": 4785, "column": 19, "offset": 126300 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 4785, "column": 19, "offset": 126300 }, + "end": { "line": 4785, "column": 24, "offset": 126305 } + } + }, + { + "type": "text", + "value": " at the specified ", + "position": { + "start": { "line": 4785, "column": 24, "offset": 126305 }, + "end": { "line": 4785, "column": 42, "offset": 126323 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 4785, "column": 42, "offset": 126323 }, + "end": { "line": 4785, "column": 50, "offset": 126331 } + } + }, + { + "type": "text", + "value": " as big-endian. The ", + "position": { + "start": { "line": 4785, "column": 50, "offset": 126331 }, + "end": { "line": 4785, "column": 70, "offset": 126351 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4785, "column": 70, "offset": 126351 }, + "end": { "line": 4785, "column": 77, "offset": 126358 } + } + }, + { + "type": "text", + "value": "\nmust be a valid unsigned 32-bit integer. Behavior is undefined when ", + "position": { + "start": { "line": 4785, "column": 77, "offset": 126358 }, + "end": { "line": 4786, "column": 69, "offset": 126427 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4786, "column": 69, "offset": 126427 }, + "end": { "line": 4786, "column": 76, "offset": 126434 } + } + }, + { + "type": "text", + "value": "\nis anything other than an unsigned 32-bit integer.", + "position": { + "start": { "line": 4786, "column": 76, "offset": 126434 }, + "end": { "line": 4787, "column": 51, "offset": 126485 } + } + } + ], + "position": { + "start": { "line": 4785, "column": 1, "offset": 126282 }, + "end": { "line": 4787, "column": 51, "offset": 126485 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "This function is also available under the ", + "position": { + "start": { "line": 4789, "column": 1, "offset": 126487 }, + "end": { "line": 4789, "column": 43, "offset": 126529 } + } + }, + { + "type": "inlineCode", + "value": "writeUint32BE", + "position": { + "start": { "line": 4789, "column": 43, "offset": 126529 }, + "end": { "line": 4789, "column": 58, "offset": 126544 } + } + }, + { + "type": "text", + "value": " alias.", + "position": { + "start": { "line": 4789, "column": 58, "offset": 126544 }, + "end": { "line": 4789, "column": 65, "offset": 126551 } + } + } + ], + "position": { + "start": { "line": 4789, "column": 1, "offset": 126487 }, + "end": { "line": 4789, "column": 65, "offset": 126551 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.allocUnsafe(4);\n\nbuf.writeUInt32BE(0xfeedface, 0);\n\nconsole.log(buf);\n// Prints: ", + "position": { + "start": { "line": 4791, "column": 1, "offset": 126553 }, + "end": { "line": 4800, "column": 4, "offset": 126723 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.allocUnsafe(4);\n\nbuf.writeUInt32BE(0xfeedface, 0);\n\nconsole.log(buf);\n// Prints: ", + "position": { + "start": { "line": 4802, "column": 1, "offset": 126725 }, + "end": { "line": 4811, "column": 4, "offset": 126900 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.writeUInt32LE(value[, offset])", + "position": { + "start": { "line": 4813, "column": 5, "offset": 126906 }, + "end": { "line": 4813, "column": 41, "offset": 126942 } + } + } + ], + "position": { + "start": { "line": 4813, "column": 1, "offset": 126902 }, + "end": { "line": 4813, "column": 41, "offset": 126942 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 4815, "column": 1, "offset": 126944 }, + "end": { "line": 4827, "column": 4, "offset": 127339 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4829, "column": 3, "offset": 127343 }, + "end": { "line": 4829, "column": 10, "offset": 127350 } + } + }, + { + "type": "text", + "value": " {integer} Number to be written to ", + "position": { + "start": { "line": 4829, "column": 10, "offset": 127350 }, + "end": { "line": 4829, "column": 45, "offset": 127385 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 4829, "column": 45, "offset": 127385 }, + "end": { "line": 4829, "column": 50, "offset": 127390 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 4829, "column": 50, "offset": 127390 }, + "end": { "line": 4829, "column": 51, "offset": 127391 } + } + } + ], + "position": { + "start": { "line": 4829, "column": 3, "offset": 127343 }, + "end": { "line": 4829, "column": 51, "offset": 127391 } + } + } + ], + "position": { + "start": { "line": 4829, "column": 1, "offset": 127341 }, + "end": { "line": 4829, "column": 51, "offset": 127391 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 4830, "column": 3, "offset": 127394 }, + "end": { "line": 4830, "column": 11, "offset": 127402 } + } + }, + { + "type": "text", + "value": " {integer} Number of bytes to skip before starting to write. Must\nsatisfy ", + "position": { + "start": { "line": 4830, "column": 11, "offset": 127402 }, + "end": { "line": 4831, "column": 11, "offset": 127478 } + } + }, + { + "type": "inlineCode", + "value": "0 <= offset <= buf.length - 4", + "position": { + "start": { "line": 4831, "column": 11, "offset": 127478 }, + "end": { "line": 4831, "column": 42, "offset": 127509 } + } + }, + { + "type": "text", + "value": ". ", + "position": { + "start": { "line": 4831, "column": 42, "offset": 127509 }, + "end": { "line": 4831, "column": 44, "offset": 127511 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { + "line": 4831, + "column": 46, + "offset": 127513 + }, + "end": { "line": 4831, "column": 54, "offset": 127521 } + } + } + ], + "position": { + "start": { "line": 4831, "column": 44, "offset": 127511 }, + "end": { "line": 4831, "column": 56, "offset": 127523 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 4831, "column": 56, "offset": 127523 }, + "end": { "line": 4831, "column": 57, "offset": 127524 } + } + }, + { + "type": "inlineCode", + "value": "0", + "position": { + "start": { "line": 4831, "column": 57, "offset": 127524 }, + "end": { "line": 4831, "column": 60, "offset": 127527 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 4831, "column": 60, "offset": 127527 }, + "end": { "line": 4831, "column": 61, "offset": 127528 } + } + } + ], + "position": { + "start": { "line": 4830, "column": 3, "offset": 127394 }, + "end": { "line": 4831, "column": 61, "offset": 127528 } + } + } + ], + "position": { + "start": { "line": 4830, "column": 1, "offset": 127392 }, + "end": { "line": 4831, "column": 61, "offset": 127528 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {integer} ", + "position": { + "start": { "line": 4832, "column": 3, "offset": 127531 }, + "end": { "line": 4832, "column": 22, "offset": 127550 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 4832, "column": 22, "offset": 127550 }, + "end": { "line": 4832, "column": 30, "offset": 127558 } + } + }, + { + "type": "text", + "value": " plus the number of bytes written.", + "position": { + "start": { "line": 4832, "column": 30, "offset": 127558 }, + "end": { "line": 4832, "column": 64, "offset": 127592 } + } + } + ], + "position": { + "start": { "line": 4832, "column": 3, "offset": 127531 }, + "end": { "line": 4832, "column": 64, "offset": 127592 } + } + } + ], + "position": { + "start": { "line": 4832, "column": 1, "offset": 127529 }, + "end": { "line": 4832, "column": 64, "offset": 127592 } + } + } + ], + "position": { + "start": { "line": 4829, "column": 1, "offset": 127341 }, + "end": { "line": 4832, "column": 64, "offset": 127592 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Writes ", + "position": { + "start": { "line": 4834, "column": 1, "offset": 127594 }, + "end": { "line": 4834, "column": 8, "offset": 127601 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4834, "column": 8, "offset": 127601 }, + "end": { "line": 4834, "column": 15, "offset": 127608 } + } + }, + { + "type": "text", + "value": " to ", + "position": { + "start": { "line": 4834, "column": 15, "offset": 127608 }, + "end": { "line": 4834, "column": 19, "offset": 127612 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 4834, "column": 19, "offset": 127612 }, + "end": { "line": 4834, "column": 24, "offset": 127617 } + } + }, + { + "type": "text", + "value": " at the specified ", + "position": { + "start": { "line": 4834, "column": 24, "offset": 127617 }, + "end": { "line": 4834, "column": 42, "offset": 127635 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 4834, "column": 42, "offset": 127635 }, + "end": { "line": 4834, "column": 50, "offset": 127643 } + } + }, + { + "type": "text", + "value": " as little-endian. The ", + "position": { + "start": { "line": 4834, "column": 50, "offset": 127643 }, + "end": { "line": 4834, "column": 73, "offset": 127666 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4834, "column": 73, "offset": 127666 }, + "end": { "line": 4834, "column": 80, "offset": 127673 } + } + }, + { + "type": "text", + "value": "\nmust be a valid unsigned 32-bit integer. Behavior is undefined when ", + "position": { + "start": { "line": 4834, "column": 80, "offset": 127673 }, + "end": { "line": 4835, "column": 69, "offset": 127742 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4835, "column": 69, "offset": 127742 }, + "end": { "line": 4835, "column": 76, "offset": 127749 } + } + }, + { + "type": "text", + "value": " is\nanything other than an unsigned 32-bit integer.", + "position": { + "start": { "line": 4835, "column": 76, "offset": 127749 }, + "end": { "line": 4836, "column": 48, "offset": 127800 } + } + } + ], + "position": { + "start": { "line": 4834, "column": 1, "offset": 127594 }, + "end": { "line": 4836, "column": 48, "offset": 127800 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "This function is also available under the ", + "position": { + "start": { "line": 4838, "column": 1, "offset": 127802 }, + "end": { "line": 4838, "column": 43, "offset": 127844 } + } + }, + { + "type": "inlineCode", + "value": "writeUint32LE", + "position": { + "start": { "line": 4838, "column": 43, "offset": 127844 }, + "end": { "line": 4838, "column": 58, "offset": 127859 } + } + }, + { + "type": "text", + "value": " alias.", + "position": { + "start": { "line": 4838, "column": 58, "offset": 127859 }, + "end": { "line": 4838, "column": 65, "offset": 127866 } + } + } + ], + "position": { + "start": { "line": 4838, "column": 1, "offset": 127802 }, + "end": { "line": 4838, "column": 65, "offset": 127866 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.allocUnsafe(4);\n\nbuf.writeUInt32LE(0xfeedface, 0);\n\nconsole.log(buf);\n// Prints: ", + "position": { + "start": { "line": 4840, "column": 1, "offset": 127868 }, + "end": { "line": 4849, "column": 4, "offset": 128038 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.allocUnsafe(4);\n\nbuf.writeUInt32LE(0xfeedface, 0);\n\nconsole.log(buf);\n// Prints: ", + "position": { + "start": { "line": 4851, "column": 1, "offset": 128040 }, + "end": { "line": 4860, "column": 4, "offset": 128215 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.writeUIntBE(value, offset, byteLength)", + "position": { + "start": { "line": 4862, "column": 5, "offset": 128221 }, + "end": { "line": 4862, "column": 49, "offset": 128265 } + } + } + ], + "position": { + "start": { "line": 4862, "column": 1, "offset": 128217 }, + "end": { "line": 4862, "column": 49, "offset": 128265 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 4864, "column": 1, "offset": 128267 }, + "end": { "line": 4876, "column": 4, "offset": 128677 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4878, "column": 3, "offset": 128681 }, + "end": { "line": 4878, "column": 10, "offset": 128688 } + } + }, + { + "type": "text", + "value": " {integer} Number to be written to ", + "position": { + "start": { "line": 4878, "column": 10, "offset": 128688 }, + "end": { "line": 4878, "column": 45, "offset": 128723 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 4878, "column": 45, "offset": 128723 }, + "end": { "line": 4878, "column": 50, "offset": 128728 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 4878, "column": 50, "offset": 128728 }, + "end": { "line": 4878, "column": 51, "offset": 128729 } + } + } + ], + "position": { + "start": { "line": 4878, "column": 3, "offset": 128681 }, + "end": { "line": 4878, "column": 51, "offset": 128729 } + } + } + ], + "position": { + "start": { "line": 4878, "column": 1, "offset": 128679 }, + "end": { "line": 4878, "column": 51, "offset": 128729 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 4879, "column": 3, "offset": 128732 }, + "end": { "line": 4879, "column": 11, "offset": 128740 } + } + }, + { + "type": "text", + "value": " {integer} Number of bytes to skip before starting to write. Must\nsatisfy ", + "position": { + "start": { "line": 4879, "column": 11, "offset": 128740 }, + "end": { "line": 4880, "column": 11, "offset": 128816 } + } + }, + { + "type": "inlineCode", + "value": "0 <= offset <= buf.length - byteLength", + "position": { + "start": { "line": 4880, "column": 11, "offset": 128816 }, + "end": { "line": 4880, "column": 51, "offset": 128856 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 4880, "column": 51, "offset": 128856 }, + "end": { "line": 4880, "column": 52, "offset": 128857 } + } + } + ], + "position": { + "start": { "line": 4879, "column": 3, "offset": 128732 }, + "end": { "line": 4880, "column": 52, "offset": 128857 } + } + } + ], + "position": { + "start": { "line": 4879, "column": 1, "offset": 128730 }, + "end": { "line": 4880, "column": 52, "offset": 128857 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "byteLength", + "position": { + "start": { "line": 4881, "column": 3, "offset": 128860 }, + "end": { "line": 4881, "column": 15, "offset": 128872 } + } + }, + { + "type": "text", + "value": " {integer} Number of bytes to write. Must satisfy\n", + "position": { + "start": { "line": 4881, "column": 15, "offset": 128872 }, + "end": { "line": 4882, "column": 1, "offset": 128922 } + } + }, + { + "type": "inlineCode", + "value": "0 < byteLength <= 6", + "position": { + "start": { "line": 4882, "column": 3, "offset": 128924 }, + "end": { "line": 4882, "column": 24, "offset": 128945 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 4882, "column": 24, "offset": 128945 }, + "end": { "line": 4882, "column": 25, "offset": 128946 } + } + } + ], + "position": { + "start": { "line": 4881, "column": 3, "offset": 128860 }, + "end": { "line": 4882, "column": 25, "offset": 128946 } + } + } + ], + "position": { + "start": { "line": 4881, "column": 1, "offset": 128858 }, + "end": { "line": 4882, "column": 25, "offset": 128946 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {integer} ", + "position": { + "start": { "line": 4883, "column": 3, "offset": 128949 }, + "end": { "line": 4883, "column": 22, "offset": 128968 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 4883, "column": 22, "offset": 128968 }, + "end": { "line": 4883, "column": 30, "offset": 128976 } + } + }, + { + "type": "text", + "value": " plus the number of bytes written.", + "position": { + "start": { "line": 4883, "column": 30, "offset": 128976 }, + "end": { "line": 4883, "column": 64, "offset": 129010 } + } + } + ], + "position": { + "start": { "line": 4883, "column": 3, "offset": 128949 }, + "end": { "line": 4883, "column": 64, "offset": 129010 } + } + } + ], + "position": { + "start": { "line": 4883, "column": 1, "offset": 128947 }, + "end": { "line": 4883, "column": 64, "offset": 129010 } + } + } + ], + "position": { + "start": { "line": 4878, "column": 1, "offset": 128679 }, + "end": { "line": 4883, "column": 64, "offset": 129010 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Writes ", + "position": { + "start": { "line": 4885, "column": 1, "offset": 129012 }, + "end": { "line": 4885, "column": 8, "offset": 129019 } + } + }, + { + "type": "inlineCode", + "value": "byteLength", + "position": { + "start": { "line": 4885, "column": 8, "offset": 129019 }, + "end": { "line": 4885, "column": 20, "offset": 129031 } + } + }, + { + "type": "text", + "value": " bytes of ", + "position": { + "start": { "line": 4885, "column": 20, "offset": 129031 }, + "end": { "line": 4885, "column": 30, "offset": 129041 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4885, "column": 30, "offset": 129041 }, + "end": { "line": 4885, "column": 37, "offset": 129048 } + } + }, + { + "type": "text", + "value": " to ", + "position": { + "start": { "line": 4885, "column": 37, "offset": 129048 }, + "end": { "line": 4885, "column": 41, "offset": 129052 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 4885, "column": 41, "offset": 129052 }, + "end": { "line": 4885, "column": 46, "offset": 129057 } + } + }, + { + "type": "text", + "value": " at the specified ", + "position": { + "start": { "line": 4885, "column": 46, "offset": 129057 }, + "end": { "line": 4885, "column": 64, "offset": 129075 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 4885, "column": 64, "offset": 129075 }, + "end": { "line": 4885, "column": 72, "offset": 129083 } + } + }, + { + "type": "text", + "value": "\nas big-endian. Supports up to 48 bits of accuracy. Behavior is undefined\nwhen ", + "position": { + "start": { "line": 4885, "column": 72, "offset": 129083 }, + "end": { "line": 4887, "column": 6, "offset": 129162 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4887, "column": 6, "offset": 129162 }, + "end": { "line": 4887, "column": 13, "offset": 129169 } + } + }, + { + "type": "text", + "value": " is anything other than an unsigned integer.", + "position": { + "start": { "line": 4887, "column": 13, "offset": 129169 }, + "end": { "line": 4887, "column": 57, "offset": 129213 } + } + } + ], + "position": { + "start": { "line": 4885, "column": 1, "offset": 129012 }, + "end": { "line": 4887, "column": 57, "offset": 129213 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "This function is also available under the ", + "position": { + "start": { "line": 4889, "column": 1, "offset": 129215 }, + "end": { "line": 4889, "column": 43, "offset": 129257 } + } + }, + { + "type": "inlineCode", + "value": "writeUintBE", + "position": { + "start": { "line": 4889, "column": 43, "offset": 129257 }, + "end": { "line": 4889, "column": 56, "offset": 129270 } + } + }, + { + "type": "text", + "value": " alias.", + "position": { + "start": { "line": 4889, "column": 56, "offset": 129270 }, + "end": { "line": 4889, "column": 63, "offset": 129277 } + } + } + ], + "position": { + "start": { "line": 4889, "column": 1, "offset": 129215 }, + "end": { "line": 4889, "column": 63, "offset": 129277 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.allocUnsafe(6);\n\nbuf.writeUIntBE(0x1234567890ab, 0, 6);\n\nconsole.log(buf);\n// Prints: ", + "position": { + "start": { "line": 4891, "column": 1, "offset": 129279 }, + "end": { "line": 4900, "column": 4, "offset": 129460 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.allocUnsafe(6);\n\nbuf.writeUIntBE(0x1234567890ab, 0, 6);\n\nconsole.log(buf);\n// Prints: ", + "position": { + "start": { "line": 4902, "column": 1, "offset": 129462 }, + "end": { "line": 4911, "column": 4, "offset": 129648 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buf.writeUIntLE(value, offset, byteLength)", + "position": { + "start": { "line": 4913, "column": 5, "offset": 129654 }, + "end": { "line": 4913, "column": 49, "offset": 129698 } + } + } + ], + "position": { + "start": { "line": 4913, "column": 1, "offset": 129650 }, + "end": { "line": 4913, "column": 49, "offset": 129698 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 4915, "column": 1, "offset": 129700 }, + "end": { "line": 4927, "column": 4, "offset": 130110 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4929, "column": 3, "offset": 130114 }, + "end": { "line": 4929, "column": 10, "offset": 130121 } + } + }, + { + "type": "text", + "value": " {integer} Number to be written to ", + "position": { + "start": { "line": 4929, "column": 10, "offset": 130121 }, + "end": { "line": 4929, "column": 45, "offset": 130156 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 4929, "column": 45, "offset": 130156 }, + "end": { "line": 4929, "column": 50, "offset": 130161 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 4929, "column": 50, "offset": 130161 }, + "end": { "line": 4929, "column": 51, "offset": 130162 } + } + } + ], + "position": { + "start": { "line": 4929, "column": 3, "offset": 130114 }, + "end": { "line": 4929, "column": 51, "offset": 130162 } + } + } + ], + "position": { + "start": { "line": 4929, "column": 1, "offset": 130112 }, + "end": { "line": 4929, "column": 51, "offset": 130162 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 4930, "column": 3, "offset": 130165 }, + "end": { "line": 4930, "column": 11, "offset": 130173 } + } + }, + { + "type": "text", + "value": " {integer} Number of bytes to skip before starting to write. Must\nsatisfy ", + "position": { + "start": { "line": 4930, "column": 11, "offset": 130173 }, + "end": { "line": 4931, "column": 11, "offset": 130249 } + } + }, + { + "type": "inlineCode", + "value": "0 <= offset <= buf.length - byteLength", + "position": { + "start": { "line": 4931, "column": 11, "offset": 130249 }, + "end": { "line": 4931, "column": 51, "offset": 130289 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 4931, "column": 51, "offset": 130289 }, + "end": { "line": 4931, "column": 52, "offset": 130290 } + } + } + ], + "position": { + "start": { "line": 4930, "column": 3, "offset": 130165 }, + "end": { "line": 4931, "column": 52, "offset": 130290 } + } + } + ], + "position": { + "start": { "line": 4930, "column": 1, "offset": 130163 }, + "end": { "line": 4931, "column": 52, "offset": 130290 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "byteLength", + "position": { + "start": { "line": 4932, "column": 3, "offset": 130293 }, + "end": { "line": 4932, "column": 15, "offset": 130305 } + } + }, + { + "type": "text", + "value": " {integer} Number of bytes to write. Must satisfy\n", + "position": { + "start": { "line": 4932, "column": 15, "offset": 130305 }, + "end": { "line": 4933, "column": 1, "offset": 130355 } + } + }, + { + "type": "inlineCode", + "value": "0 < byteLength <= 6", + "position": { + "start": { "line": 4933, "column": 3, "offset": 130357 }, + "end": { "line": 4933, "column": 24, "offset": 130378 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 4933, "column": 24, "offset": 130378 }, + "end": { "line": 4933, "column": 25, "offset": 130379 } + } + } + ], + "position": { + "start": { "line": 4932, "column": 3, "offset": 130293 }, + "end": { "line": 4933, "column": 25, "offset": 130379 } + } + } + ], + "position": { + "start": { "line": 4932, "column": 1, "offset": 130291 }, + "end": { "line": 4933, "column": 25, "offset": 130379 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {integer} ", + "position": { + "start": { "line": 4934, "column": 3, "offset": 130382 }, + "end": { "line": 4934, "column": 22, "offset": 130401 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 4934, "column": 22, "offset": 130401 }, + "end": { "line": 4934, "column": 30, "offset": 130409 } + } + }, + { + "type": "text", + "value": " plus the number of bytes written.", + "position": { + "start": { "line": 4934, "column": 30, "offset": 130409 }, + "end": { "line": 4934, "column": 64, "offset": 130443 } + } + } + ], + "position": { + "start": { "line": 4934, "column": 3, "offset": 130382 }, + "end": { "line": 4934, "column": 64, "offset": 130443 } + } + } + ], + "position": { + "start": { "line": 4934, "column": 1, "offset": 130380 }, + "end": { "line": 4934, "column": 64, "offset": 130443 } + } + } + ], + "position": { + "start": { "line": 4929, "column": 1, "offset": 130112 }, + "end": { "line": 4934, "column": 64, "offset": 130443 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Writes ", + "position": { + "start": { "line": 4936, "column": 1, "offset": 130445 }, + "end": { "line": 4936, "column": 8, "offset": 130452 } + } + }, + { + "type": "inlineCode", + "value": "byteLength", + "position": { + "start": { "line": 4936, "column": 8, "offset": 130452 }, + "end": { "line": 4936, "column": 20, "offset": 130464 } + } + }, + { + "type": "text", + "value": " bytes of ", + "position": { + "start": { "line": 4936, "column": 20, "offset": 130464 }, + "end": { "line": 4936, "column": 30, "offset": 130474 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4936, "column": 30, "offset": 130474 }, + "end": { "line": 4936, "column": 37, "offset": 130481 } + } + }, + { + "type": "text", + "value": " to ", + "position": { + "start": { "line": 4936, "column": 37, "offset": 130481 }, + "end": { "line": 4936, "column": 41, "offset": 130485 } + } + }, + { + "type": "inlineCode", + "value": "buf", + "position": { + "start": { "line": 4936, "column": 41, "offset": 130485 }, + "end": { "line": 4936, "column": 46, "offset": 130490 } + } + }, + { + "type": "text", + "value": " at the specified ", + "position": { + "start": { "line": 4936, "column": 46, "offset": 130490 }, + "end": { "line": 4936, "column": 64, "offset": 130508 } + } + }, + { + "type": "inlineCode", + "value": "offset", + "position": { + "start": { "line": 4936, "column": 64, "offset": 130508 }, + "end": { "line": 4936, "column": 72, "offset": 130516 } + } + }, + { + "type": "text", + "value": "\nas little-endian. Supports up to 48 bits of accuracy. Behavior is undefined\nwhen ", + "position": { + "start": { "line": 4936, "column": 72, "offset": 130516 }, + "end": { "line": 4938, "column": 6, "offset": 130598 } + } + }, + { + "type": "inlineCode", + "value": "value", + "position": { + "start": { "line": 4938, "column": 6, "offset": 130598 }, + "end": { "line": 4938, "column": 13, "offset": 130605 } + } + }, + { + "type": "text", + "value": " is anything other than an unsigned integer.", + "position": { + "start": { "line": 4938, "column": 13, "offset": 130605 }, + "end": { "line": 4938, "column": 57, "offset": 130649 } + } + } + ], + "position": { + "start": { "line": 4936, "column": 1, "offset": 130445 }, + "end": { "line": 4938, "column": 57, "offset": 130649 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "This function is also available under the ", + "position": { + "start": { "line": 4940, "column": 1, "offset": 130651 }, + "end": { "line": 4940, "column": 43, "offset": 130693 } + } + }, + { + "type": "inlineCode", + "value": "writeUintLE", + "position": { + "start": { "line": 4940, "column": 43, "offset": 130693 }, + "end": { "line": 4940, "column": 56, "offset": 130706 } + } + }, + { + "type": "text", + "value": " alias.", + "position": { + "start": { "line": 4940, "column": 56, "offset": 130706 }, + "end": { "line": 4940, "column": 63, "offset": 130713 } + } + } + ], + "position": { + "start": { "line": 4940, "column": 1, "offset": 130651 }, + "end": { "line": 4940, "column": 63, "offset": 130713 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.allocUnsafe(6);\n\nbuf.writeUIntLE(0x1234567890ab, 0, 6);\n\nconsole.log(buf);\n// Prints: ", + "position": { + "start": { "line": 4942, "column": 1, "offset": 130715 }, + "end": { "line": 4951, "column": 4, "offset": 130896 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.allocUnsafe(6);\n\nbuf.writeUIntLE(0x1234567890ab, 0, 6);\n\nconsole.log(buf);\n// Prints: ", + "position": { + "start": { "line": 4953, "column": 1, "offset": 130898 }, + "end": { "line": 4962, "column": 4, "offset": 131084 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "new Buffer(array)", + "position": { + "start": { "line": 4964, "column": 5, "offset": 131090 }, + "end": { "line": 4964, "column": 24, "offset": 131109 } + } + } + ], + "position": { + "start": { "line": 4964, "column": 1, "offset": 131086 }, + "end": { "line": 4964, "column": 24, "offset": 131109 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 4966, "column": 1, "offset": 131111 }, + "end": { "line": 4979, "column": 4, "offset": 131673 } + } + }, + { + "type": "blockquote", + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Stability: 0 - Deprecated: Use ", + "position": { + "start": { "line": 4981, "column": 3, "offset": 131677 }, + "end": { "line": 4981, "column": 34, "offset": 131708 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "Buffer.from(array)", + "position": { + "start": { "line": 4981, "column": 35, "offset": 131709 }, + "end": { "line": 4981, "column": 55, "offset": 131729 } + } + } + ], + "position": { + "start": { "line": 4981, "column": 34, "offset": 131708 }, + "end": { "line": 4981, "column": 58, "offset": 131732 } + }, + "label": "`Buffer.from(array)`", + "identifier": "`buffer.from(array)`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": " instead.", + "position": { + "start": { "line": 4981, "column": 58, "offset": 131732 }, + "end": { "line": 4981, "column": 67, "offset": 131741 } + } + } + ], + "position": { + "start": { "line": 4981, "column": 3, "offset": 131677 }, + "end": { "line": 4981, "column": 67, "offset": 131741 } + } + } + ], + "position": { + "start": { "line": 4981, "column": 1, "offset": 131675 }, + "end": { "line": 4981, "column": 67, "offset": 131741 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "array", + "position": { + "start": { "line": 4983, "column": 3, "offset": 131745 }, + "end": { "line": 4983, "column": 10, "offset": 131752 } + } + }, + { + "type": "text", + "value": " {integer[]} An array of bytes to copy from.", + "position": { + "start": { "line": 4983, "column": 10, "offset": 131752 }, + "end": { "line": 4983, "column": 55, "offset": 131797 } + } + } + ], + "position": { + "start": { "line": 4983, "column": 3, "offset": 131745 }, + "end": { "line": 4983, "column": 55, "offset": 131797 } + } + } + ], + "position": { + "start": { "line": 4983, "column": 1, "offset": 131743 }, + "end": { "line": 4983, "column": 55, "offset": 131797 } + } + } + ], + "position": { + "start": { "line": 4983, "column": 1, "offset": 131743 }, + "end": { "line": 4983, "column": 55, "offset": 131797 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "See ", + "position": { + "start": { "line": 4985, "column": 1, "offset": 131799 }, + "end": { "line": 4985, "column": 5, "offset": 131803 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "Buffer.from(array)", + "position": { + "start": { "line": 4985, "column": 6, "offset": 131804 }, + "end": { "line": 4985, "column": 26, "offset": 131824 } + } + } + ], + "position": { + "start": { "line": 4985, "column": 5, "offset": 131803 }, + "end": { "line": 4985, "column": 29, "offset": 131827 } + }, + "label": "`Buffer.from(array)`", + "identifier": "`buffer.from(array)`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 4985, "column": 29, "offset": 131827 }, + "end": { "line": 4985, "column": 30, "offset": 131828 } + } + } + ], + "position": { + "start": { "line": 4985, "column": 1, "offset": 131799 }, + "end": { "line": 4985, "column": 30, "offset": 131828 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "new Buffer(arrayBuffer[, byteOffset[, length]])", + "position": { + "start": { "line": 4987, "column": 5, "offset": 131834 }, + "end": { "line": 4987, "column": 54, "offset": 131883 } + } + } + ], + "position": { + "start": { "line": 4987, "column": 1, "offset": 131830 }, + "end": { "line": 4987, "column": 54, "offset": 131883 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 4989, "column": 1, "offset": 131885 }, + "end": { "line": 5006, "column": 4, "offset": 132611 } + } + }, + { + "type": "blockquote", + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Stability: 0 - Deprecated: Use\n", + "position": { + "start": { "line": 5008, "column": 3, "offset": 132615 }, + "end": { "line": 5009, "column": 1, "offset": 132646 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "Buffer.from(arrayBuffer[, byteOffset[, length]])", + "position": { + "start": { "line": 5009, "column": 4, "offset": 132649 }, + "end": { "line": 5009, "column": 54, "offset": 132699 } + } + } + ], + "position": { + "start": { "line": 5009, "column": 3, "offset": 132648 }, + "end": { "line": 5009, "column": 80, "offset": 132725 } + }, + "label": "`Buffer.from(arrayBuf)`", + "identifier": "`buffer.from(arraybuf)`", + "referenceType": "full" + }, + { + "type": "text", + "value": "\ninstead.", + "position": { + "start": { "line": 5009, "column": 80, "offset": 132725 }, + "end": { "line": 5010, "column": 11, "offset": 132736 } + } + } + ], + "position": { + "start": { "line": 5008, "column": 3, "offset": 132615 }, + "end": { "line": 5010, "column": 11, "offset": 132736 } + } + } + ], + "position": { + "start": { "line": 5008, "column": 1, "offset": 132613 }, + "end": { "line": 5010, "column": 11, "offset": 132736 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "arrayBuffer", + "position": { + "start": { "line": 5012, "column": 3, "offset": 132740 }, + "end": { "line": 5012, "column": 16, "offset": 132753 } + } + }, + { + "type": "text", + "value": " {ArrayBuffer|SharedArrayBuffer} An {ArrayBuffer},\n{SharedArrayBuffer} or the ", + "position": { + "start": { "line": 5012, "column": 16, "offset": 132753 }, + "end": { "line": 5013, "column": 30, "offset": 132833 } + } + }, + { + "type": "inlineCode", + "value": ".buffer", + "position": { + "start": { "line": 5013, "column": 30, "offset": 132833 }, + "end": { "line": 5013, "column": 39, "offset": 132842 } + } + }, + { + "type": "text", + "value": " property of a {TypedArray}.", + "position": { + "start": { "line": 5013, "column": 39, "offset": 132842 }, + "end": { "line": 5013, "column": 67, "offset": 132870 } + } + } + ], + "position": { + "start": { "line": 5012, "column": 3, "offset": 132740 }, + "end": { "line": 5013, "column": 67, "offset": 132870 } + } + } + ], + "position": { + "start": { "line": 5012, "column": 1, "offset": 132738 }, + "end": { "line": 5013, "column": 67, "offset": 132870 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "byteOffset", + "position": { + "start": { "line": 5014, "column": 3, "offset": 132873 }, + "end": { "line": 5014, "column": 15, "offset": 132885 } + } + }, + { + "type": "text", + "value": " {integer} Index of first byte to expose. ", + "position": { + "start": { "line": 5014, "column": 15, "offset": 132885 }, + "end": { "line": 5014, "column": 57, "offset": 132927 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { + "line": 5014, + "column": 59, + "offset": 132929 + }, + "end": { "line": 5014, "column": 67, "offset": 132937 } + } + } + ], + "position": { + "start": { "line": 5014, "column": 57, "offset": 132927 }, + "end": { "line": 5014, "column": 69, "offset": 132939 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 5014, "column": 69, "offset": 132939 }, + "end": { "line": 5014, "column": 70, "offset": 132940 } + } + }, + { + "type": "inlineCode", + "value": "0", + "position": { + "start": { "line": 5014, "column": 70, "offset": 132940 }, + "end": { "line": 5014, "column": 73, "offset": 132943 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 5014, "column": 73, "offset": 132943 }, + "end": { "line": 5014, "column": 74, "offset": 132944 } + } + } + ], + "position": { + "start": { "line": 5014, "column": 3, "offset": 132873 }, + "end": { "line": 5014, "column": 74, "offset": 132944 } + } + } + ], + "position": { + "start": { "line": 5014, "column": 1, "offset": 132871 }, + "end": { "line": 5014, "column": 74, "offset": 132944 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "length", + "position": { + "start": { "line": 5015, "column": 3, "offset": 132947 }, + "end": { "line": 5015, "column": 11, "offset": 132955 } + } + }, + { + "type": "text", + "value": " {integer} Number of bytes to expose.\n", + "position": { + "start": { "line": 5015, "column": 11, "offset": 132955 }, + "end": { "line": 5016, "column": 1, "offset": 132993 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { + "line": 5016, + "column": 5, + "offset": 132997 + }, + "end": { "line": 5016, "column": 13, "offset": 133005 } + } + } + ], + "position": { + "start": { "line": 5016, "column": 3, "offset": 132995 }, + "end": { "line": 5016, "column": 15, "offset": 133007 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 5016, "column": 15, "offset": 133007 }, + "end": { "line": 5016, "column": 16, "offset": 133008 } + } + }, + { + "type": "inlineCode", + "value": "arrayBuffer.byteLength - byteOffset", + "position": { + "start": { "line": 5016, "column": 16, "offset": 133008 }, + "end": { "line": 5016, "column": 53, "offset": 133045 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 5016, "column": 53, "offset": 133045 }, + "end": { "line": 5016, "column": 54, "offset": 133046 } + } + } + ], + "position": { + "start": { "line": 5015, "column": 3, "offset": 132947 }, + "end": { "line": 5016, "column": 54, "offset": 133046 } + } + } + ], + "position": { + "start": { "line": 5015, "column": 1, "offset": 132945 }, + "end": { "line": 5016, "column": 54, "offset": 133046 } + } + } + ], + "position": { + "start": { "line": 5012, "column": 1, "offset": 132738 }, + "end": { "line": 5016, "column": 54, "offset": 133046 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "See\n", + "position": { + "start": { "line": 5018, "column": 1, "offset": 133048 }, + "end": { "line": 5019, "column": 1, "offset": 133052 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "Buffer.from(arrayBuffer[, byteOffset[, length]])", + "position": { + "start": { "line": 5019, "column": 2, "offset": 133053 }, + "end": { "line": 5019, "column": 52, "offset": 133103 } + } + } + ], + "position": { + "start": { "line": 5019, "column": 1, "offset": 133052 }, + "end": { "line": 5019, "column": 78, "offset": 133129 } + }, + "label": "`Buffer.from(arrayBuf)`", + "identifier": "`buffer.from(arraybuf)`", + "referenceType": "full" + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 5019, "column": 78, "offset": 133129 }, + "end": { "line": 5019, "column": 79, "offset": 133130 } + } + } + ], + "position": { + "start": { "line": 5018, "column": 1, "offset": 133048 }, + "end": { "line": 5019, "column": 79, "offset": 133130 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "new Buffer(buffer)", + "position": { + "start": { "line": 5021, "column": 5, "offset": 133136 }, + "end": { "line": 5021, "column": 25, "offset": 133156 } + } + } + ], + "position": { + "start": { "line": 5021, "column": 1, "offset": 133132 }, + "end": { "line": 5021, "column": 25, "offset": 133156 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 5023, "column": 1, "offset": 133158 }, + "end": { "line": 5036, "column": 4, "offset": 133720 } + } + }, + { + "type": "blockquote", + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Stability: 0 - Deprecated: Use ", + "position": { + "start": { "line": 5038, "column": 3, "offset": 133724 }, + "end": { "line": 5038, "column": 34, "offset": 133755 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "Buffer.from(buffer)", + "position": { + "start": { "line": 5038, "column": 35, "offset": 133756 }, + "end": { "line": 5038, "column": 56, "offset": 133777 } + } + } + ], + "position": { + "start": { "line": 5038, "column": 34, "offset": 133755 }, + "end": { "line": 5038, "column": 59, "offset": 133780 } + }, + "label": "`Buffer.from(buffer)`", + "identifier": "`buffer.from(buffer)`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": " instead.", + "position": { + "start": { "line": 5038, "column": 59, "offset": 133780 }, + "end": { "line": 5038, "column": 68, "offset": 133789 } + } + } + ], + "position": { + "start": { "line": 5038, "column": 3, "offset": 133724 }, + "end": { "line": 5038, "column": 68, "offset": 133789 } + } + } + ], + "position": { + "start": { "line": 5038, "column": 1, "offset": 133722 }, + "end": { "line": 5038, "column": 68, "offset": 133789 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "buffer", + "position": { + "start": { "line": 5040, "column": 3, "offset": 133793 }, + "end": { "line": 5040, "column": 11, "offset": 133801 } + } + }, + { + "type": "text", + "value": " {Buffer|Uint8Array} An existing ", + "position": { + "start": { "line": 5040, "column": 11, "offset": 133801 }, + "end": { "line": 5040, "column": 44, "offset": 133834 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 5040, "column": 44, "offset": 133834 }, + "end": { "line": 5040, "column": 52, "offset": 133842 } + } + }, + { + "type": "text", + "value": " or {Uint8Array} from\nwhich to copy data.", + "position": { + "start": { "line": 5040, "column": 52, "offset": 133842 }, + "end": { "line": 5041, "column": 22, "offset": 133885 } + } + } + ], + "position": { + "start": { "line": 5040, "column": 3, "offset": 133793 }, + "end": { "line": 5041, "column": 22, "offset": 133885 } + } + } + ], + "position": { + "start": { "line": 5040, "column": 1, "offset": 133791 }, + "end": { "line": 5041, "column": 22, "offset": 133885 } + } + } + ], + "position": { + "start": { "line": 5040, "column": 1, "offset": 133791 }, + "end": { "line": 5041, "column": 22, "offset": 133885 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "See ", + "position": { + "start": { "line": 5043, "column": 1, "offset": 133887 }, + "end": { "line": 5043, "column": 5, "offset": 133891 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "Buffer.from(buffer)", + "position": { + "start": { "line": 5043, "column": 6, "offset": 133892 }, + "end": { "line": 5043, "column": 27, "offset": 133913 } + } + } + ], + "position": { + "start": { "line": 5043, "column": 5, "offset": 133891 }, + "end": { "line": 5043, "column": 30, "offset": 133916 } + }, + "label": "`Buffer.from(buffer)`", + "identifier": "`buffer.from(buffer)`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 5043, "column": 30, "offset": 133916 }, + "end": { "line": 5043, "column": 31, "offset": 133917 } + } + } + ], + "position": { + "start": { "line": 5043, "column": 1, "offset": 133887 }, + "end": { "line": 5043, "column": 31, "offset": 133917 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "new Buffer(size)", + "position": { + "start": { "line": 5045, "column": 5, "offset": 133923 }, + "end": { "line": 5045, "column": 23, "offset": 133941 } + } + } + ], + "position": { + "start": { "line": 5045, "column": 1, "offset": 133919 }, + "end": { "line": 5045, "column": 23, "offset": 133941 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 5047, "column": 1, "offset": 133943 }, + "end": { "line": 5064, "column": 4, "offset": 134679 } + } + }, + { + "type": "blockquote", + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Stability: 0 - Deprecated: Use ", + "position": { + "start": { "line": 5066, "column": 3, "offset": 134683 }, + "end": { "line": 5066, "column": 34, "offset": 134714 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "Buffer.alloc()", + "position": { + "start": { "line": 5066, "column": 35, "offset": 134715 }, + "end": { "line": 5066, "column": 51, "offset": 134731 } + } + } + ], + "position": { + "start": { "line": 5066, "column": 34, "offset": 134714 }, + "end": { "line": 5066, "column": 54, "offset": 134734 } + }, + "label": "`Buffer.alloc()`", + "identifier": "`buffer.alloc()`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": " instead (also see\n", + "position": { + "start": { "line": 5066, "column": 54, "offset": 134734 }, + "end": { "line": 5067, "column": 1, "offset": 134753 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "Buffer.allocUnsafe()", + "position": { + "start": { "line": 5067, "column": 4, "offset": 134756 }, + "end": { "line": 5067, "column": 26, "offset": 134778 } + } + } + ], + "position": { + "start": { "line": 5067, "column": 3, "offset": 134755 }, + "end": { "line": 5067, "column": 29, "offset": 134781 } + }, + "label": "`Buffer.allocUnsafe()`", + "identifier": "`buffer.allocunsafe()`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": ").", + "position": { + "start": { "line": 5067, "column": 29, "offset": 134781 }, + "end": { "line": 5067, "column": 31, "offset": 134783 } + } + } + ], + "position": { + "start": { "line": 5066, "column": 3, "offset": 134683 }, + "end": { "line": 5067, "column": 31, "offset": 134783 } + } + } + ], + "position": { + "start": { "line": 5066, "column": 1, "offset": 134681 }, + "end": { "line": 5067, "column": 31, "offset": 134783 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "size", + "position": { + "start": { "line": 5069, "column": 3, "offset": 134787 }, + "end": { "line": 5069, "column": 9, "offset": 134793 } + } + }, + { + "type": "text", + "value": " {integer} The desired length of the new ", + "position": { + "start": { "line": 5069, "column": 9, "offset": 134793 }, + "end": { "line": 5069, "column": 50, "offset": 134834 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 5069, "column": 50, "offset": 134834 }, + "end": { "line": 5069, "column": 58, "offset": 134842 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 5069, "column": 58, "offset": 134842 }, + "end": { "line": 5069, "column": 59, "offset": 134843 } + } + } + ], + "position": { + "start": { "line": 5069, "column": 3, "offset": 134787 }, + "end": { "line": 5069, "column": 59, "offset": 134843 } + } + } + ], + "position": { + "start": { "line": 5069, "column": 1, "offset": 134785 }, + "end": { "line": 5069, "column": 59, "offset": 134843 } + } + } + ], + "position": { + "start": { "line": 5069, "column": 1, "offset": 134785 }, + "end": { "line": 5069, "column": 59, "offset": 134843 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "See ", + "position": { + "start": { "line": 5071, "column": 1, "offset": 134845 }, + "end": { "line": 5071, "column": 5, "offset": 134849 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "Buffer.alloc()", + "position": { + "start": { "line": 5071, "column": 6, "offset": 134850 }, + "end": { "line": 5071, "column": 22, "offset": 134866 } + } + } + ], + "position": { + "start": { "line": 5071, "column": 5, "offset": 134849 }, + "end": { "line": 5071, "column": 25, "offset": 134869 } + }, + "label": "`Buffer.alloc()`", + "identifier": "`buffer.alloc()`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": " and ", + "position": { + "start": { "line": 5071, "column": 25, "offset": 134869 }, + "end": { "line": 5071, "column": 30, "offset": 134874 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "Buffer.allocUnsafe()", + "position": { + "start": { "line": 5071, "column": 31, "offset": 134875 }, + "end": { "line": 5071, "column": 53, "offset": 134897 } + } + } + ], + "position": { + "start": { "line": 5071, "column": 30, "offset": 134874 }, + "end": { "line": 5071, "column": 56, "offset": 134900 } + }, + "label": "`Buffer.allocUnsafe()`", + "identifier": "`buffer.allocunsafe()`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": ". This variant of the\nconstructor is equivalent to ", + "position": { + "start": { "line": 5071, "column": 56, "offset": 134900 }, + "end": { "line": 5072, "column": 30, "offset": 134951 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "Buffer.alloc()", + "position": { + "start": { "line": 5072, "column": 31, "offset": 134952 }, + "end": { "line": 5072, "column": 47, "offset": 134968 } + } + } + ], + "position": { + "start": { "line": 5072, "column": 30, "offset": 134951 }, + "end": { "line": 5072, "column": 50, "offset": 134971 } + }, + "label": "`Buffer.alloc()`", + "identifier": "`buffer.alloc()`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 5072, "column": 50, "offset": 134971 }, + "end": { "line": 5072, "column": 51, "offset": 134972 } + } + } + ], + "position": { + "start": { "line": 5071, "column": 1, "offset": 134845 }, + "end": { "line": 5072, "column": 51, "offset": 134972 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "new Buffer(string[, encoding])", + "position": { + "start": { "line": 5074, "column": 5, "offset": 134978 }, + "end": { "line": 5074, "column": 37, "offset": 135010 } + } + } + ], + "position": { + "start": { "line": 5074, "column": 1, "offset": 134974 }, + "end": { "line": 5074, "column": 37, "offset": 135010 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 5076, "column": 1, "offset": 135012 }, + "end": { "line": 5089, "column": 4, "offset": 135574 } + } + }, + { + "type": "blockquote", + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Stability: 0 - Deprecated:\nUse ", + "position": { + "start": { "line": 5091, "column": 3, "offset": 135578 }, + "end": { "line": 5092, "column": 7, "offset": 135611 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "Buffer.from(string[, encoding])", + "position": { + "start": { "line": 5092, "column": 8, "offset": 135612 }, + "end": { "line": 5092, "column": 41, "offset": 135645 } + } + } + ], + "position": { + "start": { "line": 5092, "column": 7, "offset": 135611 }, + "end": { "line": 5092, "column": 65, "offset": 135669 } + }, + "label": "`Buffer.from(string)`", + "identifier": "`buffer.from(string)`", + "referenceType": "full" + }, + { + "type": "text", + "value": " instead.", + "position": { + "start": { "line": 5092, "column": 65, "offset": 135669 }, + "end": { "line": 5092, "column": 74, "offset": 135678 } + } + } + ], + "position": { + "start": { "line": 5091, "column": 3, "offset": 135578 }, + "end": { "line": 5092, "column": 74, "offset": 135678 } + } + } + ], + "position": { + "start": { "line": 5091, "column": 1, "offset": 135576 }, + "end": { "line": 5092, "column": 74, "offset": 135678 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "string", + "position": { + "start": { "line": 5094, "column": 3, "offset": 135682 }, + "end": { "line": 5094, "column": 11, "offset": 135690 } + } + }, + { + "type": "text", + "value": " {string} String to encode.", + "position": { + "start": { "line": 5094, "column": 11, "offset": 135690 }, + "end": { "line": 5094, "column": 38, "offset": 135717 } + } + } + ], + "position": { + "start": { "line": 5094, "column": 3, "offset": 135682 }, + "end": { "line": 5094, "column": 38, "offset": 135717 } + } + } + ], + "position": { + "start": { "line": 5094, "column": 1, "offset": 135680 }, + "end": { "line": 5094, "column": 38, "offset": 135717 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "encoding", + "position": { + "start": { "line": 5095, "column": 3, "offset": 135720 }, + "end": { "line": 5095, "column": 13, "offset": 135730 } + } + }, + { + "type": "text", + "value": " {string} The encoding of ", + "position": { + "start": { "line": 5095, "column": 13, "offset": 135730 }, + "end": { "line": 5095, "column": 39, "offset": 135756 } + } + }, + { + "type": "inlineCode", + "value": "string", + "position": { + "start": { "line": 5095, "column": 39, "offset": 135756 }, + "end": { "line": 5095, "column": 47, "offset": 135764 } + } + }, + { + "type": "text", + "value": ". ", + "position": { + "start": { "line": 5095, "column": 47, "offset": 135764 }, + "end": { "line": 5095, "column": 49, "offset": 135766 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { + "line": 5095, + "column": 51, + "offset": 135768 + }, + "end": { "line": 5095, "column": 59, "offset": 135776 } + } + } + ], + "position": { + "start": { "line": 5095, "column": 49, "offset": 135766 }, + "end": { "line": 5095, "column": 61, "offset": 135778 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 5095, "column": 61, "offset": 135778 }, + "end": { "line": 5095, "column": 62, "offset": 135779 } + } + }, + { + "type": "inlineCode", + "value": "'utf8'", + "position": { + "start": { "line": 5095, "column": 62, "offset": 135779 }, + "end": { "line": 5095, "column": 70, "offset": 135787 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 5095, "column": 70, "offset": 135787 }, + "end": { "line": 5095, "column": 71, "offset": 135788 } + } + } + ], + "position": { + "start": { "line": 5095, "column": 3, "offset": 135720 }, + "end": { "line": 5095, "column": 71, "offset": 135788 } + } + } + ], + "position": { + "start": { "line": 5095, "column": 1, "offset": 135718 }, + "end": { "line": 5095, "column": 71, "offset": 135788 } + } + } + ], + "position": { + "start": { "line": 5094, "column": 1, "offset": 135680 }, + "end": { "line": 5095, "column": 71, "offset": 135788 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "See ", + "position": { + "start": { "line": 5097, "column": 1, "offset": 135790 }, + "end": { "line": 5097, "column": 5, "offset": 135794 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "Buffer.from(string[, encoding])", + "position": { + "start": { "line": 5097, "column": 6, "offset": 135795 }, + "end": { "line": 5097, "column": 39, "offset": 135828 } + } + } + ], + "position": { + "start": { "line": 5097, "column": 5, "offset": 135794 }, + "end": { "line": 5097, "column": 63, "offset": 135852 } + }, + "label": "`Buffer.from(string)`", + "identifier": "`buffer.from(string)`", + "referenceType": "full" + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 5097, "column": 63, "offset": 135852 }, + "end": { "line": 5097, "column": 64, "offset": 135853 } + } + } + ], + "position": { + "start": { "line": 5097, "column": 1, "offset": 135790 }, + "end": { "line": 5097, "column": 64, "offset": 135853 } + } + }, + { + "type": "heading", + "depth": 2, + "children": [ + { + "type": "text", + "value": "Class: ", + "position": { + "start": { "line": 5099, "column": 4, "offset": 135858 }, + "end": { "line": 5099, "column": 11, "offset": 135865 } + } + }, + { + "type": "inlineCode", + "value": "File", + "position": { + "start": { "line": 5099, "column": 11, "offset": 135865 }, + "end": { "line": 5099, "column": 17, "offset": 135871 } + } + } + ], + "position": { + "start": { "line": 5099, "column": 1, "offset": 135855 }, + "end": { "line": 5099, "column": 17, "offset": 135871 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 5101, "column": 1, "offset": 135873 }, + "end": { "line": 5112, "column": 4, "offset": 136167 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Extends: {Blob}", + "position": { + "start": { "line": 5114, "column": 3, "offset": 136171 }, + "end": { "line": 5114, "column": 18, "offset": 136186 } + } + } + ], + "position": { + "start": { "line": 5114, "column": 3, "offset": 136171 }, + "end": { "line": 5114, "column": 18, "offset": 136186 } + } + } + ], + "position": { + "start": { "line": 5114, "column": 1, "offset": 136169 }, + "end": { "line": 5114, "column": 18, "offset": 136186 } + } + } + ], + "position": { + "start": { "line": 5114, "column": 1, "offset": 136169 }, + "end": { "line": 5114, "column": 18, "offset": 136186 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "A {File} provides information about files.", + "position": { + "start": { "line": 5116, "column": 1, "offset": 136188 }, + "end": { "line": 5116, "column": 43, "offset": 136230 } + } + } + ], + "position": { + "start": { "line": 5116, "column": 1, "offset": 136188 }, + "end": { "line": 5116, "column": 43, "offset": 136230 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "new buffer.File(sources, fileName[, options])", + "position": { + "start": { "line": 5118, "column": 5, "offset": 136236 }, + "end": { "line": 5118, "column": 52, "offset": 136283 } + } + } + ], + "position": { + "start": { "line": 5118, "column": 1, "offset": 136232 }, + "end": { "line": 5118, "column": 52, "offset": 136283 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 5120, "column": 1, "offset": 136285 }, + "end": { "line": 5124, "column": 4, "offset": 136330 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "sources", + "position": { + "start": { "line": 5126, "column": 3, "offset": 136334 }, + "end": { "line": 5126, "column": 12, "offset": 136343 } + } + }, + { + "type": "text", + "value": " {string[]|ArrayBuffer[]|TypedArray[]|DataView[]|Blob[]|File[]}\nAn array of string, {ArrayBuffer}, {TypedArray}, {DataView}, {File}, or {Blob}\nobjects, or any mix of such objects, that will be stored within the ", + "position": { + "start": { "line": 5126, "column": 12, "offset": 136343 }, + "end": { "line": 5128, "column": 71, "offset": 136564 } + } + }, + { + "type": "inlineCode", + "value": "File", + "position": { + "start": { "line": 5128, "column": 71, "offset": 136564 }, + "end": { "line": 5128, "column": 77, "offset": 136570 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 5128, "column": 77, "offset": 136570 }, + "end": { "line": 5128, "column": 78, "offset": 136571 } + } + } + ], + "position": { + "start": { "line": 5126, "column": 3, "offset": 136334 }, + "end": { "line": 5128, "column": 78, "offset": 136571 } + } + } + ], + "position": { + "start": { "line": 5126, "column": 1, "offset": 136332 }, + "end": { "line": 5128, "column": 78, "offset": 136571 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "fileName", + "position": { + "start": { "line": 5129, "column": 3, "offset": 136574 }, + "end": { "line": 5129, "column": 13, "offset": 136584 } + } + }, + { + "type": "text", + "value": " {string} The name of the file.", + "position": { + "start": { "line": 5129, "column": 13, "offset": 136584 }, + "end": { "line": 5129, "column": 44, "offset": 136615 } + } + } + ], + "position": { + "start": { "line": 5129, "column": 3, "offset": 136574 }, + "end": { "line": 5129, "column": 44, "offset": 136615 } + } + } + ], + "position": { + "start": { "line": 5129, "column": 1, "offset": 136572 }, + "end": { "line": 5129, "column": 44, "offset": 136615 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "options", + "position": { + "start": { "line": 5130, "column": 3, "offset": 136618 }, + "end": { "line": 5130, "column": 12, "offset": 136627 } + } + }, + { + "type": "text", + "value": " {Object}", + "position": { + "start": { "line": 5130, "column": 12, "offset": 136627 }, + "end": { "line": 5130, "column": 21, "offset": 136636 } + } + } + ], + "position": { + "start": { "line": 5130, "column": 3, "offset": 136618 }, + "end": { "line": 5130, "column": 21, "offset": 136636 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "endings", + "position": { + "start": { + "line": 5131, + "column": 5, + "offset": 136641 + }, + "end": { + "line": 5131, + "column": 14, + "offset": 136650 + } + } + }, + { + "type": "text", + "value": " {string} One of either ", + "position": { + "start": { + "line": 5131, + "column": 14, + "offset": 136650 + }, + "end": { + "line": 5131, + "column": 38, + "offset": 136674 + } + } + }, + { + "type": "inlineCode", + "value": "'transparent'", + "position": { + "start": { + "line": 5131, + "column": 38, + "offset": 136674 + }, + "end": { + "line": 5131, + "column": 53, + "offset": 136689 + } + } + }, + { + "type": "text", + "value": " or ", + "position": { + "start": { + "line": 5131, + "column": 53, + "offset": 136689 + }, + "end": { + "line": 5131, + "column": 57, + "offset": 136693 + } + } + }, + { + "type": "inlineCode", + "value": "'native'", + "position": { + "start": { + "line": 5131, + "column": 57, + "offset": 136693 + }, + "end": { + "line": 5131, + "column": 67, + "offset": 136703 + } + } + }, + { + "type": "text", + "value": ". When set\nto ", + "position": { + "start": { + "line": 5131, + "column": 67, + "offset": 136703 + }, + "end": { + "line": 5132, + "column": 8, + "offset": 136721 + } + } + }, + { + "type": "inlineCode", + "value": "'native'", + "position": { + "start": { + "line": 5132, + "column": 8, + "offset": 136721 + }, + "end": { + "line": 5132, + "column": 18, + "offset": 136731 + } + } + }, + { + "type": "text", + "value": ", line endings in string source parts will be converted to\nthe platform native line-ending as specified by ", + "position": { + "start": { + "line": 5132, + "column": 18, + "offset": 136731 + }, + "end": { + "line": 5133, + "column": 53, + "offset": 136842 + } + } + }, + { + "type": "inlineCode", + "value": "require('node:os').EOL", + "position": { + "start": { + "line": 5133, + "column": 53, + "offset": 136842 + }, + "end": { + "line": 5133, + "column": 77, + "offset": 136866 + } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { + "line": 5133, + "column": 77, + "offset": 136866 + }, + "end": { + "line": 5133, + "column": 78, + "offset": 136867 + } + } + } + ], + "position": { + "start": { + "line": 5131, + "column": 5, + "offset": 136641 + }, + "end": { "line": 5133, "column": 78, "offset": 136867 } + } + } + ], + "position": { + "start": { "line": 5131, "column": 3, "offset": 136639 }, + "end": { "line": 5133, "column": 78, "offset": 136867 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "type", + "position": { + "start": { + "line": 5134, + "column": 5, + "offset": 136872 + }, + "end": { + "line": 5134, + "column": 11, + "offset": 136878 + } + } + }, + { + "type": "text", + "value": " {string} The File content-type.", + "position": { + "start": { + "line": 5134, + "column": 11, + "offset": 136878 + }, + "end": { + "line": 5134, + "column": 43, + "offset": 136910 + } + } + } + ], + "position": { + "start": { + "line": 5134, + "column": 5, + "offset": 136872 + }, + "end": { "line": 5134, "column": 43, "offset": 136910 } + } + } + ], + "position": { + "start": { "line": 5134, "column": 3, "offset": 136870 }, + "end": { "line": 5134, "column": 43, "offset": 136910 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "lastModified", + "position": { + "start": { + "line": 5135, + "column": 5, + "offset": 136915 + }, + "end": { + "line": 5135, + "column": 19, + "offset": 136929 + } + } + }, + { + "type": "text", + "value": " {number} The last modified date of the file.\n", + "position": { + "start": { + "line": 5135, + "column": 19, + "offset": 136929 + }, + "end": { + "line": 5136, + "column": 1, + "offset": 136975 + } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { + "line": 5136, + "column": 7, + "offset": 136981 + }, + "end": { + "line": 5136, + "column": 15, + "offset": 136989 + } + } + } + ], + "position": { + "start": { + "line": 5136, + "column": 5, + "offset": 136979 + }, + "end": { + "line": 5136, + "column": 17, + "offset": 136991 + } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { + "line": 5136, + "column": 17, + "offset": 136991 + }, + "end": { + "line": 5136, + "column": 18, + "offset": 136992 + } + } + }, + { + "type": "inlineCode", + "value": "Date.now()", + "position": { + "start": { + "line": 5136, + "column": 18, + "offset": 136992 + }, + "end": { + "line": 5136, + "column": 30, + "offset": 137004 + } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { + "line": 5136, + "column": 30, + "offset": 137004 + }, + "end": { + "line": 5136, + "column": 31, + "offset": 137005 + } + } + } + ], + "position": { + "start": { + "line": 5135, + "column": 5, + "offset": 136915 + }, + "end": { "line": 5136, "column": 31, "offset": 137005 } + } + } + ], + "position": { + "start": { "line": 5135, "column": 3, "offset": 136913 }, + "end": { "line": 5136, "column": 31, "offset": 137005 } + } + } + ], + "position": { + "start": { "line": 5131, "column": 3, "offset": 136639 }, + "end": { "line": 5136, "column": 31, "offset": 137005 } + } + } + ], + "position": { + "start": { "line": 5130, "column": 1, "offset": 136616 }, + "end": { "line": 5136, "column": 31, "offset": 137005 } + } + } + ], + "position": { + "start": { "line": 5126, "column": 1, "offset": 136332 }, + "end": { "line": 5136, "column": 31, "offset": 137005 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "file.name", + "position": { + "start": { "line": 5138, "column": 5, "offset": 137011 }, + "end": { "line": 5138, "column": 16, "offset": 137022 } + } + } + ], + "position": { + "start": { "line": 5138, "column": 1, "offset": 137007 }, + "end": { "line": 5138, "column": 16, "offset": 137022 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 5140, "column": 1, "offset": 137024 }, + "end": { "line": 5144, "column": 4, "offset": 137069 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Type: {string}", + "position": { + "start": { "line": 5146, "column": 3, "offset": 137073 }, + "end": { "line": 5146, "column": 17, "offset": 137087 } + } + } + ], + "position": { + "start": { "line": 5146, "column": 3, "offset": 137073 }, + "end": { "line": 5146, "column": 17, "offset": 137087 } + } + } + ], + "position": { + "start": { "line": 5146, "column": 1, "offset": 137071 }, + "end": { "line": 5146, "column": 17, "offset": 137087 } + } + } + ], + "position": { + "start": { "line": 5146, "column": 1, "offset": 137071 }, + "end": { "line": 5146, "column": 17, "offset": 137087 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "The name of the ", + "position": { + "start": { "line": 5148, "column": 1, "offset": 137089 }, + "end": { "line": 5148, "column": 17, "offset": 137105 } + } + }, + { + "type": "inlineCode", + "value": "File", + "position": { + "start": { "line": 5148, "column": 17, "offset": 137105 }, + "end": { "line": 5148, "column": 23, "offset": 137111 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 5148, "column": 23, "offset": 137111 }, + "end": { "line": 5148, "column": 24, "offset": 137112 } + } + } + ], + "position": { + "start": { "line": 5148, "column": 1, "offset": 137089 }, + "end": { "line": 5148, "column": 24, "offset": 137112 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "file.lastModified", + "position": { + "start": { "line": 5150, "column": 5, "offset": 137118 }, + "end": { "line": 5150, "column": 24, "offset": 137137 } + } + } + ], + "position": { + "start": { "line": 5150, "column": 1, "offset": 137114 }, + "end": { "line": 5150, "column": 24, "offset": 137137 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 5152, "column": 1, "offset": 137139 }, + "end": { "line": 5156, "column": 4, "offset": 137184 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Type: {number}", + "position": { + "start": { "line": 5158, "column": 3, "offset": 137188 }, + "end": { "line": 5158, "column": 17, "offset": 137202 } + } + } + ], + "position": { + "start": { "line": 5158, "column": 3, "offset": 137188 }, + "end": { "line": 5158, "column": 17, "offset": 137202 } + } + } + ], + "position": { + "start": { "line": 5158, "column": 1, "offset": 137186 }, + "end": { "line": 5158, "column": 17, "offset": 137202 } + } + } + ], + "position": { + "start": { "line": 5158, "column": 1, "offset": 137186 }, + "end": { "line": 5158, "column": 17, "offset": 137202 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "The last modified date of the ", + "position": { + "start": { "line": 5160, "column": 1, "offset": 137204 }, + "end": { "line": 5160, "column": 31, "offset": 137234 } + } + }, + { + "type": "inlineCode", + "value": "File", + "position": { + "start": { "line": 5160, "column": 31, "offset": 137234 }, + "end": { "line": 5160, "column": 37, "offset": 137240 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 5160, "column": 37, "offset": 137240 }, + "end": { "line": 5160, "column": 38, "offset": 137241 } + } + } + ], + "position": { + "start": { "line": 5160, "column": 1, "offset": 137204 }, + "end": { "line": 5160, "column": 38, "offset": 137241 } + } + }, + { + "type": "heading", + "depth": 2, + "children": [ + { + "type": "inlineCode", + "value": "node:buffer", + "position": { + "start": { "line": 5162, "column": 4, "offset": 137246 }, + "end": { "line": 5162, "column": 17, "offset": 137259 } + } + }, + { + "type": "text", + "value": " module APIs", + "position": { + "start": { "line": 5162, "column": 17, "offset": 137259 }, + "end": { "line": 5162, "column": 29, "offset": 137271 } + } + } + ], + "position": { + "start": { "line": 5162, "column": 1, "offset": 137243 }, + "end": { "line": 5162, "column": 29, "offset": 137271 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "While, the ", + "position": { + "start": { "line": 5164, "column": 1, "offset": 137273 }, + "end": { "line": 5164, "column": 12, "offset": 137284 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 5164, "column": 12, "offset": 137284 }, + "end": { "line": 5164, "column": 20, "offset": 137292 } + } + }, + { + "type": "text", + "value": " object is available as a global, there are additional\n", + "position": { + "start": { "line": 5164, "column": 20, "offset": 137292 }, + "end": { "line": 5165, "column": 1, "offset": 137347 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 5165, "column": 1, "offset": 137347 }, + "end": { "line": 5165, "column": 9, "offset": 137355 } + } + }, + { + "type": "text", + "value": "-related APIs that are available only via the ", + "position": { + "start": { "line": 5165, "column": 9, "offset": 137355 }, + "end": { "line": 5165, "column": 55, "offset": 137401 } + } + }, + { + "type": "inlineCode", + "value": "node:buffer", + "position": { + "start": { "line": 5165, "column": 55, "offset": 137401 }, + "end": { "line": 5165, "column": 68, "offset": 137414 } + } + }, + { + "type": "text", + "value": " module\naccessed using ", + "position": { + "start": { "line": 5165, "column": 68, "offset": 137414 }, + "end": { "line": 5166, "column": 16, "offset": 137437 } + } + }, + { + "type": "inlineCode", + "value": "require('node:buffer')", + "position": { + "start": { "line": 5166, "column": 16, "offset": 137437 }, + "end": { "line": 5166, "column": 40, "offset": 137461 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 5166, "column": 40, "offset": 137461 }, + "end": { "line": 5166, "column": 41, "offset": 137462 } + } + } + ], + "position": { + "start": { "line": 5164, "column": 1, "offset": 137273 }, + "end": { "line": 5166, "column": 41, "offset": 137462 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buffer.atob(data)", + "position": { + "start": { "line": 5168, "column": 5, "offset": 137468 }, + "end": { "line": 5168, "column": 24, "offset": 137487 } + } + } + ], + "position": { + "start": { "line": 5168, "column": 1, "offset": 137464 }, + "end": { "line": 5168, "column": 24, "offset": 137487 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 5170, "column": 1, "offset": 137489 }, + "end": { "line": 5174, "column": 4, "offset": 137535 } + } + }, + { + "type": "blockquote", + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Stability: 3 - Legacy. Use ", + "position": { + "start": { "line": 5176, "column": 3, "offset": 137539 }, + "end": { "line": 5176, "column": 30, "offset": 137566 } + } + }, + { + "type": "inlineCode", + "value": "Buffer.from(data, 'base64')", + "position": { + "start": { "line": 5176, "column": 30, "offset": 137566 }, + "end": { "line": 5176, "column": 59, "offset": 137595 } + } + }, + { + "type": "text", + "value": " instead.", + "position": { + "start": { "line": 5176, "column": 59, "offset": 137595 }, + "end": { "line": 5176, "column": 68, "offset": 137604 } + } + } + ], + "position": { + "start": { "line": 5176, "column": 3, "offset": 137539 }, + "end": { "line": 5176, "column": 68, "offset": 137604 } + } + } + ], + "position": { + "start": { "line": 5176, "column": 1, "offset": 137537 }, + "end": { "line": 5176, "column": 68, "offset": 137604 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "data", + "position": { + "start": { "line": 5178, "column": 3, "offset": 137608 }, + "end": { "line": 5178, "column": 9, "offset": 137614 } + } + }, + { + "type": "text", + "value": " {any} The Base64-encoded input string.", + "position": { + "start": { "line": 5178, "column": 9, "offset": 137614 }, + "end": { "line": 5178, "column": 48, "offset": 137653 } + } + } + ], + "position": { + "start": { "line": 5178, "column": 3, "offset": 137608 }, + "end": { "line": 5178, "column": 48, "offset": 137653 } + } + } + ], + "position": { + "start": { "line": 5178, "column": 1, "offset": 137606 }, + "end": { "line": 5178, "column": 48, "offset": 137653 } + } + } + ], + "position": { + "start": { "line": 5178, "column": 1, "offset": 137606 }, + "end": { "line": 5178, "column": 48, "offset": 137653 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Decodes a string of Base64-encoded data into bytes, and encodes those bytes\ninto a string using Latin-1 (ISO-8859-1).", + "position": { + "start": { "line": 5180, "column": 1, "offset": 137655 }, + "end": { "line": 5181, "column": 42, "offset": 137772 } + } + } + ], + "position": { + "start": { "line": 5180, "column": 1, "offset": 137655 }, + "end": { "line": 5181, "column": 42, "offset": 137772 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "The ", + "position": { + "start": { "line": 5183, "column": 1, "offset": 137774 }, + "end": { "line": 5183, "column": 5, "offset": 137778 } + } + }, + { + "type": "inlineCode", + "value": "data", + "position": { + "start": { "line": 5183, "column": 5, "offset": 137778 }, + "end": { "line": 5183, "column": 11, "offset": 137784 } + } + }, + { + "type": "text", + "value": " may be any JavaScript-value that can be coerced into a string.", + "position": { + "start": { "line": 5183, "column": 11, "offset": 137784 }, + "end": { "line": 5183, "column": 74, "offset": 137847 } + } + } + ], + "position": { + "start": { "line": 5183, "column": 1, "offset": 137774 }, + "end": { "line": 5183, "column": 74, "offset": 137847 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "This function is only provided for compatibility with legacy web platform APIs\nand should never be used in new code, because they use strings to represent\nbinary data and predate the introduction of typed arrays in JavaScript.\nFor code running using Node.js APIs, converting between base64-encoded strings\nand binary data should be performed using ", + "position": { + "start": { "line": 5185, "column": 3, "offset": 137851 }, + "end": { "line": 5189, "column": 43, "offset": 138199 } + } + }, + { + "type": "inlineCode", + "value": "Buffer.from(str, 'base64')", + "position": { + "start": { "line": 5189, "column": 43, "offset": 138199 }, + "end": { "line": 5189, "column": 71, "offset": 138227 } + } + }, + { + "type": "text", + "value": " and\n", + "position": { + "start": { "line": 5189, "column": 71, "offset": 138227 }, + "end": { "line": 5190, "column": 1, "offset": 138232 } + } + }, + { + "type": "inlineCode", + "value": "buf.toString('base64')", + "position": { + "start": { "line": 5190, "column": 1, "offset": 138232 }, + "end": { "line": 5190, "column": 25, "offset": 138256 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 5190, "column": 25, "offset": 138256 }, + "end": { "line": 5190, "column": 26, "offset": 138257 } + } + } + ], + "position": { + "start": { "line": 5185, "column": 1, "offset": 137849 }, + "end": { "line": 5190, "column": 28, "offset": 138259 } + } + } + ], + "position": { + "start": { "line": 5185, "column": 1, "offset": 137849 }, + "end": { "line": 5190, "column": 28, "offset": 138259 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buffer.btoa(data)", + "position": { + "start": { "line": 5192, "column": 5, "offset": 138265 }, + "end": { "line": 5192, "column": 24, "offset": 138284 } + } + } + ], + "position": { + "start": { "line": 5192, "column": 1, "offset": 138261 }, + "end": { "line": 5192, "column": 24, "offset": 138284 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 5194, "column": 1, "offset": 138286 }, + "end": { "line": 5198, "column": 4, "offset": 138332 } + } + }, + { + "type": "blockquote", + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Stability: 3 - Legacy. Use ", + "position": { + "start": { "line": 5200, "column": 3, "offset": 138336 }, + "end": { "line": 5200, "column": 30, "offset": 138363 } + } + }, + { + "type": "inlineCode", + "value": "buf.toString('base64')", + "position": { + "start": { "line": 5200, "column": 30, "offset": 138363 }, + "end": { "line": 5200, "column": 54, "offset": 138387 } + } + }, + { + "type": "text", + "value": " instead.", + "position": { + "start": { "line": 5200, "column": 54, "offset": 138387 }, + "end": { "line": 5200, "column": 63, "offset": 138396 } + } + } + ], + "position": { + "start": { "line": 5200, "column": 3, "offset": 138336 }, + "end": { "line": 5200, "column": 63, "offset": 138396 } + } + } + ], + "position": { + "start": { "line": 5200, "column": 1, "offset": 138334 }, + "end": { "line": 5200, "column": 63, "offset": 138396 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "data", + "position": { + "start": { "line": 5202, "column": 3, "offset": 138400 }, + "end": { "line": 5202, "column": 9, "offset": 138406 } + } + }, + { + "type": "text", + "value": " {any} An ASCII (Latin1) string.", + "position": { + "start": { "line": 5202, "column": 9, "offset": 138406 }, + "end": { "line": 5202, "column": 41, "offset": 138438 } + } + } + ], + "position": { + "start": { "line": 5202, "column": 3, "offset": 138400 }, + "end": { "line": 5202, "column": 41, "offset": 138438 } + } + } + ], + "position": { + "start": { "line": 5202, "column": 1, "offset": 138398 }, + "end": { "line": 5202, "column": 41, "offset": 138438 } + } + } + ], + "position": { + "start": { "line": 5202, "column": 1, "offset": 138398 }, + "end": { "line": 5202, "column": 41, "offset": 138438 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Decodes a string into bytes using Latin-1 (ISO-8859), and encodes those bytes\ninto a string using Base64.", + "position": { + "start": { "line": 5204, "column": 1, "offset": 138440 }, + "end": { "line": 5205, "column": 28, "offset": 138545 } + } + } + ], + "position": { + "start": { "line": 5204, "column": 1, "offset": 138440 }, + "end": { "line": 5205, "column": 28, "offset": 138545 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "The ", + "position": { + "start": { "line": 5207, "column": 1, "offset": 138547 }, + "end": { "line": 5207, "column": 5, "offset": 138551 } + } + }, + { + "type": "inlineCode", + "value": "data", + "position": { + "start": { "line": 5207, "column": 5, "offset": 138551 }, + "end": { "line": 5207, "column": 11, "offset": 138557 } + } + }, + { + "type": "text", + "value": " may be any JavaScript-value that can be coerced into a string.", + "position": { + "start": { "line": 5207, "column": 11, "offset": 138557 }, + "end": { "line": 5207, "column": 74, "offset": 138620 } + } + } + ], + "position": { + "start": { "line": 5207, "column": 1, "offset": 138547 }, + "end": { "line": 5207, "column": 74, "offset": 138620 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "This function is only provided for compatibility with legacy web platform APIs\nand should never be used in new code, because they use strings to represent\nbinary data and predate the introduction of typed arrays in JavaScript.\nFor code running using Node.js APIs, converting between base64-encoded strings\nand binary data should be performed using ", + "position": { + "start": { "line": 5209, "column": 3, "offset": 138624 }, + "end": { "line": 5213, "column": 43, "offset": 138972 } + } + }, + { + "type": "inlineCode", + "value": "Buffer.from(str, 'base64')", + "position": { + "start": { "line": 5213, "column": 43, "offset": 138972 }, + "end": { "line": 5213, "column": 71, "offset": 139000 } + } + }, + { + "type": "text", + "value": " and\n", + "position": { + "start": { "line": 5213, "column": 71, "offset": 139000 }, + "end": { "line": 5214, "column": 1, "offset": 139005 } + } + }, + { + "type": "inlineCode", + "value": "buf.toString('base64')", + "position": { + "start": { "line": 5214, "column": 1, "offset": 139005 }, + "end": { "line": 5214, "column": 25, "offset": 139029 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 5214, "column": 25, "offset": 139029 }, + "end": { "line": 5214, "column": 26, "offset": 139030 } + } + } + ], + "position": { + "start": { "line": 5209, "column": 1, "offset": 138622 }, + "end": { "line": 5214, "column": 28, "offset": 139032 } + } + } + ], + "position": { + "start": { "line": 5209, "column": 1, "offset": 138622 }, + "end": { "line": 5214, "column": 28, "offset": 139032 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buffer.isAscii(input)", + "position": { + "start": { "line": 5216, "column": 5, "offset": 139038 }, + "end": { "line": 5216, "column": 28, "offset": 139061 } + } + } + ], + "position": { + "start": { "line": 5216, "column": 1, "offset": 139034 }, + "end": { "line": 5216, "column": 28, "offset": 139061 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 5218, "column": 1, "offset": 139063 }, + "end": { "line": 5222, "column": 4, "offset": 139108 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "input {Buffer | ArrayBuffer | TypedArray} The input to validate.", + "position": { + "start": { "line": 5224, "column": 3, "offset": 139112 }, + "end": { "line": 5224, "column": 67, "offset": 139176 } + } + } + ], + "position": { + "start": { "line": 5224, "column": 3, "offset": 139112 }, + "end": { "line": 5224, "column": 67, "offset": 139176 } + } + } + ], + "position": { + "start": { "line": 5224, "column": 1, "offset": 139110 }, + "end": { "line": 5224, "column": 67, "offset": 139176 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {boolean}", + "position": { + "start": { "line": 5225, "column": 3, "offset": 139179 }, + "end": { "line": 5225, "column": 21, "offset": 139197 } + } + } + ], + "position": { + "start": { "line": 5225, "column": 3, "offset": 139179 }, + "end": { "line": 5225, "column": 21, "offset": 139197 } + } + } + ], + "position": { + "start": { "line": 5225, "column": 1, "offset": 139177 }, + "end": { "line": 5225, "column": 21, "offset": 139197 } + } + } + ], + "position": { + "start": { "line": 5224, "column": 1, "offset": 139110 }, + "end": { "line": 5225, "column": 21, "offset": 139197 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "This function returns ", + "position": { + "start": { "line": 5227, "column": 1, "offset": 139199 }, + "end": { "line": 5227, "column": 23, "offset": 139221 } + } + }, + { + "type": "inlineCode", + "value": "true", + "position": { + "start": { "line": 5227, "column": 23, "offset": 139221 }, + "end": { "line": 5227, "column": 29, "offset": 139227 } + } + }, + { + "type": "text", + "value": " if ", + "position": { + "start": { "line": 5227, "column": 29, "offset": 139227 }, + "end": { "line": 5227, "column": 33, "offset": 139231 } + } + }, + { + "type": "inlineCode", + "value": "input", + "position": { + "start": { "line": 5227, "column": 33, "offset": 139231 }, + "end": { "line": 5227, "column": 40, "offset": 139238 } + } + }, + { + "type": "text", + "value": " contains only valid ASCII-encoded data,\nincluding the case in which ", + "position": { + "start": { "line": 5227, "column": 40, "offset": 139238 }, + "end": { "line": 5228, "column": 29, "offset": 139307 } + } + }, + { + "type": "inlineCode", + "value": "input", + "position": { + "start": { "line": 5228, "column": 29, "offset": 139307 }, + "end": { "line": 5228, "column": 36, "offset": 139314 } + } + }, + { + "type": "text", + "value": " is empty.", + "position": { + "start": { "line": 5228, "column": 36, "offset": 139314 }, + "end": { "line": 5228, "column": 46, "offset": 139324 } + } + } + ], + "position": { + "start": { "line": 5227, "column": 1, "offset": 139199 }, + "end": { "line": 5228, "column": 46, "offset": 139324 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Throws if the ", + "position": { + "start": { "line": 5230, "column": 1, "offset": 139326 }, + "end": { "line": 5230, "column": 15, "offset": 139340 } + } + }, + { + "type": "inlineCode", + "value": "input", + "position": { + "start": { "line": 5230, "column": 15, "offset": 139340 }, + "end": { "line": 5230, "column": 22, "offset": 139347 } + } + }, + { + "type": "text", + "value": " is a detached array buffer.", + "position": { + "start": { "line": 5230, "column": 22, "offset": 139347 }, + "end": { "line": 5230, "column": 50, "offset": 139375 } + } + } + ], + "position": { + "start": { "line": 5230, "column": 1, "offset": 139326 }, + "end": { "line": 5230, "column": 50, "offset": 139375 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buffer.isUtf8(input)", + "position": { + "start": { "line": 5232, "column": 5, "offset": 139381 }, + "end": { "line": 5232, "column": 27, "offset": 139403 } + } + } + ], + "position": { + "start": { "line": 5232, "column": 1, "offset": 139377 }, + "end": { "line": 5232, "column": 27, "offset": 139403 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 5234, "column": 1, "offset": 139405 }, + "end": { "line": 5238, "column": 4, "offset": 139450 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "input {Buffer | ArrayBuffer | TypedArray} The input to validate.", + "position": { + "start": { "line": 5240, "column": 3, "offset": 139454 }, + "end": { "line": 5240, "column": 67, "offset": 139518 } + } + } + ], + "position": { + "start": { "line": 5240, "column": 3, "offset": 139454 }, + "end": { "line": 5240, "column": 67, "offset": 139518 } + } + } + ], + "position": { + "start": { "line": 5240, "column": 1, "offset": 139452 }, + "end": { "line": 5240, "column": 67, "offset": 139518 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {boolean}", + "position": { + "start": { "line": 5241, "column": 3, "offset": 139521 }, + "end": { "line": 5241, "column": 21, "offset": 139539 } + } + } + ], + "position": { + "start": { "line": 5241, "column": 3, "offset": 139521 }, + "end": { "line": 5241, "column": 21, "offset": 139539 } + } + } + ], + "position": { + "start": { "line": 5241, "column": 1, "offset": 139519 }, + "end": { "line": 5241, "column": 21, "offset": 139539 } + } + } + ], + "position": { + "start": { "line": 5240, "column": 1, "offset": 139452 }, + "end": { "line": 5241, "column": 21, "offset": 139539 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "This function returns ", + "position": { + "start": { "line": 5243, "column": 1, "offset": 139541 }, + "end": { "line": 5243, "column": 23, "offset": 139563 } + } + }, + { + "type": "inlineCode", + "value": "true", + "position": { + "start": { "line": 5243, "column": 23, "offset": 139563 }, + "end": { "line": 5243, "column": 29, "offset": 139569 } + } + }, + { + "type": "text", + "value": " if ", + "position": { + "start": { "line": 5243, "column": 29, "offset": 139569 }, + "end": { "line": 5243, "column": 33, "offset": 139573 } + } + }, + { + "type": "inlineCode", + "value": "input", + "position": { + "start": { "line": 5243, "column": 33, "offset": 139573 }, + "end": { "line": 5243, "column": 40, "offset": 139580 } + } + }, + { + "type": "text", + "value": " contains only valid UTF-8-encoded data,\nincluding the case in which ", + "position": { + "start": { "line": 5243, "column": 40, "offset": 139580 }, + "end": { "line": 5244, "column": 29, "offset": 139649 } + } + }, + { + "type": "inlineCode", + "value": "input", + "position": { + "start": { "line": 5244, "column": 29, "offset": 139649 }, + "end": { "line": 5244, "column": 36, "offset": 139656 } + } + }, + { + "type": "text", + "value": " is empty.", + "position": { + "start": { "line": 5244, "column": 36, "offset": 139656 }, + "end": { "line": 5244, "column": 46, "offset": 139666 } + } + } + ], + "position": { + "start": { "line": 5243, "column": 1, "offset": 139541 }, + "end": { "line": 5244, "column": 46, "offset": 139666 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Throws if the ", + "position": { + "start": { "line": 5246, "column": 1, "offset": 139668 }, + "end": { "line": 5246, "column": 15, "offset": 139682 } + } + }, + { + "type": "inlineCode", + "value": "input", + "position": { + "start": { "line": 5246, "column": 15, "offset": 139682 }, + "end": { "line": 5246, "column": 22, "offset": 139689 } + } + }, + { + "type": "text", + "value": " is a detached array buffer.", + "position": { + "start": { "line": 5246, "column": 22, "offset": 139689 }, + "end": { "line": 5246, "column": 50, "offset": 139717 } + } + } + ], + "position": { + "start": { "line": 5246, "column": 1, "offset": 139668 }, + "end": { "line": 5246, "column": 50, "offset": 139717 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buffer.INSPECT_MAX_BYTES", + "position": { + "start": { "line": 5248, "column": 5, "offset": 139723 }, + "end": { "line": 5248, "column": 31, "offset": 139749 } + } + } + ], + "position": { + "start": { "line": 5248, "column": 1, "offset": 139719 }, + "end": { "line": 5248, "column": 31, "offset": 139749 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 5250, "column": 1, "offset": 139751 }, + "end": { "line": 5252, "column": 4, "offset": 139778 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "{integer} ", + "position": { + "start": { "line": 5254, "column": 3, "offset": 139782 }, + "end": { "line": 5254, "column": 13, "offset": 139792 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Default:", + "position": { + "start": { + "line": 5254, + "column": 15, + "offset": 139794 + }, + "end": { "line": 5254, "column": 23, "offset": 139802 } + } + } + ], + "position": { + "start": { "line": 5254, "column": 13, "offset": 139792 }, + "end": { "line": 5254, "column": 25, "offset": 139804 } + } + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 5254, "column": 25, "offset": 139804 }, + "end": { "line": 5254, "column": 26, "offset": 139805 } + } + }, + { + "type": "inlineCode", + "value": "50", + "position": { + "start": { "line": 5254, "column": 26, "offset": 139805 }, + "end": { "line": 5254, "column": 30, "offset": 139809 } + } + } + ], + "position": { + "start": { "line": 5254, "column": 3, "offset": 139782 }, + "end": { "line": 5254, "column": 30, "offset": 139809 } + } + } + ], + "position": { + "start": { "line": 5254, "column": 1, "offset": 139780 }, + "end": { "line": 5254, "column": 30, "offset": 139809 } + } + } + ], + "position": { + "start": { "line": 5254, "column": 1, "offset": 139780 }, + "end": { "line": 5254, "column": 30, "offset": 139809 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns the maximum number of bytes that will be returned when\n", + "position": { + "start": { "line": 5256, "column": 1, "offset": 139811 }, + "end": { "line": 5257, "column": 1, "offset": 139874 } + } + }, + { + "type": "inlineCode", + "value": "buf.inspect()", + "position": { + "start": { "line": 5257, "column": 1, "offset": 139874 }, + "end": { "line": 5257, "column": 16, "offset": 139889 } + } + }, + { + "type": "text", + "value": " is called. This can be overridden by user modules. See\n", + "position": { + "start": { "line": 5257, "column": 16, "offset": 139889 }, + "end": { "line": 5258, "column": 1, "offset": 139945 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "util.inspect()", + "position": { + "start": { "line": 5258, "column": 2, "offset": 139946 }, + "end": { "line": 5258, "column": 18, "offset": 139962 } + } + } + ], + "position": { + "start": { "line": 5258, "column": 1, "offset": 139945 }, + "end": { "line": 5258, "column": 21, "offset": 139965 } + }, + "label": "`util.inspect()`", + "identifier": "`util.inspect()`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": " for more details on ", + "position": { + "start": { "line": 5258, "column": 21, "offset": 139965 }, + "end": { "line": 5258, "column": 42, "offset": 139986 } + } + }, + { + "type": "inlineCode", + "value": "buf.inspect()", + "position": { + "start": { "line": 5258, "column": 42, "offset": 139986 }, + "end": { "line": 5258, "column": 57, "offset": 140001 } + } + }, + { + "type": "text", + "value": " behavior.", + "position": { + "start": { "line": 5258, "column": 57, "offset": 140001 }, + "end": { "line": 5258, "column": 67, "offset": 140011 } + } + } + ], + "position": { + "start": { "line": 5256, "column": 1, "offset": 139811 }, + "end": { "line": 5258, "column": 67, "offset": 140011 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buffer.kMaxLength", + "position": { + "start": { "line": 5260, "column": 5, "offset": 140017 }, + "end": { "line": 5260, "column": 24, "offset": 140036 } + } + } + ], + "position": { + "start": { "line": 5260, "column": 1, "offset": 140013 }, + "end": { "line": 5260, "column": 24, "offset": 140036 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 5262, "column": 1, "offset": 140038 }, + "end": { "line": 5264, "column": 4, "offset": 140065 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "{integer} The largest size allowed for a single ", + "position": { + "start": { "line": 5266, "column": 3, "offset": 140069 }, + "end": { "line": 5266, "column": 51, "offset": 140117 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 5266, "column": 51, "offset": 140117 }, + "end": { "line": 5266, "column": 59, "offset": 140125 } + } + }, + { + "type": "text", + "value": " instance.", + "position": { + "start": { "line": 5266, "column": 59, "offset": 140125 }, + "end": { "line": 5266, "column": 69, "offset": 140135 } + } + } + ], + "position": { + "start": { "line": 5266, "column": 3, "offset": 140069 }, + "end": { "line": 5266, "column": 69, "offset": 140135 } + } + } + ], + "position": { + "start": { "line": 5266, "column": 1, "offset": 140067 }, + "end": { "line": 5266, "column": 69, "offset": 140135 } + } + } + ], + "position": { + "start": { "line": 5266, "column": 1, "offset": 140067 }, + "end": { "line": 5266, "column": 69, "offset": 140135 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "An alias for ", + "position": { + "start": { "line": 5268, "column": 1, "offset": 140137 }, + "end": { "line": 5268, "column": 14, "offset": 140150 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "buffer.constants.MAX_LENGTH", + "position": { + "start": { "line": 5268, "column": 15, "offset": 140151 }, + "end": { "line": 5268, "column": 44, "offset": 140180 } + } + } + ], + "position": { + "start": { "line": 5268, "column": 14, "offset": 140150 }, + "end": { "line": 5268, "column": 47, "offset": 140183 } + }, + "label": "`buffer.constants.MAX_LENGTH`", + "identifier": "`buffer.constants.max_length`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 5268, "column": 47, "offset": 140183 }, + "end": { "line": 5268, "column": 48, "offset": 140184 } + } + } + ], + "position": { + "start": { "line": 5268, "column": 1, "offset": 140137 }, + "end": { "line": 5268, "column": 48, "offset": 140184 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buffer.kStringMaxLength", + "position": { + "start": { "line": 5270, "column": 5, "offset": 140190 }, + "end": { "line": 5270, "column": 30, "offset": 140215 } + } + } + ], + "position": { + "start": { "line": 5270, "column": 1, "offset": 140186 }, + "end": { "line": 5270, "column": 30, "offset": 140215 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 5272, "column": 1, "offset": 140217 }, + "end": { "line": 5274, "column": 4, "offset": 140244 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "{integer} The largest length allowed for a single ", + "position": { + "start": { "line": 5276, "column": 3, "offset": 140248 }, + "end": { "line": 5276, "column": 53, "offset": 140298 } + } + }, + { + "type": "inlineCode", + "value": "string", + "position": { + "start": { "line": 5276, "column": 53, "offset": 140298 }, + "end": { "line": 5276, "column": 61, "offset": 140306 } + } + }, + { + "type": "text", + "value": " instance.", + "position": { + "start": { "line": 5276, "column": 61, "offset": 140306 }, + "end": { "line": 5276, "column": 71, "offset": 140316 } + } + } + ], + "position": { + "start": { "line": 5276, "column": 3, "offset": 140248 }, + "end": { "line": 5276, "column": 71, "offset": 140316 } + } + } + ], + "position": { + "start": { "line": 5276, "column": 1, "offset": 140246 }, + "end": { "line": 5276, "column": 71, "offset": 140316 } + } + } + ], + "position": { + "start": { "line": 5276, "column": 1, "offset": 140246 }, + "end": { "line": 5276, "column": 71, "offset": 140316 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "An alias for ", + "position": { + "start": { "line": 5278, "column": 1, "offset": 140318 }, + "end": { "line": 5278, "column": 14, "offset": 140331 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "buffer.constants.MAX_STRING_LENGTH", + "position": { + "start": { "line": 5278, "column": 15, "offset": 140332 }, + "end": { "line": 5278, "column": 51, "offset": 140368 } + } + } + ], + "position": { + "start": { "line": 5278, "column": 14, "offset": 140331 }, + "end": { "line": 5278, "column": 54, "offset": 140371 } + }, + "label": "`buffer.constants.MAX_STRING_LENGTH`", + "identifier": "`buffer.constants.max_string_length`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 5278, "column": 54, "offset": 140371 }, + "end": { "line": 5278, "column": 55, "offset": 140372 } + } + } + ], + "position": { + "start": { "line": 5278, "column": 1, "offset": 140318 }, + "end": { "line": 5278, "column": 55, "offset": 140372 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buffer.resolveObjectURL(id)", + "position": { + "start": { "line": 5280, "column": 5, "offset": 140378 }, + "end": { "line": 5280, "column": 34, "offset": 140407 } + } + } + ], + "position": { + "start": { "line": 5280, "column": 1, "offset": 140374 }, + "end": { "line": 5280, "column": 34, "offset": 140407 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 5282, "column": 1, "offset": 140409 }, + "end": { "line": 5288, "column": 4, "offset": 140559 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "id", + "position": { + "start": { "line": 5290, "column": 3, "offset": 140563 }, + "end": { "line": 5290, "column": 7, "offset": 140567 } + } + }, + { + "type": "text", + "value": " {string} A ", + "position": { + "start": { "line": 5290, "column": 7, "offset": 140567 }, + "end": { "line": 5290, "column": 19, "offset": 140579 } + } + }, + { + "type": "inlineCode", + "value": "'blob:nodedata:...", + "position": { + "start": { "line": 5290, "column": 19, "offset": 140579 }, + "end": { "line": 5290, "column": 39, "offset": 140599 } + } + }, + { + "type": "text", + "value": " URL string returned by a prior call to\n", + "position": { + "start": { "line": 5290, "column": 39, "offset": 140599 }, + "end": { "line": 5291, "column": 1, "offset": 140639 } + } + }, + { + "type": "inlineCode", + "value": "URL.createObjectURL()", + "position": { + "start": { "line": 5291, "column": 3, "offset": 140641 }, + "end": { "line": 5291, "column": 26, "offset": 140664 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 5291, "column": 26, "offset": 140664 }, + "end": { "line": 5291, "column": 27, "offset": 140665 } + } + } + ], + "position": { + "start": { "line": 5290, "column": 3, "offset": 140563 }, + "end": { "line": 5291, "column": 27, "offset": 140665 } + } + } + ], + "position": { + "start": { "line": 5290, "column": 1, "offset": 140561 }, + "end": { "line": 5291, "column": 27, "offset": 140665 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {Blob}", + "position": { + "start": { "line": 5292, "column": 3, "offset": 140668 }, + "end": { "line": 5292, "column": 18, "offset": 140683 } + } + } + ], + "position": { + "start": { "line": 5292, "column": 3, "offset": 140668 }, + "end": { "line": 5292, "column": 18, "offset": 140683 } + } + } + ], + "position": { + "start": { "line": 5292, "column": 1, "offset": 140666 }, + "end": { "line": 5292, "column": 18, "offset": 140683 } + } + } + ], + "position": { + "start": { "line": 5290, "column": 1, "offset": 140561 }, + "end": { "line": 5292, "column": 18, "offset": 140683 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Resolves a ", + "position": { + "start": { "line": 5294, "column": 1, "offset": 140685 }, + "end": { "line": 5294, "column": 12, "offset": 140696 } + } + }, + { + "type": "inlineCode", + "value": "'blob:nodedata:...'", + "position": { + "start": { "line": 5294, "column": 12, "offset": 140696 }, + "end": { "line": 5294, "column": 33, "offset": 140717 } + } + }, + { + "type": "text", + "value": " an associated {Blob} object registered using\na prior call to ", + "position": { + "start": { "line": 5294, "column": 33, "offset": 140717 }, + "end": { "line": 5295, "column": 17, "offset": 140779 } + } + }, + { + "type": "inlineCode", + "value": "URL.createObjectURL()", + "position": { + "start": { "line": 5295, "column": 17, "offset": 140779 }, + "end": { "line": 5295, "column": 40, "offset": 140802 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 5295, "column": 40, "offset": 140802 }, + "end": { "line": 5295, "column": 41, "offset": 140803 } + } + } + ], + "position": { + "start": { "line": 5294, "column": 1, "offset": 140685 }, + "end": { "line": 5295, "column": 41, "offset": 140803 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "inlineCode", + "value": "buffer.transcode(source, fromEnc, toEnc)", + "position": { + "start": { "line": 5297, "column": 5, "offset": 140809 }, + "end": { "line": 5297, "column": 47, "offset": 140851 } + } + } + ], + "position": { + "start": { "line": 5297, "column": 1, "offset": 140805 }, + "end": { "line": 5297, "column": 47, "offset": 140851 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 5299, "column": 1, "offset": 140853 }, + "end": { "line": 5305, "column": 4, "offset": 141030 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "source", + "position": { + "start": { "line": 5307, "column": 3, "offset": 141034 }, + "end": { "line": 5307, "column": 11, "offset": 141042 } + } + }, + { + "type": "text", + "value": " {Buffer|Uint8Array} A ", + "position": { + "start": { "line": 5307, "column": 11, "offset": 141042 }, + "end": { "line": 5307, "column": 34, "offset": 141065 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 5307, "column": 34, "offset": 141065 }, + "end": { "line": 5307, "column": 42, "offset": 141073 } + } + }, + { + "type": "text", + "value": " or ", + "position": { + "start": { "line": 5307, "column": 42, "offset": 141073 }, + "end": { "line": 5307, "column": 46, "offset": 141077 } + } + }, + { + "type": "inlineCode", + "value": "Uint8Array", + "position": { + "start": { "line": 5307, "column": 46, "offset": 141077 }, + "end": { "line": 5307, "column": 58, "offset": 141089 } + } + }, + { + "type": "text", + "value": " instance.", + "position": { + "start": { "line": 5307, "column": 58, "offset": 141089 }, + "end": { "line": 5307, "column": 68, "offset": 141099 } + } + } + ], + "position": { + "start": { "line": 5307, "column": 3, "offset": 141034 }, + "end": { "line": 5307, "column": 68, "offset": 141099 } + } + } + ], + "position": { + "start": { "line": 5307, "column": 1, "offset": 141032 }, + "end": { "line": 5307, "column": 68, "offset": 141099 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "fromEnc", + "position": { + "start": { "line": 5308, "column": 3, "offset": 141102 }, + "end": { "line": 5308, "column": 12, "offset": 141111 } + } + }, + { + "type": "text", + "value": " {string} The current encoding.", + "position": { + "start": { "line": 5308, "column": 12, "offset": 141111 }, + "end": { "line": 5308, "column": 43, "offset": 141142 } + } + } + ], + "position": { + "start": { "line": 5308, "column": 3, "offset": 141102 }, + "end": { "line": 5308, "column": 43, "offset": 141142 } + } + } + ], + "position": { + "start": { "line": 5308, "column": 1, "offset": 141100 }, + "end": { "line": 5308, "column": 43, "offset": 141142 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "toEnc", + "position": { + "start": { "line": 5309, "column": 3, "offset": 141145 }, + "end": { "line": 5309, "column": 10, "offset": 141152 } + } + }, + { + "type": "text", + "value": " {string} To target encoding.", + "position": { + "start": { "line": 5309, "column": 10, "offset": 141152 }, + "end": { "line": 5309, "column": 39, "offset": 141181 } + } + } + ], + "position": { + "start": { "line": 5309, "column": 3, "offset": 141145 }, + "end": { "line": 5309, "column": 39, "offset": 141181 } + } + } + ], + "position": { + "start": { "line": 5309, "column": 1, "offset": 141143 }, + "end": { "line": 5309, "column": 39, "offset": 141181 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns: {Buffer}", + "position": { + "start": { "line": 5310, "column": 3, "offset": 141184 }, + "end": { "line": 5310, "column": 20, "offset": 141201 } + } + } + ], + "position": { + "start": { "line": 5310, "column": 3, "offset": 141184 }, + "end": { "line": 5310, "column": 20, "offset": 141201 } + } + } + ], + "position": { + "start": { "line": 5310, "column": 1, "offset": 141182 }, + "end": { "line": 5310, "column": 20, "offset": 141201 } + } + } + ], + "position": { + "start": { "line": 5307, "column": 1, "offset": 141032 }, + "end": { "line": 5310, "column": 20, "offset": 141201 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Re-encodes the given ", + "position": { + "start": { "line": 5312, "column": 1, "offset": 141203 }, + "end": { "line": 5312, "column": 22, "offset": 141224 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 5312, "column": 22, "offset": 141224 }, + "end": { "line": 5312, "column": 30, "offset": 141232 } + } + }, + { + "type": "text", + "value": " or ", + "position": { + "start": { "line": 5312, "column": 30, "offset": 141232 }, + "end": { "line": 5312, "column": 34, "offset": 141236 } + } + }, + { + "type": "inlineCode", + "value": "Uint8Array", + "position": { + "start": { "line": 5312, "column": 34, "offset": 141236 }, + "end": { "line": 5312, "column": 46, "offset": 141248 } + } + }, + { + "type": "text", + "value": " instance from one character\nencoding to another. Returns a new ", + "position": { + "start": { "line": 5312, "column": 46, "offset": 141248 }, + "end": { "line": 5313, "column": 36, "offset": 141312 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 5313, "column": 36, "offset": 141312 }, + "end": { "line": 5313, "column": 44, "offset": 141320 } + } + }, + { + "type": "text", + "value": " instance.", + "position": { + "start": { "line": 5313, "column": 44, "offset": 141320 }, + "end": { "line": 5313, "column": 54, "offset": 141330 } + } + } + ], + "position": { + "start": { "line": 5312, "column": 1, "offset": 141203 }, + "end": { "line": 5313, "column": 54, "offset": 141330 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Throws if the ", + "position": { + "start": { "line": 5315, "column": 1, "offset": 141332 }, + "end": { "line": 5315, "column": 15, "offset": 141346 } + } + }, + { + "type": "inlineCode", + "value": "fromEnc", + "position": { + "start": { "line": 5315, "column": 15, "offset": 141346 }, + "end": { "line": 5315, "column": 24, "offset": 141355 } + } + }, + { + "type": "text", + "value": " or ", + "position": { + "start": { "line": 5315, "column": 24, "offset": 141355 }, + "end": { "line": 5315, "column": 28, "offset": 141359 } + } + }, + { + "type": "inlineCode", + "value": "toEnc", + "position": { + "start": { "line": 5315, "column": 28, "offset": 141359 }, + "end": { "line": 5315, "column": 35, "offset": 141366 } + } + }, + { + "type": "text", + "value": " specify invalid character encodings or if\nconversion from ", + "position": { + "start": { "line": 5315, "column": 35, "offset": 141366 }, + "end": { "line": 5316, "column": 17, "offset": 141425 } + } + }, + { + "type": "inlineCode", + "value": "fromEnc", + "position": { + "start": { "line": 5316, "column": 17, "offset": 141425 }, + "end": { "line": 5316, "column": 26, "offset": 141434 } + } + }, + { + "type": "text", + "value": " to ", + "position": { + "start": { "line": 5316, "column": 26, "offset": 141434 }, + "end": { "line": 5316, "column": 30, "offset": 141438 } + } + }, + { + "type": "inlineCode", + "value": "toEnc", + "position": { + "start": { "line": 5316, "column": 30, "offset": 141438 }, + "end": { "line": 5316, "column": 37, "offset": 141445 } + } + }, + { + "type": "text", + "value": " is not permitted.", + "position": { + "start": { "line": 5316, "column": 37, "offset": 141445 }, + "end": { "line": 5316, "column": 55, "offset": 141463 } + } + } + ], + "position": { + "start": { "line": 5315, "column": 1, "offset": 141332 }, + "end": { "line": 5316, "column": 55, "offset": 141463 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Encodings supported by ", + "position": { + "start": { "line": 5318, "column": 1, "offset": 141465 }, + "end": { "line": 5318, "column": 24, "offset": 141488 } + } + }, + { + "type": "inlineCode", + "value": "buffer.transcode()", + "position": { + "start": { "line": 5318, "column": 24, "offset": 141488 }, + "end": { "line": 5318, "column": 44, "offset": 141508 } + } + }, + { + "type": "text", + "value": " are: ", + "position": { + "start": { "line": 5318, "column": 44, "offset": 141508 }, + "end": { "line": 5318, "column": 50, "offset": 141514 } + } + }, + { + "type": "inlineCode", + "value": "'ascii'", + "position": { + "start": { "line": 5318, "column": 50, "offset": 141514 }, + "end": { "line": 5318, "column": 59, "offset": 141523 } + } + }, + { + "type": "text", + "value": ", ", + "position": { + "start": { "line": 5318, "column": 59, "offset": 141523 }, + "end": { "line": 5318, "column": 61, "offset": 141525 } + } + }, + { + "type": "inlineCode", + "value": "'utf8'", + "position": { + "start": { "line": 5318, "column": 61, "offset": 141525 }, + "end": { "line": 5318, "column": 69, "offset": 141533 } + } + }, + { + "type": "text", + "value": ",\n", + "position": { + "start": { "line": 5318, "column": 69, "offset": 141533 }, + "end": { "line": 5319, "column": 1, "offset": 141535 } + } + }, + { + "type": "inlineCode", + "value": "'utf16le'", + "position": { + "start": { "line": 5319, "column": 1, "offset": 141535 }, + "end": { "line": 5319, "column": 12, "offset": 141546 } + } + }, + { + "type": "text", + "value": ", ", + "position": { + "start": { "line": 5319, "column": 12, "offset": 141546 }, + "end": { "line": 5319, "column": 14, "offset": 141548 } + } + }, + { + "type": "inlineCode", + "value": "'ucs2'", + "position": { + "start": { "line": 5319, "column": 14, "offset": 141548 }, + "end": { "line": 5319, "column": 22, "offset": 141556 } + } + }, + { + "type": "text", + "value": ", ", + "position": { + "start": { "line": 5319, "column": 22, "offset": 141556 }, + "end": { "line": 5319, "column": 24, "offset": 141558 } + } + }, + { + "type": "inlineCode", + "value": "'latin1'", + "position": { + "start": { "line": 5319, "column": 24, "offset": 141558 }, + "end": { "line": 5319, "column": 34, "offset": 141568 } + } + }, + { + "type": "text", + "value": ", and ", + "position": { + "start": { "line": 5319, "column": 34, "offset": 141568 }, + "end": { "line": 5319, "column": 40, "offset": 141574 } + } + }, + { + "type": "inlineCode", + "value": "'binary'", + "position": { + "start": { "line": 5319, "column": 40, "offset": 141574 }, + "end": { "line": 5319, "column": 50, "offset": 141584 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 5319, "column": 50, "offset": 141584 }, + "end": { "line": 5319, "column": 51, "offset": 141585 } + } + } + ], + "position": { + "start": { "line": 5318, "column": 1, "offset": 141465 }, + "end": { "line": 5319, "column": 51, "offset": 141585 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "The transcoding process will use substitution characters if a given byte\nsequence cannot be adequately represented in the target encoding. For instance:", + "position": { + "start": { "line": 5321, "column": 1, "offset": 141587 }, + "end": { "line": 5322, "column": 80, "offset": 141739 } + } + } + ], + "position": { + "start": { "line": 5321, "column": 1, "offset": 141587 }, + "end": { "line": 5322, "column": 80, "offset": 141739 } + } + }, + { + "type": "code", + "lang": "mjs", + "meta": null, + "value": "import { Buffer, transcode } from 'node:buffer';\n\nconst newBuf = transcode(Buffer.from('€'), 'utf8', 'ascii');\nconsole.log(newBuf.toString('ascii'));\n// Prints: '?'", + "position": { + "start": { "line": 5324, "column": 1, "offset": 141741 }, + "end": { "line": 5330, "column": 4, "offset": 141916 } + } + }, + { + "type": "code", + "lang": "cjs", + "meta": null, + "value": "const { Buffer, transcode } = require('node:buffer');\n\nconst newBuf = transcode(Buffer.from('€'), 'utf8', 'ascii');\nconsole.log(newBuf.toString('ascii'));\n// Prints: '?'", + "position": { + "start": { "line": 5332, "column": 1, "offset": 141918 }, + "end": { "line": 5338, "column": 4, "offset": 142098 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Because the Euro (", + "position": { + "start": { "line": 5340, "column": 1, "offset": 142100 }, + "end": { "line": 5340, "column": 19, "offset": 142118 } + } + }, + { + "type": "inlineCode", + "value": "€", + "position": { + "start": { "line": 5340, "column": 19, "offset": 142118 }, + "end": { "line": 5340, "column": 22, "offset": 142121 } + } + }, + { + "type": "text", + "value": ") sign is not representable in US-ASCII, it is replaced\nwith ", + "position": { + "start": { "line": 5340, "column": 22, "offset": 142121 }, + "end": { "line": 5341, "column": 6, "offset": 142182 } + } + }, + { + "type": "inlineCode", + "value": "?", + "position": { + "start": { "line": 5341, "column": 6, "offset": 142182 }, + "end": { "line": 5341, "column": 9, "offset": 142185 } + } + }, + { + "type": "text", + "value": " in the transcoded ", + "position": { + "start": { "line": 5341, "column": 9, "offset": 142185 }, + "end": { "line": 5341, "column": 28, "offset": 142204 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 5341, "column": 28, "offset": 142204 }, + "end": { "line": 5341, "column": 36, "offset": 142212 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 5341, "column": 36, "offset": 142212 }, + "end": { "line": 5341, "column": 37, "offset": 142213 } + } + } + ], + "position": { + "start": { "line": 5340, "column": 1, "offset": 142100 }, + "end": { "line": 5341, "column": 37, "offset": 142213 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "text", + "value": "Buffer constants", + "position": { + "start": { "line": 5343, "column": 5, "offset": 142219 }, + "end": { "line": 5343, "column": 21, "offset": 142235 } + } + } + ], + "position": { + "start": { "line": 5343, "column": 1, "offset": 142215 }, + "end": { "line": 5343, "column": 21, "offset": 142235 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 5345, "column": 1, "offset": 142237 }, + "end": { "line": 5347, "column": 4, "offset": 142264 } + } + }, + { + "type": "heading", + "depth": 4, + "children": [ + { + "type": "inlineCode", + "value": "buffer.constants.MAX_LENGTH", + "position": { + "start": { "line": 5349, "column": 6, "offset": 142271 }, + "end": { "line": 5349, "column": 35, "offset": 142300 } + } + } + ], + "position": { + "start": { "line": 5349, "column": 1, "offset": 142266 }, + "end": { "line": 5349, "column": 35, "offset": 142300 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 5351, "column": 1, "offset": 142302 }, + "end": { "line": 5366, "column": 4, "offset": 142844 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "{integer} The largest size allowed for a single ", + "position": { + "start": { "line": 5368, "column": 3, "offset": 142848 }, + "end": { "line": 5368, "column": 51, "offset": 142896 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 5368, "column": 51, "offset": 142896 }, + "end": { "line": 5368, "column": 59, "offset": 142904 } + } + }, + { + "type": "text", + "value": " instance.", + "position": { + "start": { "line": 5368, "column": 59, "offset": 142904 }, + "end": { "line": 5368, "column": 69, "offset": 142914 } + } + } + ], + "position": { + "start": { "line": 5368, "column": 3, "offset": 142848 }, + "end": { "line": 5368, "column": 69, "offset": 142914 } + } + } + ], + "position": { + "start": { "line": 5368, "column": 1, "offset": 142846 }, + "end": { "line": 5368, "column": 69, "offset": 142914 } + } + } + ], + "position": { + "start": { "line": 5368, "column": 1, "offset": 142846 }, + "end": { "line": 5368, "column": 69, "offset": 142914 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "On 32-bit architectures, this value currently is 2", + "position": { + "start": { "line": 5370, "column": 1, "offset": 142916 }, + "end": { "line": 5370, "column": 51, "offset": 142966 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 5370, "column": 51, "offset": 142966 }, + "end": { "line": 5370, "column": 56, "offset": 142971 } + } + }, + { + "type": "text", + "value": "30", + "position": { + "start": { "line": 5370, "column": 56, "offset": 142971 }, + "end": { "line": 5370, "column": 58, "offset": 142973 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 5370, "column": 58, "offset": 142973 }, + "end": { "line": 5370, "column": 64, "offset": 142979 } + } + }, + { + "type": "text", + "value": " - 1 (about 1\nGiB).", + "position": { + "start": { "line": 5370, "column": 64, "offset": 142979 }, + "end": { "line": 5371, "column": 6, "offset": 142998 } + } + } + ], + "position": { + "start": { "line": 5370, "column": 1, "offset": 142916 }, + "end": { "line": 5371, "column": 6, "offset": 142998 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "On 64-bit architectures, this value currently is 2", + "position": { + "start": { "line": 5373, "column": 1, "offset": 143000 }, + "end": { "line": 5373, "column": 51, "offset": 143050 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 5373, "column": 51, "offset": 143050 }, + "end": { "line": 5373, "column": 56, "offset": 143055 } + } + }, + { + "type": "text", + "value": "53", + "position": { + "start": { "line": 5373, "column": 56, "offset": 143055 }, + "end": { "line": 5373, "column": 58, "offset": 143057 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 5373, "column": 58, "offset": 143057 }, + "end": { "line": 5373, "column": 64, "offset": 143063 } + } + }, + { + "type": "text", + "value": " - 1 (about 8 PiB).", + "position": { + "start": { "line": 5373, "column": 64, "offset": 143063 }, + "end": { "line": 5373, "column": 83, "offset": 143082 } + } + } + ], + "position": { + "start": { "line": 5373, "column": 1, "offset": 143000 }, + "end": { "line": 5373, "column": 83, "offset": 143082 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "It reflects ", + "position": { + "start": { "line": 5375, "column": 1, "offset": 143084 }, + "end": { "line": 5375, "column": 13, "offset": 143096 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "v8::TypedArray::kMaxLength", + "position": { + "start": { "line": 5375, "column": 14, "offset": 143097 }, + "end": { "line": 5375, "column": 42, "offset": 143125 } + } + } + ], + "position": { + "start": { "line": 5375, "column": 13, "offset": 143096 }, + "end": { "line": 5375, "column": 45, "offset": 143128 } + }, + "label": "`v8::TypedArray::kMaxLength`", + "identifier": "`v8::typedarray::kmaxlength`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": " under the hood.", + "position": { + "start": { "line": 5375, "column": 45, "offset": 143128 }, + "end": { "line": 5375, "column": 61, "offset": 143144 } + } + } + ], + "position": { + "start": { "line": 5375, "column": 1, "offset": 143084 }, + "end": { "line": 5375, "column": 61, "offset": 143144 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "This value is also available as ", + "position": { + "start": { "line": 5377, "column": 1, "offset": 143146 }, + "end": { "line": 5377, "column": 33, "offset": 143178 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "buffer.kMaxLength", + "position": { + "start": { "line": 5377, "column": 34, "offset": 143179 }, + "end": { "line": 5377, "column": 53, "offset": 143198 } + } + } + ], + "position": { + "start": { "line": 5377, "column": 33, "offset": 143178 }, + "end": { "line": 5377, "column": 56, "offset": 143201 } + }, + "label": "`buffer.kMaxLength`", + "identifier": "`buffer.kmaxlength`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 5377, "column": 56, "offset": 143201 }, + "end": { "line": 5377, "column": 57, "offset": 143202 } + } + } + ], + "position": { + "start": { "line": 5377, "column": 1, "offset": 143146 }, + "end": { "line": 5377, "column": 57, "offset": 143202 } + } + }, + { + "type": "heading", + "depth": 4, + "children": [ + { + "type": "inlineCode", + "value": "buffer.constants.MAX_STRING_LENGTH", + "position": { + "start": { "line": 5379, "column": 6, "offset": 143209 }, + "end": { "line": 5379, "column": 42, "offset": 143245 } + } + } + ], + "position": { + "start": { "line": 5379, "column": 1, "offset": 143204 }, + "end": { "line": 5379, "column": 42, "offset": 143245 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 5381, "column": 1, "offset": 143247 }, + "end": { "line": 5383, "column": 4, "offset": 143274 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "{integer} The largest length allowed for a single ", + "position": { + "start": { "line": 5385, "column": 3, "offset": 143278 }, + "end": { "line": 5385, "column": 53, "offset": 143328 } + } + }, + { + "type": "inlineCode", + "value": "string", + "position": { + "start": { "line": 5385, "column": 53, "offset": 143328 }, + "end": { "line": 5385, "column": 61, "offset": 143336 } + } + }, + { + "type": "text", + "value": " instance.", + "position": { + "start": { "line": 5385, "column": 61, "offset": 143336 }, + "end": { "line": 5385, "column": 71, "offset": 143346 } + } + } + ], + "position": { + "start": { "line": 5385, "column": 3, "offset": 143278 }, + "end": { "line": 5385, "column": 71, "offset": 143346 } + } + } + ], + "position": { + "start": { "line": 5385, "column": 1, "offset": 143276 }, + "end": { "line": 5385, "column": 71, "offset": 143346 } + } + } + ], + "position": { + "start": { "line": 5385, "column": 1, "offset": 143276 }, + "end": { "line": 5385, "column": 71, "offset": 143346 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Represents the largest ", + "position": { + "start": { "line": 5387, "column": 1, "offset": 143348 }, + "end": { "line": 5387, "column": 24, "offset": 143371 } + } + }, + { + "type": "inlineCode", + "value": "length", + "position": { + "start": { "line": 5387, "column": 24, "offset": 143371 }, + "end": { "line": 5387, "column": 32, "offset": 143379 } + } + }, + { + "type": "text", + "value": " that a ", + "position": { + "start": { "line": 5387, "column": 32, "offset": 143379 }, + "end": { "line": 5387, "column": 40, "offset": 143387 } + } + }, + { + "type": "inlineCode", + "value": "string", + "position": { + "start": { "line": 5387, "column": 40, "offset": 143387 }, + "end": { "line": 5387, "column": 48, "offset": 143395 } + } + }, + { + "type": "text", + "value": " primitive can have, counted\nin UTF-16 code units.", + "position": { + "start": { "line": 5387, "column": 48, "offset": 143395 }, + "end": { "line": 5388, "column": 22, "offset": 143445 } + } + } + ], + "position": { + "start": { "line": 5387, "column": 1, "offset": 143348 }, + "end": { "line": 5388, "column": 22, "offset": 143445 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "This value may depend on the JS engine that is being used.", + "position": { + "start": { "line": 5390, "column": 1, "offset": 143447 }, + "end": { "line": 5390, "column": 59, "offset": 143505 } + } + } + ], + "position": { + "start": { "line": 5390, "column": 1, "offset": 143447 }, + "end": { "line": 5390, "column": 59, "offset": 143505 } + } + }, + { + "type": "heading", + "depth": 2, + "children": [ + { + "type": "inlineCode", + "value": "Buffer.from()", + "position": { + "start": { "line": 5392, "column": 4, "offset": 143510 }, + "end": { "line": 5392, "column": 19, "offset": 143525 } + } + }, + { + "type": "text", + "value": ", ", + "position": { + "start": { "line": 5392, "column": 19, "offset": 143525 }, + "end": { "line": 5392, "column": 21, "offset": 143527 } + } + }, + { + "type": "inlineCode", + "value": "Buffer.alloc()", + "position": { + "start": { "line": 5392, "column": 21, "offset": 143527 }, + "end": { "line": 5392, "column": 37, "offset": 143543 } + } + }, + { + "type": "text", + "value": ", and ", + "position": { + "start": { "line": 5392, "column": 37, "offset": 143543 }, + "end": { "line": 5392, "column": 43, "offset": 143549 } + } + }, + { + "type": "inlineCode", + "value": "Buffer.allocUnsafe()", + "position": { + "start": { "line": 5392, "column": 43, "offset": 143549 }, + "end": { "line": 5392, "column": 65, "offset": 143571 } + } + } + ], + "position": { + "start": { "line": 5392, "column": 1, "offset": 143507 }, + "end": { "line": 5392, "column": 65, "offset": 143571 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "In versions of Node.js prior to 6.0.0, ", + "position": { + "start": { "line": 5394, "column": 1, "offset": 143573 }, + "end": { "line": 5394, "column": 40, "offset": 143612 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 5394, "column": 40, "offset": 143612 }, + "end": { "line": 5394, "column": 48, "offset": 143620 } + } + }, + { + "type": "text", + "value": " instances were created using the\n", + "position": { + "start": { "line": 5394, "column": 48, "offset": 143620 }, + "end": { "line": 5395, "column": 1, "offset": 143654 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 5395, "column": 1, "offset": 143654 }, + "end": { "line": 5395, "column": 9, "offset": 143662 } + } + }, + { + "type": "text", + "value": " constructor function, which allocates the returned ", + "position": { + "start": { "line": 5395, "column": 9, "offset": 143662 }, + "end": { "line": 5395, "column": 61, "offset": 143714 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 5395, "column": 61, "offset": 143714 }, + "end": { "line": 5395, "column": 69, "offset": 143722 } + } + }, + { + "type": "text", + "value": "\ndifferently based on what arguments are provided:", + "position": { + "start": { "line": 5395, "column": 69, "offset": 143722 }, + "end": { "line": 5396, "column": 50, "offset": 143772 } + } + } + ], + "position": { + "start": { "line": 5394, "column": 1, "offset": 143573 }, + "end": { "line": 5396, "column": 50, "offset": 143772 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Passing a number as the first argument to ", + "position": { + "start": { "line": 5398, "column": 3, "offset": 143776 }, + "end": { "line": 5398, "column": 45, "offset": 143818 } + } + }, + { + "type": "inlineCode", + "value": "Buffer()", + "position": { + "start": { "line": 5398, "column": 45, "offset": 143818 }, + "end": { "line": 5398, "column": 55, "offset": 143828 } + } + }, + { + "type": "text", + "value": " (e.g. ", + "position": { + "start": { "line": 5398, "column": 55, "offset": 143828 }, + "end": { "line": 5398, "column": 62, "offset": 143835 } + } + }, + { + "type": "inlineCode", + "value": "new Buffer(10)", + "position": { + "start": { "line": 5398, "column": 62, "offset": 143835 }, + "end": { "line": 5398, "column": 78, "offset": 143851 } + } + }, + { + "type": "text", + "value": ")\nallocates a new ", + "position": { + "start": { "line": 5398, "column": 78, "offset": 143851 }, + "end": { "line": 5399, "column": 19, "offset": 143871 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 5399, "column": 19, "offset": 143871 }, + "end": { "line": 5399, "column": 27, "offset": 143879 } + } + }, + { + "type": "text", + "value": " object of the specified size. Prior to Node.js 8.0.0,\nthe memory allocated for such ", + "position": { + "start": { "line": 5399, "column": 27, "offset": 143879 }, + "end": { "line": 5400, "column": 33, "offset": 143966 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 5400, "column": 33, "offset": 143966 }, + "end": { "line": 5400, "column": 41, "offset": 143974 } + } + }, + { + "type": "text", + "value": " instances is ", + "position": { + "start": { "line": 5400, "column": 41, "offset": 143974 }, + "end": { "line": 5400, "column": 55, "offset": 143988 } + } + }, + { + "type": "emphasis", + "children": [ + { + "type": "text", + "value": "not", + "position": { + "start": { + "line": 5400, + "column": 56, + "offset": 143989 + }, + "end": { "line": 5400, "column": 59, "offset": 143992 } + } + } + ], + "position": { + "start": { "line": 5400, "column": 55, "offset": 143988 }, + "end": { "line": 5400, "column": 60, "offset": 143993 } + } + }, + { + "type": "text", + "value": " initialized and\n", + "position": { + "start": { "line": 5400, "column": 60, "offset": 143993 }, + "end": { "line": 5401, "column": 1, "offset": 144010 } + } + }, + { + "type": "emphasis", + "children": [ + { + "type": "text", + "value": "can contain sensitive data", + "position": { + "start": { + "line": 5401, + "column": 4, + "offset": 144013 + }, + "end": { "line": 5401, "column": 30, "offset": 144039 } + } + } + ], + "position": { + "start": { "line": 5401, "column": 3, "offset": 144012 }, + "end": { "line": 5401, "column": 31, "offset": 144040 } + } + }, + { + "type": "text", + "value": ". Such ", + "position": { + "start": { "line": 5401, "column": 31, "offset": 144040 }, + "end": { "line": 5401, "column": 38, "offset": 144047 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 5401, "column": 38, "offset": 144047 }, + "end": { "line": 5401, "column": 46, "offset": 144055 } + } + }, + { + "type": "text", + "value": " instances ", + "position": { + "start": { "line": 5401, "column": 46, "offset": 144055 }, + "end": { "line": 5401, "column": 57, "offset": 144066 } + } + }, + { + "type": "emphasis", + "children": [ + { + "type": "text", + "value": "must", + "position": { + "start": { + "line": 5401, + "column": 58, + "offset": 144067 + }, + "end": { "line": 5401, "column": 62, "offset": 144071 } + } + } + ], + "position": { + "start": { "line": 5401, "column": 57, "offset": 144066 }, + "end": { "line": 5401, "column": 63, "offset": 144072 } + } + }, + { + "type": "text", + "value": " be subsequently\ninitialized by using either ", + "position": { + "start": { "line": 5401, "column": 63, "offset": 144072 }, + "end": { "line": 5402, "column": 31, "offset": 144119 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "buf.fill(0)", + "position": { + "start": { + "line": 5402, + "column": 32, + "offset": 144120 + }, + "end": { "line": 5402, "column": 45, "offset": 144133 } + } + } + ], + "position": { + "start": { "line": 5402, "column": 31, "offset": 144119 }, + "end": { "line": 5402, "column": 60, "offset": 144148 } + }, + "label": "`buf.fill()`", + "identifier": "`buf.fill()`", + "referenceType": "full" + }, + { + "type": "text", + "value": " or by writing to the\nentire ", + "position": { + "start": { "line": 5402, "column": 60, "offset": 144148 }, + "end": { "line": 5403, "column": 10, "offset": 144179 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 5403, "column": 10, "offset": 144179 }, + "end": { "line": 5403, "column": 18, "offset": 144187 } + } + }, + { + "type": "text", + "value": " before reading data from the ", + "position": { + "start": { "line": 5403, "column": 18, "offset": 144187 }, + "end": { "line": 5403, "column": 48, "offset": 144217 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 5403, "column": 48, "offset": 144217 }, + "end": { "line": 5403, "column": 56, "offset": 144225 } + } + }, + { + "type": "text", + "value": ".\nWhile this behavior is ", + "position": { + "start": { "line": 5403, "column": 56, "offset": 144225 }, + "end": { "line": 5404, "column": 26, "offset": 144252 } + } + }, + { + "type": "emphasis", + "children": [ + { + "type": "text", + "value": "intentional", + "position": { + "start": { + "line": 5404, + "column": 27, + "offset": 144253 + }, + "end": { "line": 5404, "column": 38, "offset": 144264 } + } + } + ], + "position": { + "start": { "line": 5404, "column": 26, "offset": 144252 }, + "end": { "line": 5404, "column": 39, "offset": 144265 } + } + }, + { + "type": "text", + "value": " to improve performance,\ndevelopment experience has demonstrated that a more explicit distinction is\nrequired between creating a fast-but-uninitialized ", + "position": { + "start": { "line": 5404, "column": 39, "offset": 144265 }, + "end": { "line": 5406, "column": 54, "offset": 144421 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 5406, "column": 54, "offset": 144421 }, + "end": { "line": 5406, "column": 62, "offset": 144429 } + } + }, + { + "type": "text", + "value": " versus creating a\nslower-but-safer ", + "position": { + "start": { "line": 5406, "column": 62, "offset": 144429 }, + "end": { "line": 5407, "column": 20, "offset": 144467 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 5407, "column": 20, "offset": 144467 }, + "end": { "line": 5407, "column": 28, "offset": 144475 } + } + }, + { + "type": "text", + "value": ". Since Node.js 8.0.0, ", + "position": { + "start": { "line": 5407, "column": 28, "offset": 144475 }, + "end": { "line": 5407, "column": 51, "offset": 144498 } + } + }, + { + "type": "inlineCode", + "value": "Buffer(num)", + "position": { + "start": { "line": 5407, "column": 51, "offset": 144498 }, + "end": { "line": 5407, "column": 64, "offset": 144511 } + } + }, + { + "type": "text", + "value": " and ", + "position": { + "start": { "line": 5407, "column": 64, "offset": 144511 }, + "end": { "line": 5407, "column": 69, "offset": 144516 } + } + }, + { + "type": "inlineCode", + "value": "new\nBuffer(num)", + "position": { + "start": { "line": 5407, "column": 69, "offset": 144516 }, + "end": { "line": 5408, "column": 15, "offset": 144535 } + } + }, + { + "type": "text", + "value": " return a ", + "position": { + "start": { "line": 5408, "column": 15, "offset": 144535 }, + "end": { "line": 5408, "column": 25, "offset": 144545 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 5408, "column": 25, "offset": 144545 }, + "end": { "line": 5408, "column": 33, "offset": 144553 } + } + }, + { + "type": "text", + "value": " with initialized memory.", + "position": { + "start": { "line": 5408, "column": 33, "offset": 144553 }, + "end": { "line": 5408, "column": 58, "offset": 144578 } + } + } + ], + "position": { + "start": { "line": 5398, "column": 3, "offset": 143776 }, + "end": { "line": 5408, "column": 58, "offset": 144578 } + } + } + ], + "position": { + "start": { "line": 5398, "column": 1, "offset": 143774 }, + "end": { "line": 5408, "column": 58, "offset": 144578 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Passing a string, array, or ", + "position": { + "start": { "line": 5409, "column": 3, "offset": 144581 }, + "end": { "line": 5409, "column": 31, "offset": 144609 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 5409, "column": 31, "offset": 144609 }, + "end": { "line": 5409, "column": 39, "offset": 144617 } + } + }, + { + "type": "text", + "value": " as the first argument copies the\npassed object's data into the ", + "position": { + "start": { "line": 5409, "column": 39, "offset": 144617 }, + "end": { "line": 5410, "column": 33, "offset": 144683 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 5410, "column": 33, "offset": 144683 }, + "end": { "line": 5410, "column": 41, "offset": 144691 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 5410, "column": 41, "offset": 144691 }, + "end": { "line": 5410, "column": 42, "offset": 144692 } + } + } + ], + "position": { + "start": { "line": 5409, "column": 3, "offset": 144581 }, + "end": { "line": 5410, "column": 42, "offset": 144692 } + } + } + ], + "position": { + "start": { "line": 5409, "column": 1, "offset": 144579 }, + "end": { "line": 5410, "column": 42, "offset": 144692 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Passing an {ArrayBuffer} or a {SharedArrayBuffer} returns a ", + "position": { + "start": { "line": 5411, "column": 3, "offset": 144695 }, + "end": { "line": 5411, "column": 63, "offset": 144755 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 5411, "column": 63, "offset": 144755 }, + "end": { "line": 5411, "column": 71, "offset": 144763 } + } + }, + { + "type": "text", + "value": "\nthat shares allocated memory with the given array buffer.", + "position": { + "start": { "line": 5411, "column": 71, "offset": 144763 }, + "end": { "line": 5412, "column": 60, "offset": 144823 } + } + } + ], + "position": { + "start": { "line": 5411, "column": 3, "offset": 144695 }, + "end": { "line": 5412, "column": 60, "offset": 144823 } + } + } + ], + "position": { + "start": { "line": 5411, "column": 1, "offset": 144693 }, + "end": { "line": 5412, "column": 60, "offset": 144823 } + } + } + ], + "position": { + "start": { "line": 5398, "column": 1, "offset": 143774 }, + "end": { "line": 5412, "column": 60, "offset": 144823 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Because the behavior of ", + "position": { + "start": { "line": 5414, "column": 1, "offset": 144825 }, + "end": { "line": 5414, "column": 25, "offset": 144849 } + } + }, + { + "type": "inlineCode", + "value": "new Buffer()", + "position": { + "start": { "line": 5414, "column": 25, "offset": 144849 }, + "end": { "line": 5414, "column": 39, "offset": 144863 } + } + }, + { + "type": "text", + "value": " is different depending on the type of the\nfirst argument, security and reliability issues can be inadvertently introduced\ninto applications when argument validation or ", + "position": { + "start": { "line": 5414, "column": 39, "offset": 144863 }, + "end": { "line": 5416, "column": 47, "offset": 145032 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 5416, "column": 47, "offset": 145032 }, + "end": { "line": 5416, "column": 55, "offset": 145040 } + } + }, + { + "type": "text", + "value": " initialization is not\nperformed.", + "position": { + "start": { "line": 5416, "column": 55, "offset": 145040 }, + "end": { "line": 5417, "column": 11, "offset": 145073 } + } + } + ], + "position": { + "start": { "line": 5414, "column": 1, "offset": 144825 }, + "end": { "line": 5417, "column": 11, "offset": 145073 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "For example, if an attacker can cause an application to receive a number where\na string is expected, the application may call ", + "position": { + "start": { "line": 5419, "column": 1, "offset": 145075 }, + "end": { "line": 5420, "column": 48, "offset": 145201 } + } + }, + { + "type": "inlineCode", + "value": "new Buffer(100)", + "position": { + "start": { "line": 5420, "column": 48, "offset": 145201 }, + "end": { "line": 5420, "column": 65, "offset": 145218 } + } + }, + { + "type": "text", + "value": "\ninstead of ", + "position": { + "start": { "line": 5420, "column": 65, "offset": 145218 }, + "end": { "line": 5421, "column": 12, "offset": 145230 } + } + }, + { + "type": "inlineCode", + "value": "new Buffer(\"100\")", + "position": { + "start": { "line": 5421, "column": 12, "offset": 145230 }, + "end": { "line": 5421, "column": 31, "offset": 145249 } + } + }, + { + "type": "text", + "value": ", leading it to allocate a 100 byte buffer instead\nof allocating a 3 byte buffer with content ", + "position": { + "start": { "line": 5421, "column": 31, "offset": 145249 }, + "end": { "line": 5422, "column": 44, "offset": 145343 } + } + }, + { + "type": "inlineCode", + "value": "\"100\"", + "position": { + "start": { "line": 5422, "column": 44, "offset": 145343 }, + "end": { "line": 5422, "column": 51, "offset": 145350 } + } + }, + { + "type": "text", + "value": ". This is commonly possible\nusing JSON API calls. Since JSON distinguishes between numeric and string types,\nit allows injection of numbers where a naively written application that does not\nvalidate its input sufficiently might expect to always receive a string.\nBefore Node.js 8.0.0, the 100 byte buffer might contain\narbitrary pre-existing in-memory data, so may be used to expose in-memory\nsecrets to a remote attacker. Since Node.js 8.0.0, exposure of memory cannot\noccur because the data is zero-filled. However, other attacks are still\npossible, such as causing very large buffers to be allocated by the server,\nleading to performance degradation or crashing on memory exhaustion.", + "position": { + "start": { "line": 5422, "column": 51, "offset": 145350 }, + "end": { "line": 5431, "column": 69, "offset": 146036 } + } + } + ], + "position": { + "start": { "line": 5419, "column": 1, "offset": 145075 }, + "end": { "line": 5431, "column": 69, "offset": 146036 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "To make the creation of ", + "position": { + "start": { "line": 5433, "column": 1, "offset": 146038 }, + "end": { "line": 5433, "column": 25, "offset": 146062 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 5433, "column": 25, "offset": 146062 }, + "end": { "line": 5433, "column": 33, "offset": 146070 } + } + }, + { + "type": "text", + "value": " instances more reliable and less error-prone,\nthe various forms of the ", + "position": { + "start": { "line": 5433, "column": 33, "offset": 146070 }, + "end": { "line": 5434, "column": 26, "offset": 146142 } + } + }, + { + "type": "inlineCode", + "value": "new Buffer()", + "position": { + "start": { "line": 5434, "column": 26, "offset": 146142 }, + "end": { "line": 5434, "column": 40, "offset": 146156 } + } + }, + { + "type": "text", + "value": " constructor have been ", + "position": { + "start": { "line": 5434, "column": 40, "offset": 146156 }, + "end": { "line": 5434, "column": 63, "offset": 146179 } + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "deprecated", + "position": { + "start": { "line": 5434, "column": 65, "offset": 146181 }, + "end": { "line": 5434, "column": 75, "offset": 146191 } + } + } + ], + "position": { + "start": { "line": 5434, "column": 63, "offset": 146179 }, + "end": { "line": 5434, "column": 77, "offset": 146193 } + } + }, + { + "type": "text", + "value": "\nand replaced by separate ", + "position": { + "start": { "line": 5434, "column": 77, "offset": 146193 }, + "end": { "line": 5435, "column": 26, "offset": 146219 } + } + }, + { + "type": "inlineCode", + "value": "Buffer.from()", + "position": { + "start": { "line": 5435, "column": 26, "offset": 146219 }, + "end": { "line": 5435, "column": 41, "offset": 146234 } + } + }, + { + "type": "text", + "value": ", ", + "position": { + "start": { "line": 5435, "column": 41, "offset": 146234 }, + "end": { "line": 5435, "column": 43, "offset": 146236 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "Buffer.alloc()", + "position": { + "start": { "line": 5435, "column": 44, "offset": 146237 }, + "end": { "line": 5435, "column": 60, "offset": 146253 } + } + } + ], + "position": { + "start": { "line": 5435, "column": 43, "offset": 146236 }, + "end": { "line": 5435, "column": 63, "offset": 146256 } + }, + "label": "`Buffer.alloc()`", + "identifier": "`buffer.alloc()`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": ", and\n", + "position": { + "start": { "line": 5435, "column": 63, "offset": 146256 }, + "end": { "line": 5436, "column": 1, "offset": 146262 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "Buffer.allocUnsafe()", + "position": { + "start": { "line": 5436, "column": 2, "offset": 146263 }, + "end": { "line": 5436, "column": 24, "offset": 146285 } + } + } + ], + "position": { + "start": { "line": 5436, "column": 1, "offset": 146262 }, + "end": { "line": 5436, "column": 27, "offset": 146288 } + }, + "label": "`Buffer.allocUnsafe()`", + "identifier": "`buffer.allocunsafe()`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": " methods.", + "position": { + "start": { "line": 5436, "column": 27, "offset": 146288 }, + "end": { "line": 5436, "column": 36, "offset": 146297 } + } + } + ], + "position": { + "start": { "line": 5433, "column": 1, "offset": 146038 }, + "end": { "line": 5436, "column": 36, "offset": 146297 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "emphasis", + "children": [ + { + "type": "text", + "value": "Developers should migrate all existing uses of the ", + "position": { + "start": { "line": 5438, "column": 2, "offset": 146300 }, + "end": { "line": 5438, "column": 53, "offset": 146351 } + } + }, + { + "type": "inlineCode", + "value": "new Buffer()", + "position": { + "start": { "line": 5438, "column": 53, "offset": 146351 }, + "end": { "line": 5438, "column": 67, "offset": 146365 } + } + }, + { + "type": "text", + "value": " constructors\nto one of these new APIs.", + "position": { + "start": { "line": 5438, "column": 67, "offset": 146365 }, + "end": { "line": 5439, "column": 26, "offset": 146404 } + } + } + ], + "position": { + "start": { "line": 5438, "column": 1, "offset": 146299 }, + "end": { "line": 5439, "column": 27, "offset": 146405 } + } + } + ], + "position": { + "start": { "line": 5438, "column": 1, "offset": 146299 }, + "end": { "line": 5439, "column": 27, "offset": 146405 } + } + }, + { + "type": "list", + "ordered": false, + "start": null, + "spread": false, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "Buffer.from(array)", + "position": { + "start": { + "line": 5441, + "column": 4, + "offset": 146410 + }, + "end": { "line": 5441, "column": 24, "offset": 146430 } + } + } + ], + "position": { + "start": { "line": 5441, "column": 3, "offset": 146409 }, + "end": { "line": 5441, "column": 27, "offset": 146433 } + }, + "label": "`Buffer.from(array)`", + "identifier": "`buffer.from(array)`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": " returns a new ", + "position": { + "start": { "line": 5441, "column": 27, "offset": 146433 }, + "end": { "line": 5441, "column": 42, "offset": 146448 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 5441, "column": 42, "offset": 146448 }, + "end": { "line": 5441, "column": 50, "offset": 146456 } + } + }, + { + "type": "text", + "value": " that ", + "position": { + "start": { "line": 5441, "column": 50, "offset": 146456 }, + "end": { "line": 5441, "column": 56, "offset": 146462 } + } + }, + { + "type": "emphasis", + "children": [ + { + "type": "text", + "value": "contains a copy", + "position": { + "start": { + "line": 5441, + "column": 57, + "offset": 146463 + }, + "end": { "line": 5441, "column": 72, "offset": 146478 } + } + } + ], + "position": { + "start": { "line": 5441, "column": 56, "offset": 146462 }, + "end": { "line": 5441, "column": 73, "offset": 146479 } + } + }, + { + "type": "text", + "value": " of the\nprovided octets.", + "position": { + "start": { "line": 5441, "column": 73, "offset": 146479 }, + "end": { "line": 5442, "column": 19, "offset": 146505 } + } + } + ], + "position": { + "start": { "line": 5441, "column": 3, "offset": 146409 }, + "end": { "line": 5442, "column": 19, "offset": 146505 } + } + } + ], + "position": { + "start": { "line": 5441, "column": 1, "offset": 146407 }, + "end": { "line": 5442, "column": 19, "offset": 146505 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "Buffer.from(arrayBuffer[, byteOffset[, length]])", + "position": { + "start": { + "line": 5443, + "column": 4, + "offset": 146509 + }, + "end": { "line": 5443, "column": 54, "offset": 146559 } + } + } + ], + "position": { + "start": { "line": 5443, "column": 3, "offset": 146508 }, + "end": { "line": 5443, "column": 80, "offset": 146585 } + }, + "label": "`Buffer.from(arrayBuf)`", + "identifier": "`buffer.from(arraybuf)`", + "referenceType": "full" + }, + { + "type": "text", + "value": "\nreturns a new ", + "position": { + "start": { "line": 5443, "column": 80, "offset": 146585 }, + "end": { "line": 5444, "column": 17, "offset": 146602 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 5444, "column": 17, "offset": 146602 }, + "end": { "line": 5444, "column": 25, "offset": 146610 } + } + }, + { + "type": "text", + "value": " that ", + "position": { + "start": { "line": 5444, "column": 25, "offset": 146610 }, + "end": { "line": 5444, "column": 31, "offset": 146616 } + } + }, + { + "type": "emphasis", + "children": [ + { + "type": "text", + "value": "shares the same allocated memory", + "position": { + "start": { + "line": 5444, + "column": 32, + "offset": 146617 + }, + "end": { "line": 5444, "column": 64, "offset": 146649 } + } + } + ], + "position": { + "start": { "line": 5444, "column": 31, "offset": 146616 }, + "end": { "line": 5444, "column": 65, "offset": 146650 } + } + }, + { + "type": "text", + "value": " as the given\n{ArrayBuffer}.", + "position": { + "start": { "line": 5444, "column": 65, "offset": 146650 }, + "end": { "line": 5445, "column": 17, "offset": 146680 } + } + } + ], + "position": { + "start": { "line": 5443, "column": 3, "offset": 146508 }, + "end": { "line": 5445, "column": 17, "offset": 146680 } + } + } + ], + "position": { + "start": { "line": 5443, "column": 1, "offset": 146506 }, + "end": { "line": 5445, "column": 17, "offset": 146680 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "Buffer.from(buffer)", + "position": { + "start": { + "line": 5446, + "column": 4, + "offset": 146684 + }, + "end": { "line": 5446, "column": 25, "offset": 146705 } + } + } + ], + "position": { + "start": { "line": 5446, "column": 3, "offset": 146683 }, + "end": { "line": 5446, "column": 28, "offset": 146708 } + }, + "label": "`Buffer.from(buffer)`", + "identifier": "`buffer.from(buffer)`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": " returns a new ", + "position": { + "start": { "line": 5446, "column": 28, "offset": 146708 }, + "end": { "line": 5446, "column": 43, "offset": 146723 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 5446, "column": 43, "offset": 146723 }, + "end": { "line": 5446, "column": 51, "offset": 146731 } + } + }, + { + "type": "text", + "value": " that ", + "position": { + "start": { "line": 5446, "column": 51, "offset": 146731 }, + "end": { "line": 5446, "column": 57, "offset": 146737 } + } + }, + { + "type": "emphasis", + "children": [ + { + "type": "text", + "value": "contains a copy", + "position": { + "start": { + "line": 5446, + "column": 58, + "offset": 146738 + }, + "end": { "line": 5446, "column": 73, "offset": 146753 } + } + } + ], + "position": { + "start": { "line": 5446, "column": 57, "offset": 146737 }, + "end": { "line": 5446, "column": 74, "offset": 146754 } + } + }, + { + "type": "text", + "value": " of the\ncontents of the given ", + "position": { + "start": { "line": 5446, "column": 74, "offset": 146754 }, + "end": { "line": 5447, "column": 25, "offset": 146786 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 5447, "column": 25, "offset": 146786 }, + "end": { "line": 5447, "column": 33, "offset": 146794 } + } + }, + { + "type": "text", + "value": ".", + "position": { + "start": { "line": 5447, "column": 33, "offset": 146794 }, + "end": { "line": 5447, "column": 34, "offset": 146795 } + } + } + ], + "position": { + "start": { "line": 5446, "column": 3, "offset": 146683 }, + "end": { "line": 5447, "column": 34, "offset": 146795 } + } + } + ], + "position": { + "start": { "line": 5446, "column": 1, "offset": 146681 }, + "end": { "line": 5447, "column": 34, "offset": 146795 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "Buffer.from(string[, encoding])", + "position": { + "start": { + "line": 5448, + "column": 4, + "offset": 146799 + }, + "end": { "line": 5448, "column": 37, "offset": 146832 } + } + } + ], + "position": { + "start": { "line": 5448, "column": 3, "offset": 146798 }, + "end": { "line": 5448, "column": 61, "offset": 146856 } + }, + "label": "`Buffer.from(string)`", + "identifier": "`buffer.from(string)`", + "referenceType": "full" + }, + { + "type": "text", + "value": " returns a new\n", + "position": { + "start": { "line": 5448, "column": 61, "offset": 146856 }, + "end": { "line": 5449, "column": 1, "offset": 146871 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 5449, "column": 3, "offset": 146873 }, + "end": { "line": 5449, "column": 11, "offset": 146881 } + } + }, + { + "type": "text", + "value": " that ", + "position": { + "start": { "line": 5449, "column": 11, "offset": 146881 }, + "end": { "line": 5449, "column": 17, "offset": 146887 } + } + }, + { + "type": "emphasis", + "children": [ + { + "type": "text", + "value": "contains a copy", + "position": { + "start": { + "line": 5449, + "column": 18, + "offset": 146888 + }, + "end": { "line": 5449, "column": 33, "offset": 146903 } + } + } + ], + "position": { + "start": { "line": 5449, "column": 17, "offset": 146887 }, + "end": { "line": 5449, "column": 34, "offset": 146904 } + } + }, + { + "type": "text", + "value": " of the provided string.", + "position": { + "start": { "line": 5449, "column": 34, "offset": 146904 }, + "end": { "line": 5449, "column": 58, "offset": 146928 } + } + } + ], + "position": { + "start": { "line": 5448, "column": 3, "offset": 146798 }, + "end": { "line": 5449, "column": 58, "offset": 146928 } + } + } + ], + "position": { + "start": { "line": 5448, "column": 1, "offset": 146796 }, + "end": { "line": 5449, "column": 58, "offset": 146928 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "Buffer.alloc(size[, fill[, encoding]])", + "position": { + "start": { + "line": 5450, + "column": 4, + "offset": 146932 + }, + "end": { "line": 5450, "column": 44, "offset": 146972 } + } + } + ], + "position": { + "start": { "line": 5450, "column": 3, "offset": 146931 }, + "end": { "line": 5450, "column": 63, "offset": 146991 } + }, + "label": "`Buffer.alloc()`", + "identifier": "`buffer.alloc()`", + "referenceType": "full" + }, + { + "type": "text", + "value": " returns a new\ninitialized ", + "position": { + "start": { "line": 5450, "column": 63, "offset": 146991 }, + "end": { "line": 5451, "column": 15, "offset": 147020 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 5451, "column": 15, "offset": 147020 }, + "end": { "line": 5451, "column": 23, "offset": 147028 } + } + }, + { + "type": "text", + "value": " of the specified size. This method is slower than\n", + "position": { + "start": { "line": 5451, "column": 23, "offset": 147028 }, + "end": { "line": 5452, "column": 1, "offset": 147079 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "Buffer.allocUnsafe(size)", + "position": { + "start": { + "line": 5452, + "column": 4, + "offset": 147082 + }, + "end": { "line": 5452, "column": 30, "offset": 147108 } + } + } + ], + "position": { + "start": { "line": 5452, "column": 3, "offset": 147081 }, + "end": { "line": 5452, "column": 55, "offset": 147133 } + }, + "label": "`Buffer.allocUnsafe()`", + "identifier": "`buffer.allocunsafe()`", + "referenceType": "full" + }, + { + "type": "text", + "value": " but guarantees that newly\ncreated ", + "position": { + "start": { "line": 5452, "column": 55, "offset": 147133 }, + "end": { "line": 5453, "column": 11, "offset": 147170 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 5453, "column": 11, "offset": 147170 }, + "end": { "line": 5453, "column": 19, "offset": 147178 } + } + }, + { + "type": "text", + "value": " instances never contain old data that is potentially\nsensitive. A ", + "position": { + "start": { "line": 5453, "column": 19, "offset": 147178 }, + "end": { "line": 5454, "column": 16, "offset": 147247 } + } + }, + { + "type": "inlineCode", + "value": "TypeError", + "position": { + "start": { "line": 5454, "column": 16, "offset": 147247 }, + "end": { "line": 5454, "column": 27, "offset": 147258 } + } + }, + { + "type": "text", + "value": " will be thrown if ", + "position": { + "start": { "line": 5454, "column": 27, "offset": 147258 }, + "end": { "line": 5454, "column": 46, "offset": 147277 } + } + }, + { + "type": "inlineCode", + "value": "size", + "position": { + "start": { "line": 5454, "column": 46, "offset": 147277 }, + "end": { "line": 5454, "column": 52, "offset": 147283 } + } + }, + { + "type": "text", + "value": " is not a number.", + "position": { + "start": { "line": 5454, "column": 52, "offset": 147283 }, + "end": { "line": 5454, "column": 69, "offset": 147300 } + } + } + ], + "position": { + "start": { "line": 5450, "column": 3, "offset": 146931 }, + "end": { "line": 5454, "column": 69, "offset": 147300 } + } + } + ], + "position": { + "start": { "line": 5450, "column": 1, "offset": 146929 }, + "end": { "line": 5454, "column": 69, "offset": 147300 } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "Buffer.allocUnsafe(size)", + "position": { + "start": { + "line": 5455, + "column": 4, + "offset": 147304 + }, + "end": { "line": 5455, "column": 30, "offset": 147330 } + } + } + ], + "position": { + "start": { "line": 5455, "column": 3, "offset": 147303 }, + "end": { "line": 5455, "column": 55, "offset": 147355 } + }, + "label": "`Buffer.allocUnsafe()`", + "identifier": "`buffer.allocunsafe()`", + "referenceType": "full" + }, + { + "type": "text", + "value": " and\n", + "position": { + "start": { "line": 5455, "column": 55, "offset": 147355 }, + "end": { "line": 5456, "column": 1, "offset": 147360 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "Buffer.allocUnsafeSlow(size)", + "position": { + "start": { + "line": 5456, + "column": 4, + "offset": 147363 + }, + "end": { "line": 5456, "column": 34, "offset": 147393 } + } + } + ], + "position": { + "start": { "line": 5456, "column": 3, "offset": 147362 }, + "end": { "line": 5456, "column": 63, "offset": 147422 } + }, + "label": "`Buffer.allocUnsafeSlow()`", + "identifier": "`buffer.allocunsafeslow()`", + "referenceType": "full" + }, + { + "type": "text", + "value": " each return a\nnew uninitialized ", + "position": { + "start": { "line": 5456, "column": 63, "offset": 147422 }, + "end": { "line": 5457, "column": 21, "offset": 147457 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 5457, "column": 21, "offset": 147457 }, + "end": { "line": 5457, "column": 29, "offset": 147465 } + } + }, + { + "type": "text", + "value": " of the specified ", + "position": { + "start": { "line": 5457, "column": 29, "offset": 147465 }, + "end": { "line": 5457, "column": 47, "offset": 147483 } + } + }, + { + "type": "inlineCode", + "value": "size", + "position": { + "start": { "line": 5457, "column": 47, "offset": 147483 }, + "end": { "line": 5457, "column": 53, "offset": 147489 } + } + }, + { + "type": "text", + "value": ". Because the ", + "position": { + "start": { "line": 5457, "column": 53, "offset": 147489 }, + "end": { "line": 5457, "column": 67, "offset": 147503 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 5457, "column": 67, "offset": 147503 }, + "end": { "line": 5457, "column": 75, "offset": 147511 } + } + }, + { + "type": "text", + "value": " is\nuninitialized, the allocated segment of memory might contain old data that is\npotentially sensitive.", + "position": { + "start": { "line": 5457, "column": 75, "offset": 147511 }, + "end": { "line": 5459, "column": 25, "offset": 147619 } + } + } + ], + "position": { + "start": { "line": 5455, "column": 3, "offset": 147303 }, + "end": { "line": 5459, "column": 25, "offset": 147619 } + } + } + ], + "position": { + "start": { "line": 5455, "column": 1, "offset": 147301 }, + "end": { "line": 5459, "column": 25, "offset": 147619 } + } + } + ], + "position": { + "start": { "line": 5441, "column": 1, "offset": 146407 }, + "end": { "line": 5459, "column": 25, "offset": 147619 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 5461, "column": 1, "offset": 147621 }, + "end": { "line": 5461, "column": 9, "offset": 147629 } + } + }, + { + "type": "text", + "value": " instances returned by ", + "position": { + "start": { "line": 5461, "column": 9, "offset": 147629 }, + "end": { "line": 5461, "column": 32, "offset": 147652 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "Buffer.allocUnsafe()", + "position": { + "start": { "line": 5461, "column": 33, "offset": 147653 }, + "end": { "line": 5461, "column": 55, "offset": 147675 } + } + } + ], + "position": { + "start": { "line": 5461, "column": 32, "offset": 147652 }, + "end": { "line": 5461, "column": 58, "offset": 147678 } + }, + "label": "`Buffer.allocUnsafe()`", + "identifier": "`buffer.allocunsafe()`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": ", ", + "position": { + "start": { "line": 5461, "column": 58, "offset": 147678 }, + "end": { "line": 5461, "column": 60, "offset": 147680 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "Buffer.from(string)", + "position": { + "start": { "line": 5461, "column": 61, "offset": 147681 }, + "end": { "line": 5461, "column": 82, "offset": 147702 } + } + } + ], + "position": { + "start": { "line": 5461, "column": 60, "offset": 147680 }, + "end": { "line": 5461, "column": 85, "offset": 147705 } + }, + "label": "`Buffer.from(string)`", + "identifier": "`buffer.from(string)`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": ",\n", + "position": { + "start": { "line": 5461, "column": 85, "offset": 147705 }, + "end": { "line": 5462, "column": 1, "offset": 147707 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "Buffer.concat()", + "position": { + "start": { "line": 5462, "column": 2, "offset": 147708 }, + "end": { "line": 5462, "column": 19, "offset": 147725 } + } + } + ], + "position": { + "start": { "line": 5462, "column": 1, "offset": 147707 }, + "end": { "line": 5462, "column": 22, "offset": 147728 } + }, + "label": "`Buffer.concat()`", + "identifier": "`buffer.concat()`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": " and ", + "position": { + "start": { "line": 5462, "column": 22, "offset": 147728 }, + "end": { "line": 5462, "column": 27, "offset": 147733 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "Buffer.from(array)", + "position": { + "start": { "line": 5462, "column": 28, "offset": 147734 }, + "end": { "line": 5462, "column": 48, "offset": 147754 } + } + } + ], + "position": { + "start": { "line": 5462, "column": 27, "offset": 147733 }, + "end": { "line": 5462, "column": 51, "offset": 147757 } + }, + "label": "`Buffer.from(array)`", + "identifier": "`buffer.from(array)`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 5462, "column": 51, "offset": 147757 }, + "end": { "line": 5462, "column": 52, "offset": 147758 } + } + }, + { + "type": "emphasis", + "children": [ + { + "type": "text", + "value": "may", + "position": { + "start": { "line": 5462, "column": 53, "offset": 147759 }, + "end": { "line": 5462, "column": 56, "offset": 147762 } + } + } + ], + "position": { + "start": { "line": 5462, "column": 52, "offset": 147758 }, + "end": { "line": 5462, "column": 57, "offset": 147763 } + } + }, + { + "type": "text", + "value": " be allocated off a shared\ninternal memory pool if ", + "position": { + "start": { "line": 5462, "column": 57, "offset": 147763 }, + "end": { "line": 5463, "column": 25, "offset": 147814 } + } + }, + { + "type": "inlineCode", + "value": "size", + "position": { + "start": { "line": 5463, "column": 25, "offset": 147814 }, + "end": { "line": 5463, "column": 31, "offset": 147820 } + } + }, + { + "type": "text", + "value": " is less than or equal to half ", + "position": { + "start": { "line": 5463, "column": 31, "offset": 147820 }, + "end": { "line": 5463, "column": 62, "offset": 147851 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "Buffer.poolSize", + "position": { + "start": { "line": 5463, "column": 63, "offset": 147852 }, + "end": { "line": 5463, "column": 80, "offset": 147869 } + } + } + ], + "position": { + "start": { "line": 5463, "column": 62, "offset": 147851 }, + "end": { "line": 5463, "column": 83, "offset": 147872 } + }, + "label": "`Buffer.poolSize`", + "identifier": "`buffer.poolsize`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": ".\nInstances returned by ", + "position": { + "start": { "line": 5463, "column": 83, "offset": 147872 }, + "end": { "line": 5464, "column": 23, "offset": 147896 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "Buffer.allocUnsafeSlow()", + "position": { + "start": { "line": 5464, "column": 24, "offset": 147897 }, + "end": { "line": 5464, "column": 50, "offset": 147923 } + } + } + ], + "position": { + "start": { "line": 5464, "column": 23, "offset": 147896 }, + "end": { "line": 5464, "column": 53, "offset": 147926 } + }, + "label": "`Buffer.allocUnsafeSlow()`", + "identifier": "`buffer.allocunsafeslow()`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": " ", + "position": { + "start": { "line": 5464, "column": 53, "offset": 147926 }, + "end": { "line": 5464, "column": 54, "offset": 147927 } + } + }, + { + "type": "emphasis", + "children": [ + { + "type": "text", + "value": "never", + "position": { + "start": { "line": 5464, "column": 55, "offset": 147928 }, + "end": { "line": 5464, "column": 60, "offset": 147933 } + } + } + ], + "position": { + "start": { "line": 5464, "column": 54, "offset": 147927 }, + "end": { "line": 5464, "column": 61, "offset": 147934 } + } + }, + { + "type": "text", + "value": " use the shared internal\nmemory pool.", + "position": { + "start": { "line": 5464, "column": 61, "offset": 147934 }, + "end": { "line": 5465, "column": 13, "offset": 147971 } + } + } + ], + "position": { + "start": { "line": 5461, "column": 1, "offset": 147621 }, + "end": { "line": 5465, "column": 13, "offset": 147971 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "text", + "value": "The ", + "position": { + "start": { "line": 5467, "column": 5, "offset": 147977 }, + "end": { "line": 5467, "column": 9, "offset": 147981 } + } + }, + { + "type": "inlineCode", + "value": "--zero-fill-buffers", + "position": { + "start": { "line": 5467, "column": 9, "offset": 147981 }, + "end": { "line": 5467, "column": 30, "offset": 148002 } + } + }, + { + "type": "text", + "value": " command-line option", + "position": { + "start": { "line": 5467, "column": 30, "offset": 148002 }, + "end": { "line": 5467, "column": 50, "offset": 148022 } + } + } + ], + "position": { + "start": { "line": 5467, "column": 1, "offset": 147973 }, + "end": { "line": 5467, "column": 50, "offset": 148022 } + } + }, + { + "type": "html", + "value": "", + "position": { + "start": { "line": 5469, "column": 1, "offset": 148024 }, + "end": { "line": 5471, "column": 4, "offset": 148052 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Node.js can be started using the ", + "position": { + "start": { "line": 5473, "column": 1, "offset": 148054 }, + "end": { "line": 5473, "column": 34, "offset": 148087 } + } + }, + { + "type": "inlineCode", + "value": "--zero-fill-buffers", + "position": { + "start": { "line": 5473, "column": 34, "offset": 148087 }, + "end": { "line": 5473, "column": 55, "offset": 148108 } + } + }, + { + "type": "text", + "value": " command-line option to\ncause all newly-allocated ", + "position": { + "start": { "line": 5473, "column": 55, "offset": 148108 }, + "end": { "line": 5474, "column": 27, "offset": 148158 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 5474, "column": 27, "offset": 148158 }, + "end": { "line": 5474, "column": 35, "offset": 148166 } + } + }, + { + "type": "text", + "value": " instances to be zero-filled upon creation by\ndefault. Without the option, buffers created with ", + "position": { + "start": { "line": 5474, "column": 35, "offset": 148166 }, + "end": { "line": 5475, "column": 51, "offset": 148262 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "Buffer.allocUnsafe()", + "position": { + "start": { "line": 5475, "column": 52, "offset": 148263 }, + "end": { "line": 5475, "column": 74, "offset": 148285 } + } + } + ], + "position": { + "start": { "line": 5475, "column": 51, "offset": 148262 }, + "end": { "line": 5475, "column": 77, "offset": 148288 } + }, + "label": "`Buffer.allocUnsafe()`", + "identifier": "`buffer.allocunsafe()`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": " and\n", + "position": { + "start": { "line": 5475, "column": 77, "offset": 148288 }, + "end": { "line": 5476, "column": 1, "offset": 148293 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "Buffer.allocUnsafeSlow()", + "position": { + "start": { "line": 5476, "column": 2, "offset": 148294 }, + "end": { "line": 5476, "column": 28, "offset": 148320 } + } + } + ], + "position": { + "start": { "line": 5476, "column": 1, "offset": 148293 }, + "end": { "line": 5476, "column": 31, "offset": 148323 } + }, + "label": "`Buffer.allocUnsafeSlow()`", + "identifier": "`buffer.allocunsafeslow()`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": " are not zero-filled. Use of this flag can have a\nmeasurable negative impact on performance. Use the ", + "position": { + "start": { "line": 5476, "column": 31, "offset": 148323 }, + "end": { "line": 5477, "column": 52, "offset": 148424 } + } + }, + { + "type": "inlineCode", + "value": "--zero-fill-buffers", + "position": { + "start": { "line": 5477, "column": 52, "offset": 148424 }, + "end": { "line": 5477, "column": 73, "offset": 148445 } + } + }, + { + "type": "text", + "value": " option\nonly when necessary to enforce that newly allocated ", + "position": { + "start": { "line": 5477, "column": 73, "offset": 148445 }, + "end": { "line": 5478, "column": 53, "offset": 148505 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 5478, "column": 53, "offset": 148505 }, + "end": { "line": 5478, "column": 61, "offset": 148513 } + } + }, + { + "type": "text", + "value": " instances cannot\ncontain old data that is potentially sensitive.", + "position": { + "start": { "line": 5478, "column": 61, "offset": 148513 }, + "end": { "line": 5479, "column": 48, "offset": 148578 } + } + } + ], + "position": { + "start": { "line": 5473, "column": 1, "offset": 148054 }, + "end": { "line": 5479, "column": 48, "offset": 148578 } + } + }, + { + "type": "code", + "lang": "console", + "meta": null, + "value": "$ node --zero-fill-buffers\n> Buffer.allocUnsafe(5);\n", + "position": { + "start": { "line": 5481, "column": 1, "offset": 148580 }, + "end": { "line": 5485, "column": 4, "offset": 148670 } + } + }, + { + "type": "heading", + "depth": 3, + "children": [ + { + "type": "text", + "value": "What makes ", + "position": { + "start": { "line": 5487, "column": 5, "offset": 148676 }, + "end": { "line": 5487, "column": 16, "offset": 148687 } + } + }, + { + "type": "inlineCode", + "value": "Buffer.allocUnsafe()", + "position": { + "start": { "line": 5487, "column": 16, "offset": 148687 }, + "end": { "line": 5487, "column": 38, "offset": 148709 } + } + }, + { + "type": "text", + "value": " and ", + "position": { + "start": { "line": 5487, "column": 38, "offset": 148709 }, + "end": { "line": 5487, "column": 43, "offset": 148714 } + } + }, + { + "type": "inlineCode", + "value": "Buffer.allocUnsafeSlow()", + "position": { + "start": { "line": 5487, "column": 43, "offset": 148714 }, + "end": { "line": 5487, "column": 69, "offset": 148740 } + } + }, + { + "type": "text", + "value": " \"unsafe\"?", + "position": { + "start": { "line": 5487, "column": 69, "offset": 148740 }, + "end": { "line": 5487, "column": 79, "offset": 148750 } + } + } + ], + "position": { + "start": { "line": 5487, "column": 1, "offset": 148672 }, + "end": { "line": 5487, "column": 79, "offset": 148750 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "When calling ", + "position": { + "start": { "line": 5489, "column": 1, "offset": 148752 }, + "end": { "line": 5489, "column": 14, "offset": 148765 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "Buffer.allocUnsafe()", + "position": { + "start": { "line": 5489, "column": 15, "offset": 148766 }, + "end": { "line": 5489, "column": 37, "offset": 148788 } + } + } + ], + "position": { + "start": { "line": 5489, "column": 14, "offset": 148765 }, + "end": { "line": 5489, "column": 40, "offset": 148791 } + }, + "label": "`Buffer.allocUnsafe()`", + "identifier": "`buffer.allocunsafe()`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": " and ", + "position": { + "start": { "line": 5489, "column": 40, "offset": 148791 }, + "end": { "line": 5489, "column": 45, "offset": 148796 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "Buffer.allocUnsafeSlow()", + "position": { + "start": { "line": 5489, "column": 46, "offset": 148797 }, + "end": { "line": 5489, "column": 72, "offset": 148823 } + } + } + ], + "position": { + "start": { "line": 5489, "column": 45, "offset": 148796 }, + "end": { "line": 5489, "column": 75, "offset": 148826 } + }, + "label": "`Buffer.allocUnsafeSlow()`", + "identifier": "`buffer.allocunsafeslow()`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": ", the\nsegment of allocated memory is ", + "position": { + "start": { "line": 5489, "column": 75, "offset": 148826 }, + "end": { "line": 5490, "column": 32, "offset": 148863 } + } + }, + { + "type": "emphasis", + "children": [ + { + "type": "text", + "value": "uninitialized", + "position": { + "start": { "line": 5490, "column": 33, "offset": 148864 }, + "end": { "line": 5490, "column": 46, "offset": 148877 } + } + } + ], + "position": { + "start": { "line": 5490, "column": 32, "offset": 148863 }, + "end": { "line": 5490, "column": 47, "offset": 148878 } + } + }, + { + "type": "text", + "value": " (it is not zeroed-out). While\nthis design makes the allocation of memory quite fast, the allocated segment of\nmemory might contain old data that is potentially sensitive. Using a ", + "position": { + "start": { "line": 5490, "column": 47, "offset": 148878 }, + "end": { "line": 5492, "column": 70, "offset": 149058 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 5492, "column": 70, "offset": 149058 }, + "end": { "line": 5492, "column": 78, "offset": 149066 } + } + }, + { + "type": "text", + "value": "\ncreated by ", + "position": { + "start": { "line": 5492, "column": 78, "offset": 149066 }, + "end": { "line": 5493, "column": 12, "offset": 149078 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "Buffer.allocUnsafe()", + "position": { + "start": { "line": 5493, "column": 13, "offset": 149079 }, + "end": { "line": 5493, "column": 35, "offset": 149101 } + } + } + ], + "position": { + "start": { "line": 5493, "column": 12, "offset": 149078 }, + "end": { "line": 5493, "column": 38, "offset": 149104 } + }, + "label": "`Buffer.allocUnsafe()`", + "identifier": "`buffer.allocunsafe()`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": " without ", + "position": { + "start": { "line": 5493, "column": 38, "offset": 149104 }, + "end": { "line": 5493, "column": 47, "offset": 149113 } + } + }, + { + "type": "emphasis", + "children": [ + { + "type": "text", + "value": "completely", + "position": { + "start": { "line": 5493, "column": 48, "offset": 149114 }, + "end": { "line": 5493, "column": 58, "offset": 149124 } + } + } + ], + "position": { + "start": { "line": 5493, "column": 47, "offset": 149113 }, + "end": { "line": 5493, "column": 59, "offset": 149125 } + } + }, + { + "type": "text", + "value": " overwriting the\nmemory can allow this old data to be leaked when the ", + "position": { + "start": { "line": 5493, "column": 59, "offset": 149125 }, + "end": { "line": 5494, "column": 54, "offset": 149195 } + } + }, + { + "type": "inlineCode", + "value": "Buffer", + "position": { + "start": { "line": 5494, "column": 54, "offset": 149195 }, + "end": { "line": 5494, "column": 62, "offset": 149203 } + } + }, + { + "type": "text", + "value": " memory is read.", + "position": { + "start": { "line": 5494, "column": 62, "offset": 149203 }, + "end": { "line": 5494, "column": 78, "offset": 149219 } + } + } + ], + "position": { + "start": { "line": 5489, "column": 1, "offset": 148752 }, + "end": { "line": 5494, "column": 78, "offset": 149219 } + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "While there are clear performance advantages to using\n", + "position": { + "start": { "line": 5496, "column": 1, "offset": 149221 }, + "end": { "line": 5497, "column": 1, "offset": 149275 } + } + }, + { + "type": "linkReference", + "children": [ + { + "type": "inlineCode", + "value": "Buffer.allocUnsafe()", + "position": { + "start": { "line": 5497, "column": 2, "offset": 149276 }, + "end": { "line": 5497, "column": 24, "offset": 149298 } + } + } + ], + "position": { + "start": { "line": 5497, "column": 1, "offset": 149275 }, + "end": { "line": 5497, "column": 27, "offset": 149301 } + }, + "label": "`Buffer.allocUnsafe()`", + "identifier": "`buffer.allocunsafe()`", + "referenceType": "collapsed" + }, + { + "type": "text", + "value": ", extra care ", + "position": { + "start": { "line": 5497, "column": 27, "offset": 149301 }, + "end": { "line": 5497, "column": 40, "offset": 149314 } + } + }, + { + "type": "emphasis", + "children": [ + { + "type": "text", + "value": "must", + "position": { + "start": { "line": 5497, "column": 41, "offset": 149315 }, + "end": { "line": 5497, "column": 45, "offset": 149319 } + } + } + ], + "position": { + "start": { "line": 5497, "column": 40, "offset": 149314 }, + "end": { "line": 5497, "column": 46, "offset": 149320 } + } + }, + { + "type": "text", + "value": " be taken in order to avoid\nintroducing security vulnerabilities into an application.", + "position": { + "start": { "line": 5497, "column": 46, "offset": 149320 }, + "end": { "line": 5498, "column": 58, "offset": 149405 } + } + } + ], + "position": { + "start": { "line": 5496, "column": 1, "offset": 149221 }, + "end": { "line": 5498, "column": 58, "offset": 149405 } + } + }, + { + "type": "definition", + "identifier": "ascii", + "label": "ASCII", + "title": null, + "url": "https://en.wikipedia.org/wiki/ASCII", + "position": { + "start": { "line": 5500, "column": 1, "offset": 149407 }, + "end": { "line": 5500, "column": 45, "offset": 149451 } + } + }, + { + "type": "definition", + "identifier": "base64", + "label": "Base64", + "title": null, + "url": "https://en.wikipedia.org/wiki/Base64", + "position": { + "start": { "line": 5501, "column": 1, "offset": 149452 }, + "end": { "line": 5501, "column": 47, "offset": 149498 } + } + }, + { + "type": "definition", + "identifier": "iso-8859-1", + "label": "ISO-8859-1", + "title": null, + "url": "https://en.wikipedia.org/wiki/ISO-8859-1", + "position": { + "start": { "line": 5502, "column": 1, "offset": 149499 }, + "end": { "line": 5502, "column": 55, "offset": 149553 } + } + }, + { + "type": "definition", + "identifier": "rfc 4648, section 5", + "label": "RFC 4648, Section 5", + "title": null, + "url": "https://tools.ietf.org/html/rfc4648#section-5", + "position": { + "start": { "line": 5503, "column": 1, "offset": 149554 }, + "end": { "line": 5503, "column": 69, "offset": 149622 } + } + }, + { + "type": "definition", + "identifier": "utf-16", + "label": "UTF-16", + "title": null, + "url": "https://en.wikipedia.org/wiki/UTF-16", + "position": { + "start": { "line": 5504, "column": 1, "offset": 149623 }, + "end": { "line": 5504, "column": 47, "offset": 149669 } + } + }, + { + "type": "definition", + "identifier": "utf-8", + "label": "UTF-8", + "title": null, + "url": "https://en.wikipedia.org/wiki/UTF-8", + "position": { + "start": { "line": 5505, "column": 1, "offset": 149670 }, + "end": { "line": 5505, "column": 45, "offset": 149714 } + } + }, + { + "type": "definition", + "identifier": "whatwg encoding standard", + "label": "WHATWG Encoding Standard", + "title": null, + "url": "https://encoding.spec.whatwg.org/", + "position": { + "start": { "line": 5506, "column": 1, "offset": 149715 }, + "end": { "line": 5506, "column": 62, "offset": 149776 } + } + }, + { + "type": "definition", + "identifier": "`blob`", + "label": "`Blob`", + "title": null, + "url": "https://developer.mozilla.org/en-US/docs/Web/API/Blob", + "position": { + "start": { "line": 5507, "column": 1, "offset": 149777 }, + "end": { "line": 5507, "column": 64, "offset": 149840 } + } + }, + { + "type": "definition", + "identifier": "`buffer.alloc()`", + "label": "`Buffer.alloc()`", + "title": null, + "url": "#static-method-bufferallocsize-fill-encoding", + "position": { + "start": { "line": 5508, "column": 1, "offset": 149841 }, + "end": { "line": 5508, "column": 65, "offset": 149905 } + } + }, + { + "type": "definition", + "identifier": "`buffer.allocunsafe()`", + "label": "`Buffer.allocUnsafe()`", + "title": null, + "url": "#static-method-bufferallocunsafesize", + "position": { + "start": { "line": 5509, "column": 1, "offset": 149906 }, + "end": { "line": 5509, "column": 63, "offset": 149968 } + } + }, + { + "type": "definition", + "identifier": "`buffer.allocunsafeslow()`", + "label": "`Buffer.allocUnsafeSlow()`", + "title": null, + "url": "#static-method-bufferallocunsafeslowsize", + "position": { + "start": { "line": 5510, "column": 1, "offset": 149969 }, + "end": { "line": 5510, "column": 71, "offset": 150039 } + } + }, + { + "type": "definition", + "identifier": "`buffer.concat()`", + "label": "`Buffer.concat()`", + "title": null, + "url": "#static-method-bufferconcatlist-totallength", + "position": { + "start": { "line": 5511, "column": 1, "offset": 150040 }, + "end": { "line": 5511, "column": 65, "offset": 150104 } + } + }, + { + "type": "definition", + "identifier": "`buffer.copybytesfrom()`", + "label": "`Buffer.copyBytesFrom()`", + "title": null, + "url": "#static-method-buffercopybytesfromview-offset-length", + "position": { + "start": { "line": 5512, "column": 1, "offset": 150105 }, + "end": { "line": 5512, "column": 81, "offset": 150185 } + } + }, + { + "type": "definition", + "identifier": "`buffer.from(array)`", + "label": "`Buffer.from(array)`", + "title": null, + "url": "#static-method-bufferfromarray", + "position": { + "start": { "line": 5513, "column": 1, "offset": 150186 }, + "end": { "line": 5513, "column": 55, "offset": 150240 } + } + }, + { + "type": "definition", + "identifier": "`buffer.from(arraybuf)`", + "label": "`Buffer.from(arrayBuf)`", + "title": null, + "url": "#static-method-bufferfromarraybuffer-byteoffset-length", + "position": { + "start": { "line": 5514, "column": 1, "offset": 150241 }, + "end": { "line": 5514, "column": 82, "offset": 150322 } + } + }, + { + "type": "definition", + "identifier": "`buffer.from(buffer)`", + "label": "`Buffer.from(buffer)`", + "title": null, + "url": "#static-method-bufferfrombuffer", + "position": { + "start": { "line": 5515, "column": 1, "offset": 150323 }, + "end": { "line": 5515, "column": 57, "offset": 150379 } + } + }, + { + "type": "definition", + "identifier": "`buffer.from(string)`", + "label": "`Buffer.from(string)`", + "title": null, + "url": "#static-method-bufferfromstring-encoding", + "position": { + "start": { "line": 5516, "column": 1, "offset": 150380 }, + "end": { "line": 5516, "column": 66, "offset": 150445 } + } + }, + { + "type": "definition", + "identifier": "`buffer.poolsize`", + "label": "`Buffer.poolSize`", + "title": null, + "url": "#class-property-bufferpoolsize", + "position": { + "start": { "line": 5517, "column": 1, "offset": 150446 }, + "end": { "line": 5517, "column": 52, "offset": 150497 } + } + }, + { + "type": "definition", + "identifier": "`err_invalid_buffer_size`", + "label": "`ERR_INVALID_BUFFER_SIZE`", + "title": null, + "url": "errors.md#err_invalid_buffer_size", + "position": { + "start": { "line": 5518, "column": 1, "offset": 150498 }, + "end": { "line": 5518, "column": 63, "offset": 150560 } + } + }, + { + "type": "definition", + "identifier": "`err_out_of_range`", + "label": "`ERR_OUT_OF_RANGE`", + "title": null, + "url": "errors.md#err_out_of_range", + "position": { + "start": { "line": 5519, "column": 1, "offset": 150561 }, + "end": { "line": 5519, "column": 49, "offset": 150609 } + } + }, + { + "type": "definition", + "identifier": "`json.stringify()`", + "label": "`JSON.stringify()`", + "title": null, + "url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify", + "position": { + "start": { "line": 5520, "column": 1, "offset": 150610 }, + "end": { "line": 5520, "column": 118, "offset": 150727 } + } + }, + { + "type": "definition", + "identifier": "`string.prototype.indexof()`", + "label": "`String.prototype.indexOf()`", + "title": null, + "url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/indexOf", + "position": { + "start": { "line": 5521, "column": 1, "offset": 150728 }, + "end": { "line": 5521, "column": 128, "offset": 150855 } + } + }, + { + "type": "definition", + "identifier": "`string.prototype.lastindexof()`", + "label": "`String.prototype.lastIndexOf()`", + "title": null, + "url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/lastIndexOf", + "position": { + "start": { "line": 5522, "column": 1, "offset": 150856 }, + "end": { "line": 5522, "column": 136, "offset": 150991 } + } + }, + { + "type": "definition", + "identifier": "`string.prototype.length`", + "label": "`String.prototype.length`", + "title": null, + "url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length", + "position": { + "start": { "line": 5523, "column": 1, "offset": 150992 }, + "end": { "line": 5523, "column": 124, "offset": 151115 } + } + }, + { + "type": "definition", + "identifier": "`typedarray.from()`", + "label": "`TypedArray.from()`", + "title": null, + "url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/from", + "position": { + "start": { "line": 5524, "column": 1, "offset": 151116 }, + "end": { "line": 5524, "column": 120, "offset": 151235 } + } + }, + { + "type": "definition", + "identifier": "`typedarray.prototype.set()`", + "label": "`TypedArray.prototype.set()`", + "title": null, + "url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/set", + "position": { + "start": { "line": 5525, "column": 1, "offset": 151236 }, + "end": { "line": 5525, "column": 128, "offset": 151363 } + } + }, + { + "type": "definition", + "identifier": "`typedarray.prototype.slice()`", + "label": "`TypedArray.prototype.slice()`", + "title": null, + "url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/slice", + "position": { + "start": { "line": 5526, "column": 1, "offset": 151364 }, + "end": { "line": 5526, "column": 132, "offset": 151495 } + } + }, + { + "type": "definition", + "identifier": "`typedarray.prototype.subarray()`", + "label": "`TypedArray.prototype.subarray()`", + "title": null, + "url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/subarray", + "position": { + "start": { "line": 5527, "column": 1, "offset": 151496 }, + "end": { "line": 5527, "column": 138, "offset": 151633 } + } + }, + { + "type": "definition", + "identifier": "`buf.buffer`", + "label": "`buf.buffer`", + "title": null, + "url": "#bufbuffer", + "position": { + "start": { "line": 5528, "column": 1, "offset": 151634 }, + "end": { "line": 5528, "column": 27, "offset": 151660 } + } + }, + { + "type": "definition", + "identifier": "`buf.compare()`", + "label": "`buf.compare()`", + "title": null, + "url": "#bufcomparetarget-targetstart-targetend-sourcestart-sourceend", + "position": { + "start": { "line": 5529, "column": 1, "offset": 151661 }, + "end": { "line": 5529, "column": 81, "offset": 151741 } + } + }, + { + "type": "definition", + "identifier": "`buf.entries()`", + "label": "`buf.entries()`", + "title": null, + "url": "#bufentries", + "position": { + "start": { "line": 5530, "column": 1, "offset": 151742 }, + "end": { "line": 5530, "column": 31, "offset": 151772 } + } + }, + { + "type": "definition", + "identifier": "`buf.fill()`", + "label": "`buf.fill()`", + "title": null, + "url": "#buffillvalue-offset-end-encoding", + "position": { + "start": { "line": 5531, "column": 1, "offset": 151773 }, + "end": { "line": 5531, "column": 50, "offset": 151822 } + } + }, + { + "type": "definition", + "identifier": "`buf.indexof()`", + "label": "`buf.indexOf()`", + "title": null, + "url": "#bufindexofvalue-byteoffset-encoding", + "position": { + "start": { "line": 5532, "column": 1, "offset": 151823 }, + "end": { "line": 5532, "column": 56, "offset": 151878 } + } + }, + { + "type": "definition", + "identifier": "`buf.keys()`", + "label": "`buf.keys()`", + "title": null, + "url": "#bufkeys", + "position": { + "start": { "line": 5533, "column": 1, "offset": 151879 }, + "end": { "line": 5533, "column": 25, "offset": 151903 } + } + }, + { + "type": "definition", + "identifier": "`buf.length`", + "label": "`buf.length`", + "title": null, + "url": "#buflength", + "position": { + "start": { "line": 5534, "column": 1, "offset": 151904 }, + "end": { "line": 5534, "column": 27, "offset": 151930 } + } + }, + { + "type": "definition", + "identifier": "`buf.slice()`", + "label": "`buf.slice()`", + "title": null, + "url": "#bufslicestart-end", + "position": { + "start": { "line": 5535, "column": 1, "offset": 151931 }, + "end": { "line": 5535, "column": 36, "offset": 151966 } + } + }, + { + "type": "definition", + "identifier": "`buf.subarray`", + "label": "`buf.subarray`", + "title": null, + "url": "#bufsubarraystart-end", + "position": { + "start": { "line": 5536, "column": 1, "offset": 151967 }, + "end": { "line": 5536, "column": 40, "offset": 152006 } + } + }, + { + "type": "definition", + "identifier": "`buf.tostring()`", + "label": "`buf.toString()`", + "title": null, + "url": "#buftostringencoding-start-end", + "position": { + "start": { "line": 5537, "column": 1, "offset": 152007 }, + "end": { "line": 5537, "column": 51, "offset": 152057 } + } + }, + { + "type": "definition", + "identifier": "`buf.values()`", + "label": "`buf.values()`", + "title": null, + "url": "#bufvalues", + "position": { + "start": { "line": 5538, "column": 1, "offset": 152058 }, + "end": { "line": 5538, "column": 29, "offset": 152086 } + } + }, + { + "type": "definition", + "identifier": "`buffer.constants.max_length`", + "label": "`buffer.constants.MAX_LENGTH`", + "title": null, + "url": "#bufferconstantsmax_length", + "position": { + "start": { "line": 5539, "column": 1, "offset": 152087 }, + "end": { "line": 5539, "column": 60, "offset": 152146 } + } + }, + { + "type": "definition", + "identifier": "`buffer.constants.max_string_length`", + "label": "`buffer.constants.MAX_STRING_LENGTH`", + "title": null, + "url": "#bufferconstantsmax_string_length", + "position": { + "start": { "line": 5540, "column": 1, "offset": 152147 }, + "end": { "line": 5540, "column": 74, "offset": 152220 } + } + }, + { + "type": "definition", + "identifier": "`buffer.kmaxlength`", + "label": "`buffer.kMaxLength`", + "title": null, + "url": "#bufferkmaxlength", + "position": { + "start": { "line": 5541, "column": 1, "offset": 152221 }, + "end": { "line": 5541, "column": 41, "offset": 152261 } + } + }, + { + "type": "definition", + "identifier": "`util.inspect()`", + "label": "`util.inspect()`", + "title": null, + "url": "util.md#utilinspectobject-options", + "position": { + "start": { "line": 5542, "column": 1, "offset": 152262 }, + "end": { "line": 5542, "column": 54, "offset": 152315 } + } + }, + { + "type": "definition", + "identifier": "`v8::typedarray::kmaxlength`", + "label": "`v8::TypedArray::kMaxLength`", + "title": null, + "url": "https://v8.github.io/api/head/classv8_1_1TypedArray.html#a54a48f4373da0850663c4393d843b9b0", + "position": { + "start": { "line": 5543, "column": 1, "offset": 152316 }, + "end": { "line": 5543, "column": 123, "offset": 152438 } + } + }, + { + "type": "definition", + "identifier": "base64url", + "label": "base64url", + "title": null, + "url": "https://tools.ietf.org/html/rfc4648#section-5", + "position": { + "start": { "line": 5544, "column": 1, "offset": 152439 }, + "end": { "line": 5544, "column": 59, "offset": 152497 } + } + }, + { + "type": "definition", + "identifier": "endianness", + "label": "endianness", + "title": null, + "url": "https://en.wikipedia.org/wiki/Endianness", + "position": { + "start": { "line": 5545, "column": 1, "offset": 152498 }, + "end": { "line": 5545, "column": 55, "offset": 152552 } + } + }, + { + "type": "definition", + "identifier": "iterator", + "label": "iterator", + "title": null, + "url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols", + "position": { + "start": { "line": 5546, "column": 1, "offset": 152553 }, + "end": { "line": 5546, "column": 98, "offset": 152650 } + } + } + ], + "position": { + "start": { "line": 1, "column": 1, "offset": 0 }, + "end": { "line": 5547, "column": 1, "offset": 152651 } + } +} diff --git a/src/linter/tests/fixtures/descriptors.mjs b/src/linter/tests/fixtures/descriptors.mjs index eb38bf0f..c67a3c75 100644 --- a/src/linter/tests/fixtures/descriptors.mjs +++ b/src/linter/tests/fixtures/descriptors.mjs @@ -4,6 +4,7 @@ export const infoDescriptor = { level: 'info', message: 'This is a INFO issue', + position: { start: { line: 1, column: 1 }, end: { line: 1, column: 2 } }, }; /** diff --git a/src/linter/tests/fixtures/issues.mjs b/src/linter/tests/fixtures/issues.mjs index b52678ba..d3c6f94d 100644 --- a/src/linter/tests/fixtures/issues.mjs +++ b/src/linter/tests/fixtures/issues.mjs @@ -5,6 +5,7 @@ export const infoIssue = { level: 'info', location: { path: 'doc/api/test.md', + position: { start: { line: 1, column: 1 }, end: { line: 1, column: 2 } }, }, message: 'This is a INFO issue', }; diff --git a/src/linter/tests/reporters/github.test.mjs b/src/linter/tests/reporters/github.test.mjs index 94c92712..5de47858 100644 --- a/src/linter/tests/reporters/github.test.mjs +++ b/src/linter/tests/reporters/github.test.mjs @@ -18,7 +18,7 @@ describe('github', () => { ); assert.deepStrictEqual(callsArgs, [ - '::notice file=doc/api/test.md::This is a INFO issue', + '::notice file=doc/api/test.md,line=1,endLine=1::This is a INFO issue', '::warning file=doc/api/test.md,line=1,endLine=1::This is a WARN issue', '::error file=doc/api/test.md,line=1,endLine=1::This is a ERROR issue', ]); From 4e402896e352d75b6afda541c6a0756ebbbe0d6e Mon Sep 17 00:00:00 2001 From: avivkeller Date: Tue, 20 May 2025 19:07:49 -0400 Subject: [PATCH 09/17] duplicate-stability-nodes --- .../rules/duplicate-stability-nodes.mjs | 70 ++++-- src/linter/rules/index.mjs | 4 +- .../rules/duplicate-stability-nodes.test.mjs | 236 +++++++++++------- 3 files changed, 191 insertions(+), 119 deletions(-) diff --git a/src/linter/rules/duplicate-stability-nodes.mjs b/src/linter/rules/duplicate-stability-nodes.mjs index 0f7a164a..cd5081ed 100644 --- a/src/linter/rules/duplicate-stability-nodes.mjs +++ b/src/linter/rules/duplicate-stability-nodes.mjs @@ -1,38 +1,62 @@ +import createQueries from '../../utils/queries/index.mjs'; import { LINT_MESSAGES } from '../constants.mjs'; +import { visit } from 'unist-util-visit'; /** * Checks if there are multiple stability nodes within a chain. * - * @param {ApiDocMetadataEntry[]} entries - * @returns {Array} + * @param {import('../types.d.ts').LintContext} context + * @returns {void} */ -export const duplicateStabilityNodes = entries => { +export const duplicateStabilityNodes = context => { const issues = []; let currentDepth = 0; let currentStability = -1; + let currentHeaderDepth = 0; - for (const entry of entries) { - const { depth } = entry.heading.data; - const entryStability = entry.stability.children[0]?.data.index ?? -1; + visit(context.tree, node => { + // Track the current header depth + if (node.type === 'heading') { + currentHeaderDepth = node.depth; + } + + // Process blockquotes to find stability nodes + if (node.type === 'blockquote') { + if (node.children && node.children.length > 0) { + const paragraph = node.children[0]; + if ( + paragraph.type === 'paragraph' && + paragraph.children && + paragraph.children.length > 0 + ) { + const text = paragraph.children[0]; + if (text.type === 'text') { + const match = text.value.match( + createQueries.QUERIES.stabilityIndex + ); + if (match) { + const stability = parseFloat(match[1]); - if ( - depth > currentDepth && - entryStability >= 0 && - entryStability === currentStability - ) { - issues.push({ - level: 'warn', - message: LINT_MESSAGES.duplicateStabilityNode, - location: { - path: entry.api_doc_source, - position: entry.stability.children[0].children[0].position, - }, - }); - } else { - currentDepth = depth; - currentStability = entryStability; + if ( + currentHeaderDepth > currentDepth && + stability >= 0 && + stability === currentStability + ) { + issues.push({ + level: 'warn', + message: LINT_MESSAGES.duplicateStabilityNode, + position: node.position, + }); + } else { + currentDepth = currentHeaderDepth; + currentStability = stability; + } + } + } + } + } } - } + }); return issues; }; diff --git a/src/linter/rules/index.mjs b/src/linter/rules/index.mjs index 226e912c..bb06a4a5 100644 --- a/src/linter/rules/index.mjs +++ b/src/linter/rules/index.mjs @@ -1,6 +1,6 @@ 'use strict'; -// import { duplicateStabilityNodes } from './duplicate-stability-nodes.mjs'; +import { duplicateStabilityNodes } from './duplicate-stability-nodes.mjs'; import { invalidChangeVersion } from './invalid-change-version.mjs'; import { missingIntroducedIn } from './missing-introduced-in.mjs'; import { missingLlmDescription } from './missing-llm-description.mjs'; @@ -9,7 +9,7 @@ import { missingLlmDescription } from './missing-llm-description.mjs'; * @type {Record} */ export default { - // 'duplicate-stability-nodes': duplicateStabilityNodes, + 'duplicate-stability-nodes': duplicateStabilityNodes, 'invalid-change-version': invalidChangeVersion, 'missing-introduced-in': missingIntroducedIn, 'missing-llm-description': missingLlmDescription, diff --git a/src/linter/tests/rules/duplicate-stability-nodes.test.mjs b/src/linter/tests/rules/duplicate-stability-nodes.test.mjs index 7c3c700d..b8e47c26 100644 --- a/src/linter/tests/rules/duplicate-stability-nodes.test.mjs +++ b/src/linter/tests/rules/duplicate-stability-nodes.test.mjs @@ -1,156 +1,204 @@ import { describe, it } from 'node:test'; -import { deepStrictEqual } from 'assert'; +import { deepStrictEqual } from 'node:assert'; import { duplicateStabilityNodes } from '../../rules/duplicate-stability-nodes.mjs'; import { LINT_MESSAGES } from '../../constants.mjs'; // Mock data structure for creating test entries -const createEntry = ( +const createStabilityNode = (value, line = 1, column = 1) => ({ + type: 'blockquote', + children: [ + { + type: 'paragraph', + children: [ + { + type: 'text', + value: `Stability: ${value}`, + }, + ], + }, + ], + position: { + start: { line, column }, + end: { line, column: column + 20 }, + }, +}); + +const createHeadingNode = (depth, line = 1, column = 1) => ({ + type: 'heading', depth, - stabilityIndex, - source = 'file.yaml', - position = { line: 1, column: 1 } -) => ({ - heading: { data: { depth } }, - stability: { - children: [{ data: { index: stabilityIndex }, children: [{ position }] }], + children: [ + { + type: 'text', + value: `Heading ${depth}`, + }, + ], + position: { + start: { line, column }, + end: { line, column: column + 10 }, + }, +}); + +const createContext = (nodes, path = 'file.md') => ({ + tree: { + type: 'root', + children: nodes, }, - api_doc_source: source, + path, }); describe('duplicateStabilityNodes', () => { - it('returns empty array when there are no entries', () => { - deepStrictEqual(duplicateStabilityNodes([]), []); + it('returns empty array when there are no stability nodes', () => { + const context = createContext([ + createHeadingNode(1, 1), + createHeadingNode(2, 2), + ]); + deepStrictEqual(duplicateStabilityNodes(context), []); }); it('returns empty array when there are no duplicate stability nodes', () => { - const entries = [createEntry(1, 0), createEntry(2, 1), createEntry(3, 2)]; - deepStrictEqual(duplicateStabilityNodes(entries), []); + const context = createContext([ + createHeadingNode(1, 1), + createStabilityNode(0, 2), + createHeadingNode(2, 3), + createStabilityNode(1, 4), + createHeadingNode(3, 5), + createStabilityNode(2, 6), + ]); + deepStrictEqual(duplicateStabilityNodes(context), []); }); it('detects duplicate stability nodes within a chain', () => { - const entries = [ - createEntry(1, 0), - createEntry(2, 0), // Duplicate stability node - ]; + const duplicateNode = createStabilityNode(0, 4); + const context = createContext([ + createHeadingNode(1, 1), + createStabilityNode(0, 2), + createHeadingNode(2, 3), + duplicateNode, // Duplicate stability node + ]); - deepStrictEqual(duplicateStabilityNodes(entries), [ + deepStrictEqual(duplicateStabilityNodes(context), [ { level: 'warn', message: LINT_MESSAGES.duplicateStabilityNode, - location: { - path: 'file.yaml', - position: { line: 1, column: 1 }, - }, + position: duplicateNode.position, }, ]); }); it('resets stability tracking when depth decreases', () => { - const entries = [ - createEntry(1, 0), - createEntry(2, 0), // This should trigger an issue - createEntry(1, 1), - createEntry(2, 1), // This should trigger another issue - ]; + const duplicateNode1 = createStabilityNode(0, 4); + const duplicateNode2 = createStabilityNode(1, 8); + const context = createContext([ + createHeadingNode(1, 1), + createStabilityNode(0, 2), + createHeadingNode(2, 3), + duplicateNode1, // This should trigger an issue + createHeadingNode(1, 5), + createStabilityNode(1, 6), + createHeadingNode(2, 7), + duplicateNode2, // This should trigger another issue + ]); - deepStrictEqual(duplicateStabilityNodes(entries), [ + deepStrictEqual(duplicateStabilityNodes(context), [ { level: 'warn', message: LINT_MESSAGES.duplicateStabilityNode, - location: { - path: 'file.yaml', - position: { line: 1, column: 1 }, - }, + position: duplicateNode1.position, }, { level: 'warn', message: LINT_MESSAGES.duplicateStabilityNode, - location: { - path: 'file.yaml', - position: { line: 1, column: 1 }, - }, + position: duplicateNode2.position, }, ]); }); it('handles missing stability nodes gracefully', () => { - const entries = [ - createEntry(1, -1), - createEntry(2, -1), - createEntry(3, 0), - createEntry(4, 0), // This should trigger an issue - ]; - - deepStrictEqual(duplicateStabilityNodes(entries), [ + const duplicateNode = createStabilityNode(0, 6); + const context = createContext([ + createHeadingNode(1, 1), { - level: 'warn', - message: LINT_MESSAGES.duplicateStabilityNode, - location: { - path: 'file.yaml', - position: { line: 1, column: 1 }, - }, + type: 'blockquote', + children: [ + { + type: 'paragraph', + children: [{ type: 'text', value: 'Not a stability node' }], + }, + ], + position: { start: { line: 2 }, end: { line: 2 } }, }, + createHeadingNode(3, 3), + createStabilityNode(0, 4), + createHeadingNode(4, 5), + duplicateNode, // This should trigger an issue ]); - }); - it('handles entries with no stability property gracefully', () => { - const entries = [ - { - heading: { data: { depth: 1 } }, - stability: { children: [] }, - api_doc_source: 'file.yaml', - yaml_position: { line: 2, column: 5 }, - }, - createEntry(2, 0), - ]; - deepStrictEqual(duplicateStabilityNodes(entries), []); - }); - - it('handles entries with undefined stability index', () => { - const entries = [ - createEntry(1, undefined), - createEntry(2, undefined), - createEntry(3, 1), - createEntry(4, 1), // This should trigger an issue - ]; - deepStrictEqual(duplicateStabilityNodes(entries), [ + deepStrictEqual(duplicateStabilityNodes(context), [ { level: 'warn', message: LINT_MESSAGES.duplicateStabilityNode, - location: { - path: 'file.yaml', - position: { line: 1, column: 1 }, - }, + position: duplicateNode.position, }, ]); }); it('handles mixed depths and stability nodes correctly', () => { - const entries = [ - createEntry(1, 0), - createEntry(2, 1), - createEntry(3, 1), // This should trigger an issue - createEntry(2, 2), - createEntry(3, 2), // This should trigger another issue - ]; + const duplicateNode1 = createStabilityNode(1, 6); + const duplicateNode2 = createStabilityNode(2, 10); + const context = createContext([ + createHeadingNode(1, 1), + createStabilityNode(0, 2), + createHeadingNode(2, 3), + createStabilityNode(1, 4), + createHeadingNode(3, 5), + duplicateNode1, // This should trigger an issue + createHeadingNode(2, 7), + createStabilityNode(2, 8), + createHeadingNode(3, 9), + duplicateNode2, // This should trigger another issue + ]); - deepStrictEqual(duplicateStabilityNodes(entries), [ + deepStrictEqual(duplicateStabilityNodes(context), [ { level: 'warn', message: LINT_MESSAGES.duplicateStabilityNode, - location: { - path: 'file.yaml', - position: { line: 1, column: 1 }, - }, + position: duplicateNode1.position, }, { level: 'warn', message: LINT_MESSAGES.duplicateStabilityNode, - location: { - path: 'file.yaml', - position: { line: 1, column: 1 }, - }, + position: duplicateNode2.position, + }, + ]); + }); + + it('handles malformed blockquotes gracefully', () => { + const context = createContext([ + createHeadingNode(1, 1), + { + type: 'blockquote', + children: [], // Empty children array + position: { start: { line: 2 }, end: { line: 2 } }, + }, + createHeadingNode(2, 3), + { + type: 'blockquote', + children: [{ type: 'thematicBreak' }], // No paragraph + position: { start: { line: 4 }, end: { line: 4 } }, + }, + createHeadingNode(3, 5), + { + type: 'blockquote', + children: [ + { + type: 'paragraph', + children: [], // No text node + }, + ], + position: { start: { line: 6 }, end: { line: 6 } }, }, ]); + + deepStrictEqual(duplicateStabilityNodes(context), []); }); }); From 2d66ff32005e80ff3e0074f9707c8b5caaca3b32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guilherme=20Ara=C3=BAjo?= Date: Tue, 20 May 2025 21:58:27 -0300 Subject: [PATCH 10/17] fix: use context report --- .../rules/duplicate-stability-nodes.mjs | 7 ++- .../rules/duplicate-stability-nodes.test.mjs | 51 +++++++++++++++---- 2 files changed, 43 insertions(+), 15 deletions(-) diff --git a/src/linter/rules/duplicate-stability-nodes.mjs b/src/linter/rules/duplicate-stability-nodes.mjs index cd5081ed..c49688cb 100644 --- a/src/linter/rules/duplicate-stability-nodes.mjs +++ b/src/linter/rules/duplicate-stability-nodes.mjs @@ -1,3 +1,5 @@ +// @ts-check + import createQueries from '../../utils/queries/index.mjs'; import { LINT_MESSAGES } from '../constants.mjs'; import { visit } from 'unist-util-visit'; @@ -9,7 +11,6 @@ import { visit } from 'unist-util-visit'; * @returns {void} */ export const duplicateStabilityNodes = context => { - const issues = []; let currentDepth = 0; let currentStability = -1; let currentHeaderDepth = 0; @@ -42,7 +43,7 @@ export const duplicateStabilityNodes = context => { stability >= 0 && stability === currentStability ) { - issues.push({ + context.report({ level: 'warn', message: LINT_MESSAGES.duplicateStabilityNode, position: node.position, @@ -57,6 +58,4 @@ export const duplicateStabilityNodes = context => { } } }); - - return issues; }; diff --git a/src/linter/tests/rules/duplicate-stability-nodes.test.mjs b/src/linter/tests/rules/duplicate-stability-nodes.test.mjs index b8e47c26..dc7ebe90 100644 --- a/src/linter/tests/rules/duplicate-stability-nodes.test.mjs +++ b/src/linter/tests/rules/duplicate-stability-nodes.test.mjs @@ -1,5 +1,5 @@ -import { describe, it } from 'node:test'; -import { deepStrictEqual } from 'node:assert'; +import { describe, it, mock } from 'node:test'; +import { deepStrictEqual, strictEqual } from 'node:assert'; import { duplicateStabilityNodes } from '../../rules/duplicate-stability-nodes.mjs'; import { LINT_MESSAGES } from '../../constants.mjs'; @@ -44,18 +44,20 @@ const createContext = (nodes, path = 'file.md') => ({ children: nodes, }, path, + report: mock.fn(), }); describe('duplicateStabilityNodes', () => { - it('returns empty array when there are no stability nodes', () => { + it('should not report when there are no stability nodes', () => { const context = createContext([ createHeadingNode(1, 1), createHeadingNode(2, 2), ]); - deepStrictEqual(duplicateStabilityNodes(context), []); + duplicateStabilityNodes(context); + strictEqual(context.report.mock.callCount(), 0); }); - it('returns empty array when there are no duplicate stability nodes', () => { + it('should not report when there are no duplicate stability nodes', () => { const context = createContext([ createHeadingNode(1, 1), createStabilityNode(0, 2), @@ -64,7 +66,8 @@ describe('duplicateStabilityNodes', () => { createHeadingNode(3, 5), createStabilityNode(2, 6), ]); - deepStrictEqual(duplicateStabilityNodes(context), []); + duplicateStabilityNodes(context); + strictEqual(context.report.mock.callCount(), 0); }); it('detects duplicate stability nodes within a chain', () => { @@ -76,7 +79,13 @@ describe('duplicateStabilityNodes', () => { duplicateNode, // Duplicate stability node ]); - deepStrictEqual(duplicateStabilityNodes(context), [ + duplicateStabilityNodes(context); + + strictEqual(context.report.mock.callCount(), 1); + + const call = context.report.mock.calls[0]; + + deepStrictEqual(call.arguments, [ { level: 'warn', message: LINT_MESSAGES.duplicateStabilityNode, @@ -99,7 +108,13 @@ describe('duplicateStabilityNodes', () => { duplicateNode2, // This should trigger another issue ]); - deepStrictEqual(duplicateStabilityNodes(context), [ + duplicateStabilityNodes(context); + + strictEqual(context.report.mock.callCount(), 2); + + const calls = context.report.mock.calls.flatMap(call => call.arguments); + + deepStrictEqual(calls, [ { level: 'warn', message: LINT_MESSAGES.duplicateStabilityNode, @@ -133,7 +148,13 @@ describe('duplicateStabilityNodes', () => { duplicateNode, // This should trigger an issue ]); - deepStrictEqual(duplicateStabilityNodes(context), [ + duplicateStabilityNodes(context); + + strictEqual(context.report.mock.callCount(), 1); + + const call = context.report.mock.calls[0]; + + deepStrictEqual(call.arguments, [ { level: 'warn', message: LINT_MESSAGES.duplicateStabilityNode, @@ -158,7 +179,13 @@ describe('duplicateStabilityNodes', () => { duplicateNode2, // This should trigger another issue ]); - deepStrictEqual(duplicateStabilityNodes(context), [ + duplicateStabilityNodes(context); + + strictEqual(context.report.mock.callCount(), 2); + + const calls = context.report.mock.calls.flatMap(call => call.arguments); + + deepStrictEqual(calls, [ { level: 'warn', message: LINT_MESSAGES.duplicateStabilityNode, @@ -199,6 +226,8 @@ describe('duplicateStabilityNodes', () => { }, ]); - deepStrictEqual(duplicateStabilityNodes(context), []); + duplicateStabilityNodes(context); + + strictEqual(context.report.mock.callCount(), 0); }); }); From 63a838a73930746b66de5395e6857529196dfe47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guilherme=20Ara=C3=BAjo?= Date: Tue, 20 May 2025 21:58:48 -0300 Subject: [PATCH 11/17] chore: delete ast.json --- ast.json | 42842 ----------------------------------------------------- 1 file changed, 42842 deletions(-) delete mode 100644 ast.json diff --git a/ast.json b/ast.json deleted file mode 100644 index a44ef8d4..00000000 --- a/ast.json +++ /dev/null @@ -1,42842 +0,0 @@ -{ - "type": "root", - "children": [ - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "Buffer", - "position": { - "start": { "line": 1, "column": 3, "offset": 2 }, - "end": { "line": 1, "column": 9, "offset": 8 } - } - } - ], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 1, "column": 9, "offset": 8 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 3, "column": 1, "offset": 10 }, - "end": { "line": 3, "column": 29, "offset": 38 } - } - }, - { - "type": "blockquote", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "link", - "title": null, - "url": "documentation.html#stability-index", - "children": [ - { - "type": "text", - "value": "Stability: 2", - "position": { - "start": { "line": 5, "column": 4, "offset": 43 }, - "end": { "line": 5, "column": 16, "offset": 55 } - } - } - ], - "position": { - "start": { "line": 5, "column": 3, "offset": 42 }, - "end": { "line": 5, "column": 53, "offset": 92 } - } - }, - { - "type": "text", - "value": " - Stable", - "position": { - "start": { "line": 5, "column": 53, "offset": 92 }, - "end": { "line": 5, "column": 62, "offset": 101 } - } - } - ], - "position": { - "start": { "line": 5, "column": 3, "offset": 42 }, - "end": { "line": 5, "column": 62, "offset": 101 } - } - } - ], - "position": { - "start": { "line": 5, "column": 1, "offset": 40 }, - "end": { "line": 5, "column": 62, "offset": 101 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 7, "column": 1, "offset": 103 }, - "end": { "line": 7, "column": 35, "offset": 137 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 9, "column": 1, "offset": 139 }, - "end": { "line": 9, "column": 9, "offset": 147 } - } - }, - { - "type": "text", - "value": " objects are used to represent a fixed-length sequence of bytes. Many\nNode.js APIs support ", - "position": { - "start": { "line": 9, "column": 9, "offset": 147 }, - "end": { "line": 10, "column": 22, "offset": 238 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 10, "column": 22, "offset": 238 }, - "end": { "line": 10, "column": 30, "offset": 246 } - } - }, - { - "type": "text", - "value": "s.", - "position": { - "start": { "line": 10, "column": 30, "offset": 246 }, - "end": { "line": 10, "column": 32, "offset": 248 } - } - } - ], - "position": { - "start": { "line": 9, "column": 1, "offset": 139 }, - "end": { "line": 10, "column": 32, "offset": 248 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The ", - "position": { - "start": { "line": 12, "column": 1, "offset": 250 }, - "end": { "line": 12, "column": 5, "offset": 254 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 12, "column": 5, "offset": 254 }, - "end": { "line": 12, "column": 13, "offset": 262 } - } - }, - { - "type": "text", - "value": " class is a subclass of JavaScript's {Uint8Array} class and\nextends it with methods that cover additional use cases. Node.js APIs accept\nplain {Uint8Array}s wherever ", - "position": { - "start": { "line": 12, "column": 13, "offset": 262 }, - "end": { "line": 14, "column": 30, "offset": 428 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 14, "column": 30, "offset": 428 }, - "end": { "line": 14, "column": 38, "offset": 436 } - } - }, - { - "type": "text", - "value": "s are supported as well.", - "position": { - "start": { "line": 14, "column": 38, "offset": 436 }, - "end": { "line": 14, "column": 62, "offset": 460 } - } - } - ], - "position": { - "start": { "line": 12, "column": 1, "offset": 250 }, - "end": { "line": 14, "column": 62, "offset": 460 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "While the ", - "position": { - "start": { "line": 16, "column": 1, "offset": 462 }, - "end": { "line": 16, "column": 11, "offset": 472 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 16, "column": 11, "offset": 472 }, - "end": { "line": 16, "column": 19, "offset": 480 } - } - }, - { - "type": "text", - "value": " class is available within the global scope, it is still\nrecommended to explicitly reference it via an import or require statement.", - "position": { - "start": { "line": 16, "column": 19, "offset": 480 }, - "end": { "line": 17, "column": 75, "offset": 611 } - } - } - ], - "position": { - "start": { "line": 16, "column": 1, "offset": 462 }, - "end": { "line": 17, "column": 75, "offset": 611 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\n// Creates a zero-filled Buffer of length 10.\nconst buf1 = Buffer.alloc(10);\n\n// Creates a Buffer of length 10,\n// filled with bytes which all have the value `1`.\nconst buf2 = Buffer.alloc(10, 1);\n\n// Creates an uninitialized buffer of length 10.\n// This is faster than calling Buffer.alloc() but the returned\n// Buffer instance might contain old data that needs to be\n// overwritten using fill(), write(), or other functions that fill the Buffer's\n// contents.\nconst buf3 = Buffer.allocUnsafe(10);\n\n// Creates a Buffer containing the bytes [1, 2, 3].\nconst buf4 = Buffer.from([1, 2, 3]);\n\n// Creates a Buffer containing the bytes [1, 1, 1, 1] – the entries\n// are all truncated using `(value & 255)` to fit into the range 0–255.\nconst buf5 = Buffer.from([257, 257.5, -255, '1']);\n\n// Creates a Buffer containing the UTF-8-encoded bytes for the string 'tést':\n// [0x74, 0xc3, 0xa9, 0x73, 0x74] (in hexadecimal notation)\n// [116, 195, 169, 115, 116] (in decimal notation)\nconst buf6 = Buffer.from('tést');\n\n// Creates a Buffer containing the Latin-1 bytes [0x74, 0xe9, 0x73, 0x74].\nconst buf7 = Buffer.from('tést', 'latin1');", - "position": { - "start": { "line": 19, "column": 1, "offset": 613 }, - "end": { "line": 50, "column": 4, "offset": 1787 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\n// Creates a zero-filled Buffer of length 10.\nconst buf1 = Buffer.alloc(10);\n\n// Creates a Buffer of length 10,\n// filled with bytes which all have the value `1`.\nconst buf2 = Buffer.alloc(10, 1);\n\n// Creates an uninitialized buffer of length 10.\n// This is faster than calling Buffer.alloc() but the returned\n// Buffer instance might contain old data that needs to be\n// overwritten using fill(), write(), or other functions that fill the Buffer's\n// contents.\nconst buf3 = Buffer.allocUnsafe(10);\n\n// Creates a Buffer containing the bytes [1, 2, 3].\nconst buf4 = Buffer.from([1, 2, 3]);\n\n// Creates a Buffer containing the bytes [1, 1, 1, 1] – the entries\n// are all truncated using `(value & 255)` to fit into the range 0–255.\nconst buf5 = Buffer.from([257, 257.5, -255, '1']);\n\n// Creates a Buffer containing the UTF-8-encoded bytes for the string 'tést':\n// [0x74, 0xc3, 0xa9, 0x73, 0x74] (in hexadecimal notation)\n// [116, 195, 169, 115, 116] (in decimal notation)\nconst buf6 = Buffer.from('tést');\n\n// Creates a Buffer containing the Latin-1 bytes [0x74, 0xe9, 0x73, 0x74].\nconst buf7 = Buffer.from('tést', 'latin1');", - "position": { - "start": { "line": 52, "column": 1, "offset": 1789 }, - "end": { "line": 83, "column": 4, "offset": 2968 } - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "Buffers and character encodings", - "position": { - "start": { "line": 85, "column": 4, "offset": 2973 }, - "end": { "line": 85, "column": 35, "offset": 3004 } - } - } - ], - "position": { - "start": { "line": 85, "column": 1, "offset": 2970 }, - "end": { "line": 85, "column": 35, "offset": 3004 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 87, "column": 1, "offset": 3006 }, - "end": { "line": 100, "column": 4, "offset": 3455 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "When converting between ", - "position": { - "start": { "line": 102, "column": 1, "offset": 3457 }, - "end": { "line": 102, "column": 25, "offset": 3481 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 102, "column": 25, "offset": 3481 }, - "end": { "line": 102, "column": 33, "offset": 3489 } - } - }, - { - "type": "text", - "value": "s and strings, a character encoding may be\nspecified. If no character encoding is specified, UTF-8 will be used as the\ndefault.", - "position": { - "start": { "line": 102, "column": 33, "offset": 3489 }, - "end": { "line": 104, "column": 9, "offset": 3616 } - } - } - ], - "position": { - "start": { "line": 102, "column": 1, "offset": 3457 }, - "end": { "line": 104, "column": 9, "offset": 3616 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from('hello world', 'utf8');\n\nconsole.log(buf.toString('hex'));\n// Prints: 68656c6c6f20776f726c64\nconsole.log(buf.toString('base64'));\n// Prints: aGVsbG8gd29ybGQ=\n\nconsole.log(Buffer.from('fhqwhgads', 'utf8'));\n// Prints: \nconsole.log(Buffer.from('fhqwhgads', 'utf16le'));\n// Prints: ", - "position": { - "start": { "line": 106, "column": 1, "offset": 3618 }, - "end": { "line": 120, "column": 4, "offset": 4068 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from('hello world', 'utf8');\n\nconsole.log(buf.toString('hex'));\n// Prints: 68656c6c6f20776f726c64\nconsole.log(buf.toString('base64'));\n// Prints: aGVsbG8gd29ybGQ=\n\nconsole.log(Buffer.from('fhqwhgads', 'utf8'));\n// Prints: \nconsole.log(Buffer.from('fhqwhgads', 'utf16le'));\n// Prints: ", - "position": { - "start": { "line": 122, "column": 1, "offset": 4070 }, - "end": { "line": 136, "column": 4, "offset": 4525 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Node.js buffers accept all case variations of encoding strings that they\nreceive. For example, UTF-8 can be specified as ", - "position": { - "start": { "line": 138, "column": 1, "offset": 4527 }, - "end": { "line": 139, "column": 49, "offset": 4648 } - } - }, - { - "type": "inlineCode", - "value": "'utf8'", - "position": { - "start": { "line": 139, "column": 49, "offset": 4648 }, - "end": { "line": 139, "column": 57, "offset": 4656 } - } - }, - { - "type": "text", - "value": ", ", - "position": { - "start": { "line": 139, "column": 57, "offset": 4656 }, - "end": { "line": 139, "column": 59, "offset": 4658 } - } - }, - { - "type": "inlineCode", - "value": "'UTF8'", - "position": { - "start": { "line": 139, "column": 59, "offset": 4658 }, - "end": { "line": 139, "column": 67, "offset": 4666 } - } - }, - { - "type": "text", - "value": ", or ", - "position": { - "start": { "line": 139, "column": 67, "offset": 4666 }, - "end": { "line": 139, "column": 72, "offset": 4671 } - } - }, - { - "type": "inlineCode", - "value": "'uTf8'", - "position": { - "start": { "line": 139, "column": 72, "offset": 4671 }, - "end": { "line": 139, "column": 80, "offset": 4679 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 139, "column": 80, "offset": 4679 }, - "end": { "line": 139, "column": 81, "offset": 4680 } - } - } - ], - "position": { - "start": { "line": 138, "column": 1, "offset": 4527 }, - "end": { "line": 139, "column": 81, "offset": 4680 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The character encodings currently supported by Node.js are the following:", - "position": { - "start": { "line": 141, "column": 1, "offset": 4682 }, - "end": { "line": 141, "column": 74, "offset": 4755 } - } - } - ], - "position": { - "start": { "line": 141, "column": 1, "offset": 4682 }, - "end": { "line": 141, "column": 74, "offset": 4755 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": true, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "'utf8'", - "position": { - "start": { "line": 143, "column": 3, "offset": 4759 }, - "end": { "line": 143, "column": 11, "offset": 4767 } - } - }, - { - "type": "text", - "value": " (alias: ", - "position": { - "start": { "line": 143, "column": 11, "offset": 4767 }, - "end": { "line": 143, "column": 20, "offset": 4776 } - } - }, - { - "type": "inlineCode", - "value": "'utf-8'", - "position": { - "start": { "line": 143, "column": 20, "offset": 4776 }, - "end": { "line": 143, "column": 29, "offset": 4785 } - } - }, - { - "type": "text", - "value": "): Multi-byte encoded Unicode characters. Many web\npages and other document formats use ", - "position": { - "start": { "line": 143, "column": 29, "offset": 4785 }, - "end": { "line": 144, "column": 40, "offset": 4875 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "text", - "value": "UTF-8", - "position": { - "start": { "line": 144, "column": 41, "offset": 4876 }, - "end": { "line": 144, "column": 46, "offset": 4881 } - } - } - ], - "position": { - "start": { "line": 144, "column": 40, "offset": 4875 }, - "end": { "line": 144, "column": 49, "offset": 4884 } - }, - "label": "UTF-8", - "identifier": "utf-8", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": ". This is the default character\nencoding. When decoding a ", - "position": { - "start": { "line": 144, "column": 49, "offset": 4884 }, - "end": { "line": 145, "column": 29, "offset": 4944 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 145, "column": 29, "offset": 4944 }, - "end": { "line": 145, "column": 37, "offset": 4952 } - } - }, - { - "type": "text", - "value": " into a string that does not exclusively\ncontain valid UTF-8 data, the Unicode replacement character ", - "position": { - "start": { "line": 145, "column": 37, "offset": 4952 }, - "end": { "line": 146, "column": 63, "offset": 5055 } - } - }, - { - "type": "inlineCode", - "value": "U+FFFD", - "position": { - "start": { "line": 146, "column": 63, "offset": 5055 }, - "end": { "line": 146, "column": 71, "offset": 5063 } - } - }, - { - "type": "text", - "value": " � will be\nused to represent those errors.", - "position": { - "start": { "line": 146, "column": 71, "offset": 5063 }, - "end": { "line": 147, "column": 34, "offset": 5107 } - } - } - ], - "position": { - "start": { "line": 143, "column": 3, "offset": 4759 }, - "end": { "line": 147, "column": 34, "offset": 5107 } - } - } - ], - "position": { - "start": { "line": 143, "column": 1, "offset": 4757 }, - "end": { "line": 147, "column": 34, "offset": 5107 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "'utf16le'", - "position": { - "start": { "line": 149, "column": 3, "offset": 5111 }, - "end": { "line": 149, "column": 14, "offset": 5122 } - } - }, - { - "type": "text", - "value": " (alias: ", - "position": { - "start": { "line": 149, "column": 14, "offset": 5122 }, - "end": { "line": 149, "column": 23, "offset": 5131 } - } - }, - { - "type": "inlineCode", - "value": "'utf-16le'", - "position": { - "start": { "line": 149, "column": 23, "offset": 5131 }, - "end": { "line": 149, "column": 35, "offset": 5143 } - } - }, - { - "type": "text", - "value": "): Multi-byte encoded Unicode characters.\nUnlike ", - "position": { - "start": { "line": 149, "column": 35, "offset": 5143 }, - "end": { "line": 150, "column": 10, "offset": 5194 } - } - }, - { - "type": "inlineCode", - "value": "'utf8'", - "position": { - "start": { "line": 150, "column": 10, "offset": 5194 }, - "end": { "line": 150, "column": 18, "offset": 5202 } - } - }, - { - "type": "text", - "value": ", each character in the string will be encoded using either 2\nor 4 bytes. Node.js only supports the ", - "position": { - "start": { "line": 150, "column": 18, "offset": 5202 }, - "end": { "line": 151, "column": 41, "offset": 5304 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "text", - "value": "little-endian", - "position": { - "start": { "line": 151, "column": 42, "offset": 5305 }, - "end": { "line": 151, "column": 55, "offset": 5318 } - } - } - ], - "position": { - "start": { "line": 151, "column": 41, "offset": 5304 }, - "end": { "line": 151, "column": 68, "offset": 5331 } - }, - "label": "endianness", - "identifier": "endianness", - "referenceType": "full" - }, - { - "type": "text", - "value": " variant of\n", - "position": { - "start": { "line": 151, "column": 68, "offset": 5331 }, - "end": { "line": 152, "column": 1, "offset": 5343 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "text", - "value": "UTF-16", - "position": { - "start": { "line": 152, "column": 4, "offset": 5346 }, - "end": { "line": 152, "column": 10, "offset": 5352 } - } - } - ], - "position": { - "start": { "line": 152, "column": 3, "offset": 5345 }, - "end": { "line": 152, "column": 13, "offset": 5355 } - }, - "label": "UTF-16", - "identifier": "utf-16", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 152, "column": 13, "offset": 5355 }, - "end": { "line": 152, "column": 14, "offset": 5356 } - } - } - ], - "position": { - "start": { "line": 149, "column": 3, "offset": 5111 }, - "end": { "line": 152, "column": 14, "offset": 5356 } - } - } - ], - "position": { - "start": { "line": 149, "column": 1, "offset": 5109 }, - "end": { "line": 152, "column": 14, "offset": 5356 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "'latin1'", - "position": { - "start": { "line": 154, "column": 3, "offset": 5360 }, - "end": { "line": 154, "column": 13, "offset": 5370 } - } - }, - { - "type": "text", - "value": ": Latin-1 stands for ", - "position": { - "start": { "line": 154, "column": 13, "offset": 5370 }, - "end": { "line": 154, "column": 34, "offset": 5391 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "text", - "value": "ISO-8859-1", - "position": { - "start": { "line": 154, "column": 35, "offset": 5392 }, - "end": { "line": 154, "column": 45, "offset": 5402 } - } - } - ], - "position": { - "start": { "line": 154, "column": 34, "offset": 5391 }, - "end": { "line": 154, "column": 48, "offset": 5405 } - }, - "label": "ISO-8859-1", - "identifier": "iso-8859-1", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": ". This character encoding only\nsupports the Unicode characters from ", - "position": { - "start": { "line": 154, "column": 48, "offset": 5405 }, - "end": { "line": 155, "column": 40, "offset": 5475 } - } - }, - { - "type": "inlineCode", - "value": "U+0000", - "position": { - "start": { "line": 155, "column": 40, "offset": 5475 }, - "end": { "line": 155, "column": 48, "offset": 5483 } - } - }, - { - "type": "text", - "value": " to ", - "position": { - "start": { "line": 155, "column": 48, "offset": 5483 }, - "end": { "line": 155, "column": 52, "offset": 5487 } - } - }, - { - "type": "inlineCode", - "value": "U+00FF", - "position": { - "start": { "line": 155, "column": 52, "offset": 5487 }, - "end": { "line": 155, "column": 60, "offset": 5495 } - } - }, - { - "type": "text", - "value": ". Each character is\nencoded using a single byte. Characters that do not fit into that range are\ntruncated and will be mapped to characters in that range.", - "position": { - "start": { "line": 155, "column": 60, "offset": 5495 }, - "end": { "line": 157, "column": 60, "offset": 5652 } - } - } - ], - "position": { - "start": { "line": 154, "column": 3, "offset": 5360 }, - "end": { "line": 157, "column": 60, "offset": 5652 } - } - } - ], - "position": { - "start": { "line": 154, "column": 1, "offset": 5358 }, - "end": { "line": 157, "column": 60, "offset": 5652 } - } - } - ], - "position": { - "start": { "line": 143, "column": 1, "offset": 4757 }, - "end": { "line": 157, "column": 60, "offset": 5652 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Converting a ", - "position": { - "start": { "line": 159, "column": 1, "offset": 5654 }, - "end": { "line": 159, "column": 14, "offset": 5667 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 159, "column": 14, "offset": 5667 }, - "end": { "line": 159, "column": 22, "offset": 5675 } - } - }, - { - "type": "text", - "value": " into a string using one of the above is referred to as\ndecoding, and converting a string into a ", - "position": { - "start": { "line": 159, "column": 22, "offset": 5675 }, - "end": { "line": 160, "column": 42, "offset": 5772 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 160, "column": 42, "offset": 5772 }, - "end": { "line": 160, "column": 50, "offset": 5780 } - } - }, - { - "type": "text", - "value": " is referred to as encoding.", - "position": { - "start": { "line": 160, "column": 50, "offset": 5780 }, - "end": { "line": 160, "column": 78, "offset": 5808 } - } - } - ], - "position": { - "start": { "line": 159, "column": 1, "offset": 5654 }, - "end": { "line": 160, "column": 78, "offset": 5808 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Node.js also supports the following binary-to-text encodings. For\nbinary-to-text encodings, the naming convention is reversed: Converting a\n", - "position": { - "start": { "line": 162, "column": 1, "offset": 5810 }, - "end": { "line": 164, "column": 1, "offset": 5950 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 164, "column": 1, "offset": 5950 }, - "end": { "line": 164, "column": 9, "offset": 5958 } - } - }, - { - "type": "text", - "value": " into a string is typically referred to as encoding, and converting a\nstring into a ", - "position": { - "start": { "line": 164, "column": 9, "offset": 5958 }, - "end": { "line": 165, "column": 15, "offset": 6042 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 165, "column": 15, "offset": 6042 }, - "end": { "line": 165, "column": 23, "offset": 6050 } - } - }, - { - "type": "text", - "value": " as decoding.", - "position": { - "start": { "line": 165, "column": 23, "offset": 6050 }, - "end": { "line": 165, "column": 36, "offset": 6063 } - } - } - ], - "position": { - "start": { "line": 162, "column": 1, "offset": 5810 }, - "end": { "line": 165, "column": 36, "offset": 6063 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": true, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "'base64'", - "position": { - "start": { "line": 167, "column": 3, "offset": 6067 }, - "end": { "line": 167, "column": 13, "offset": 6077 } - } - }, - { - "type": "text", - "value": ": ", - "position": { - "start": { "line": 167, "column": 13, "offset": 6077 }, - "end": { "line": 167, "column": 15, "offset": 6079 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "text", - "value": "Base64", - "position": { - "start": { "line": 167, "column": 16, "offset": 6080 }, - "end": { "line": 167, "column": 22, "offset": 6086 } - } - } - ], - "position": { - "start": { "line": 167, "column": 15, "offset": 6079 }, - "end": { "line": 167, "column": 25, "offset": 6089 } - }, - "label": "Base64", - "identifier": "base64", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": " encoding. When creating a ", - "position": { - "start": { "line": 167, "column": 25, "offset": 6089 }, - "end": { "line": 167, "column": 52, "offset": 6116 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 167, "column": 52, "offset": 6116 }, - "end": { "line": 167, "column": 60, "offset": 6124 } - } - }, - { - "type": "text", - "value": " from a string,\nthis encoding will also correctly accept \"URL and Filename Safe Alphabet\" as\nspecified in ", - "position": { - "start": { "line": 167, "column": 60, "offset": 6124 }, - "end": { "line": 169, "column": 16, "offset": 6234 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "text", - "value": "RFC 4648, Section 5", - "position": { - "start": { "line": 169, "column": 17, "offset": 6235 }, - "end": { "line": 169, "column": 36, "offset": 6254 } - } - } - ], - "position": { - "start": { "line": 169, "column": 16, "offset": 6234 }, - "end": { "line": 169, "column": 39, "offset": 6257 } - }, - "label": "RFC 4648, Section 5", - "identifier": "rfc 4648, section 5", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": ". Whitespace characters such as spaces,\ntabs, and new lines contained within the base64-encoded string are ignored.", - "position": { - "start": { "line": 169, "column": 39, "offset": 6257 }, - "end": { "line": 170, "column": 78, "offset": 6374 } - } - } - ], - "position": { - "start": { "line": 167, "column": 3, "offset": 6067 }, - "end": { "line": 170, "column": 78, "offset": 6374 } - } - } - ], - "position": { - "start": { "line": 167, "column": 1, "offset": 6065 }, - "end": { "line": 170, "column": 78, "offset": 6374 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "'base64url'", - "position": { - "start": { "line": 172, "column": 3, "offset": 6378 }, - "end": { "line": 172, "column": 16, "offset": 6391 } - } - }, - { - "type": "text", - "value": ": ", - "position": { - "start": { "line": 172, "column": 16, "offset": 6391 }, - "end": { "line": 172, "column": 18, "offset": 6393 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "text", - "value": "base64url", - "position": { - "start": { "line": 172, "column": 19, "offset": 6394 }, - "end": { "line": 172, "column": 28, "offset": 6403 } - } - } - ], - "position": { - "start": { "line": 172, "column": 18, "offset": 6393 }, - "end": { "line": 172, "column": 31, "offset": 6406 } - }, - "label": "base64url", - "identifier": "base64url", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": " encoding as specified in\n", - "position": { - "start": { "line": 172, "column": 31, "offset": 6406 }, - "end": { "line": 173, "column": 1, "offset": 6432 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "text", - "value": "RFC 4648, Section 5", - "position": { - "start": { "line": 173, "column": 4, "offset": 6435 }, - "end": { "line": 173, "column": 23, "offset": 6454 } - } - } - ], - "position": { - "start": { "line": 173, "column": 3, "offset": 6434 }, - "end": { "line": 173, "column": 26, "offset": 6457 } - }, - "label": "RFC 4648, Section 5", - "identifier": "rfc 4648, section 5", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": ". When creating a ", - "position": { - "start": { "line": 173, "column": 26, "offset": 6457 }, - "end": { "line": 173, "column": 44, "offset": 6475 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 173, "column": 44, "offset": 6475 }, - "end": { "line": 173, "column": 52, "offset": 6483 } - } - }, - { - "type": "text", - "value": " from a string, this\nencoding will also correctly accept regular base64-encoded strings. When\nencoding a ", - "position": { - "start": { "line": 173, "column": 52, "offset": 6483 }, - "end": { "line": 175, "column": 14, "offset": 6592 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 175, "column": 14, "offset": 6592 }, - "end": { "line": 175, "column": 22, "offset": 6600 } - } - }, - { - "type": "text", - "value": " to a string, this encoding will omit padding.", - "position": { - "start": { "line": 175, "column": 22, "offset": 6600 }, - "end": { "line": 175, "column": 68, "offset": 6646 } - } - } - ], - "position": { - "start": { "line": 172, "column": 3, "offset": 6378 }, - "end": { "line": 175, "column": 68, "offset": 6646 } - } - } - ], - "position": { - "start": { "line": 172, "column": 1, "offset": 6376 }, - "end": { "line": 175, "column": 68, "offset": 6646 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "'hex'", - "position": { - "start": { "line": 177, "column": 3, "offset": 6650 }, - "end": { "line": 177, "column": 10, "offset": 6657 } - } - }, - { - "type": "text", - "value": ": Encode each byte as two hexadecimal characters. Data truncation\nmay occur when decoding strings that do not exclusively consist of an even\nnumber of hexadecimal characters. See below for an example.", - "position": { - "start": { "line": 177, "column": 10, "offset": 6657 }, - "end": { "line": 179, "column": 62, "offset": 6861 } - } - } - ], - "position": { - "start": { "line": 177, "column": 3, "offset": 6650 }, - "end": { "line": 179, "column": 62, "offset": 6861 } - } - } - ], - "position": { - "start": { "line": 177, "column": 1, "offset": 6648 }, - "end": { "line": 179, "column": 62, "offset": 6861 } - } - } - ], - "position": { - "start": { "line": 167, "column": 1, "offset": 6065 }, - "end": { "line": 179, "column": 62, "offset": 6861 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The following legacy character encodings are also supported:", - "position": { - "start": { "line": 181, "column": 1, "offset": 6863 }, - "end": { "line": 181, "column": 61, "offset": 6923 } - } - } - ], - "position": { - "start": { "line": 181, "column": 1, "offset": 6863 }, - "end": { "line": 181, "column": 61, "offset": 6923 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": true, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "'ascii'", - "position": { - "start": { "line": 183, "column": 3, "offset": 6927 }, - "end": { "line": 183, "column": 12, "offset": 6936 } - } - }, - { - "type": "text", - "value": ": For 7-bit ", - "position": { - "start": { "line": 183, "column": 12, "offset": 6936 }, - "end": { "line": 183, "column": 24, "offset": 6948 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "text", - "value": "ASCII", - "position": { - "start": { "line": 183, "column": 25, "offset": 6949 }, - "end": { "line": 183, "column": 30, "offset": 6954 } - } - } - ], - "position": { - "start": { "line": 183, "column": 24, "offset": 6948 }, - "end": { "line": 183, "column": 33, "offset": 6957 } - }, - "label": "ASCII", - "identifier": "ascii", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": " data only. When encoding a string into a\n", - "position": { - "start": { "line": 183, "column": 33, "offset": 6957 }, - "end": { "line": 184, "column": 1, "offset": 6999 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 184, "column": 3, "offset": 7001 }, - "end": { "line": 184, "column": 11, "offset": 7009 } - } - }, - { - "type": "text", - "value": ", this is equivalent to using ", - "position": { - "start": { "line": 184, "column": 11, "offset": 7009 }, - "end": { "line": 184, "column": 41, "offset": 7039 } - } - }, - { - "type": "inlineCode", - "value": "'latin1'", - "position": { - "start": { "line": 184, "column": 41, "offset": 7039 }, - "end": { "line": 184, "column": 51, "offset": 7049 } - } - }, - { - "type": "text", - "value": ". When decoding a ", - "position": { - "start": { "line": 184, "column": 51, "offset": 7049 }, - "end": { "line": 184, "column": 69, "offset": 7067 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 184, "column": 69, "offset": 7067 }, - "end": { "line": 184, "column": 77, "offset": 7075 } - } - }, - { - "type": "text", - "value": "\ninto a string, using this encoding will additionally unset the highest bit of\neach byte before decoding as ", - "position": { - "start": { "line": 184, "column": 77, "offset": 7075 }, - "end": { "line": 186, "column": 32, "offset": 7187 } - } - }, - { - "type": "inlineCode", - "value": "'latin1'", - "position": { - "start": { "line": 186, "column": 32, "offset": 7187 }, - "end": { "line": 186, "column": 42, "offset": 7197 } - } - }, - { - "type": "text", - "value": ".\nGenerally, there should be no reason to use this encoding, as ", - "position": { - "start": { "line": 186, "column": 42, "offset": 7197 }, - "end": { "line": 187, "column": 65, "offset": 7263 } - } - }, - { - "type": "inlineCode", - "value": "'utf8'", - "position": { - "start": { "line": 187, "column": 65, "offset": 7263 }, - "end": { "line": 187, "column": 73, "offset": 7271 } - } - }, - { - "type": "text", - "value": "\n(or, if the data is known to always be ASCII-only, ", - "position": { - "start": { "line": 187, "column": 73, "offset": 7271 }, - "end": { "line": 188, "column": 54, "offset": 7325 } - } - }, - { - "type": "inlineCode", - "value": "'latin1'", - "position": { - "start": { "line": 188, "column": 54, "offset": 7325 }, - "end": { "line": 188, "column": 64, "offset": 7335 } - } - }, - { - "type": "text", - "value": ") will be a\nbetter choice when encoding or decoding ASCII-only text. It is only provided\nfor legacy compatibility.", - "position": { - "start": { "line": 188, "column": 64, "offset": 7335 }, - "end": { "line": 190, "column": 28, "offset": 7453 } - } - } - ], - "position": { - "start": { "line": 183, "column": 3, "offset": 6927 }, - "end": { "line": 190, "column": 28, "offset": 7453 } - } - } - ], - "position": { - "start": { "line": 183, "column": 1, "offset": 6925 }, - "end": { "line": 190, "column": 28, "offset": 7453 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "'binary'", - "position": { - "start": { "line": 192, "column": 3, "offset": 7457 }, - "end": { "line": 192, "column": 13, "offset": 7467 } - } - }, - { - "type": "text", - "value": ": Alias for ", - "position": { - "start": { "line": 192, "column": 13, "offset": 7467 }, - "end": { "line": 192, "column": 25, "offset": 7479 } - } - }, - { - "type": "inlineCode", - "value": "'latin1'", - "position": { - "start": { "line": 192, "column": 25, "offset": 7479 }, - "end": { "line": 192, "column": 35, "offset": 7489 } - } - }, - { - "type": "text", - "value": ".\nThe name of this encoding can be very misleading, as all of the\nencodings listed here convert between strings and binary data. For converting\nbetween strings and ", - "position": { - "start": { "line": 192, "column": 35, "offset": 7489 }, - "end": { "line": 195, "column": 23, "offset": 7659 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 195, "column": 23, "offset": 7659 }, - "end": { "line": 195, "column": 31, "offset": 7667 } - } - }, - { - "type": "text", - "value": "s, typically ", - "position": { - "start": { "line": 195, "column": 31, "offset": 7667 }, - "end": { "line": 195, "column": 44, "offset": 7680 } - } - }, - { - "type": "inlineCode", - "value": "'utf8'", - "position": { - "start": { "line": 195, "column": 44, "offset": 7680 }, - "end": { "line": 195, "column": 52, "offset": 7688 } - } - }, - { - "type": "text", - "value": " is the right choice.", - "position": { - "start": { "line": 195, "column": 52, "offset": 7688 }, - "end": { "line": 195, "column": 73, "offset": 7709 } - } - } - ], - "position": { - "start": { "line": 192, "column": 3, "offset": 7457 }, - "end": { "line": 195, "column": 73, "offset": 7709 } - } - } - ], - "position": { - "start": { "line": 192, "column": 1, "offset": 7455 }, - "end": { "line": 195, "column": 73, "offset": 7709 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "'ucs2'", - "position": { - "start": { "line": 197, "column": 3, "offset": 7713 }, - "end": { "line": 197, "column": 11, "offset": 7721 } - } - }, - { - "type": "text", - "value": ", ", - "position": { - "start": { "line": 197, "column": 11, "offset": 7721 }, - "end": { "line": 197, "column": 13, "offset": 7723 } - } - }, - { - "type": "inlineCode", - "value": "'ucs-2'", - "position": { - "start": { "line": 197, "column": 13, "offset": 7723 }, - "end": { "line": 197, "column": 22, "offset": 7732 } - } - }, - { - "type": "text", - "value": ": Aliases of ", - "position": { - "start": { "line": 197, "column": 22, "offset": 7732 }, - "end": { "line": 197, "column": 35, "offset": 7745 } - } - }, - { - "type": "inlineCode", - "value": "'utf16le'", - "position": { - "start": { "line": 197, "column": 35, "offset": 7745 }, - "end": { "line": 197, "column": 46, "offset": 7756 } - } - }, - { - "type": "text", - "value": ". UCS-2 used to refer to a variant\nof UTF-16 that did not support characters that had code points larger than\nU+FFFF. In Node.js, these code points are always supported.", - "position": { - "start": { "line": 197, "column": 46, "offset": 7756 }, - "end": { "line": 199, "column": 62, "offset": 7929 } - } - } - ], - "position": { - "start": { "line": 197, "column": 3, "offset": 7713 }, - "end": { "line": 199, "column": 62, "offset": 7929 } - } - } - ], - "position": { - "start": { "line": 197, "column": 1, "offset": 7711 }, - "end": { "line": 199, "column": 62, "offset": 7929 } - } - } - ], - "position": { - "start": { "line": 183, "column": 1, "offset": 6925 }, - "end": { "line": 199, "column": 62, "offset": 7929 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nBuffer.from('1ag123', 'hex');\n// Prints , data truncated when first non-hexadecimal value\n// ('g') encountered.\n\nBuffer.from('1a7', 'hex');\n// Prints , data truncated when data ends in single digit ('7').\n\nBuffer.from('1634', 'hex');\n// Prints , all data represented.", - "position": { - "start": { "line": 201, "column": 1, "offset": 7931 }, - "end": { "line": 213, "column": 4, "offset": 8284 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nBuffer.from('1ag123', 'hex');\n// Prints , data truncated when first non-hexadecimal value\n// ('g') encountered.\n\nBuffer.from('1a7', 'hex');\n// Prints , data truncated when data ends in single digit ('7').\n\nBuffer.from('1634', 'hex');\n// Prints , all data represented.", - "position": { - "start": { "line": 215, "column": 1, "offset": 8286 }, - "end": { "line": 227, "column": 4, "offset": 8644 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Modern Web browsers follow the ", - "position": { - "start": { "line": 229, "column": 1, "offset": 8646 }, - "end": { "line": 229, "column": 32, "offset": 8677 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "text", - "value": "WHATWG Encoding Standard", - "position": { - "start": { "line": 229, "column": 33, "offset": 8678 }, - "end": { "line": 229, "column": 57, "offset": 8702 } - } - } - ], - "position": { - "start": { "line": 229, "column": 32, "offset": 8677 }, - "end": { "line": 229, "column": 60, "offset": 8705 } - }, - "label": "WHATWG Encoding Standard", - "identifier": "whatwg encoding standard", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": " which aliases\nboth ", - "position": { - "start": { "line": 229, "column": 60, "offset": 8705 }, - "end": { "line": 230, "column": 6, "offset": 8725 } - } - }, - { - "type": "inlineCode", - "value": "'latin1'", - "position": { - "start": { "line": 230, "column": 6, "offset": 8725 }, - "end": { "line": 230, "column": 16, "offset": 8735 } - } - }, - { - "type": "text", - "value": " and ", - "position": { - "start": { "line": 230, "column": 16, "offset": 8735 }, - "end": { "line": 230, "column": 21, "offset": 8740 } - } - }, - { - "type": "inlineCode", - "value": "'ISO-8859-1'", - "position": { - "start": { "line": 230, "column": 21, "offset": 8740 }, - "end": { "line": 230, "column": 35, "offset": 8754 } - } - }, - { - "type": "text", - "value": " to ", - "position": { - "start": { "line": 230, "column": 35, "offset": 8754 }, - "end": { "line": 230, "column": 39, "offset": 8758 } - } - }, - { - "type": "inlineCode", - "value": "'win-1252'", - "position": { - "start": { "line": 230, "column": 39, "offset": 8758 }, - "end": { "line": 230, "column": 51, "offset": 8770 } - } - }, - { - "type": "text", - "value": ". This means that while doing\nsomething like ", - "position": { - "start": { "line": 230, "column": 51, "offset": 8770 }, - "end": { "line": 231, "column": 16, "offset": 8815 } - } - }, - { - "type": "inlineCode", - "value": "http.get()", - "position": { - "start": { "line": 231, "column": 16, "offset": 8815 }, - "end": { "line": 231, "column": 28, "offset": 8827 } - } - }, - { - "type": "text", - "value": ", if the returned charset is one of those listed in\nthe WHATWG specification it is possible that the server actually returned\n", - "position": { - "start": { "line": 231, "column": 28, "offset": 8827 }, - "end": { "line": 233, "column": 1, "offset": 8953 } - } - }, - { - "type": "inlineCode", - "value": "'win-1252'", - "position": { - "start": { "line": 233, "column": 1, "offset": 8953 }, - "end": { "line": 233, "column": 13, "offset": 8965 } - } - }, - { - "type": "text", - "value": "-encoded data, and using ", - "position": { - "start": { "line": 233, "column": 13, "offset": 8965 }, - "end": { "line": 233, "column": 38, "offset": 8990 } - } - }, - { - "type": "inlineCode", - "value": "'latin1'", - "position": { - "start": { "line": 233, "column": 38, "offset": 8990 }, - "end": { "line": 233, "column": 48, "offset": 9000 } - } - }, - { - "type": "text", - "value": " encoding may incorrectly decode\nthe characters.", - "position": { - "start": { "line": 233, "column": 48, "offset": 9000 }, - "end": { "line": 234, "column": 16, "offset": 9048 } - } - } - ], - "position": { - "start": { "line": 229, "column": 1, "offset": 8646 }, - "end": { "line": 234, "column": 16, "offset": 9048 } - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "Buffers and TypedArrays", - "position": { - "start": { "line": 236, "column": 4, "offset": 9053 }, - "end": { "line": 236, "column": 27, "offset": 9076 } - } - } - ], - "position": { - "start": { "line": 236, "column": 1, "offset": 9050 }, - "end": { "line": 236, "column": 27, "offset": 9076 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 238, "column": 1, "offset": 9078 }, - "end": { "line": 243, "column": 4, "offset": 9241 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 245, "column": 1, "offset": 9243 }, - "end": { "line": 245, "column": 9, "offset": 9251 } - } - }, - { - "type": "text", - "value": " instances are also JavaScript {Uint8Array} and {TypedArray}\ninstances. All {TypedArray} methods are available on ", - "position": { - "start": { "line": 245, "column": 9, "offset": 9251 }, - "end": { "line": 246, "column": 54, "offset": 9365 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 246, "column": 54, "offset": 9365 }, - "end": { "line": 246, "column": 62, "offset": 9373 } - } - }, - { - "type": "text", - "value": "s. There are,\nhowever, subtle incompatibilities between the ", - "position": { - "start": { "line": 246, "column": 62, "offset": 9373 }, - "end": { "line": 247, "column": 47, "offset": 9433 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 247, "column": 47, "offset": 9433 }, - "end": { "line": 247, "column": 55, "offset": 9441 } - } - }, - { - "type": "text", - "value": " API and the\n{TypedArray} API.", - "position": { - "start": { "line": 247, "column": 55, "offset": 9441 }, - "end": { "line": 248, "column": 18, "offset": 9471 } - } - } - ], - "position": { - "start": { "line": 245, "column": 1, "offset": 9243 }, - "end": { "line": 248, "column": 18, "offset": 9471 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "In particular:", - "position": { - "start": { "line": 250, "column": 1, "offset": 9473 }, - "end": { "line": 250, "column": 15, "offset": 9487 } - } - } - ], - "position": { - "start": { "line": 250, "column": 1, "offset": 9473 }, - "end": { "line": 250, "column": 15, "offset": 9487 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "While ", - "position": { - "start": { "line": 252, "column": 3, "offset": 9491 }, - "end": { "line": 252, "column": 9, "offset": 9497 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "TypedArray.prototype.slice()", - "position": { - "start": { "line": 252, "column": 10, "offset": 9498 }, - "end": { "line": 252, "column": 40, "offset": 9528 } - } - } - ], - "position": { - "start": { "line": 252, "column": 9, "offset": 9497 }, - "end": { "line": 252, "column": 43, "offset": 9531 } - }, - "label": "`TypedArray.prototype.slice()`", - "identifier": "`typedarray.prototype.slice()`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": " creates a copy of part of the ", - "position": { - "start": { "line": 252, "column": 43, "offset": 9531 }, - "end": { "line": 252, "column": 74, "offset": 9562 } - } - }, - { - "type": "inlineCode", - "value": "TypedArray", - "position": { - "start": { "line": 252, "column": 74, "offset": 9562 }, - "end": { "line": 252, "column": 86, "offset": 9574 } - } - }, - { - "type": "text", - "value": ",\n", - "position": { - "start": { "line": 252, "column": 86, "offset": 9574 }, - "end": { "line": 253, "column": 1, "offset": 9576 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "Buffer.prototype.slice()", - "position": { - "start": { "line": 253, "column": 4, "offset": 9579 }, - "end": { "line": 253, "column": 30, "offset": 9605 } - } - } - ], - "position": { - "start": { "line": 253, "column": 3, "offset": 9578 }, - "end": { "line": 253, "column": 46, "offset": 9621 } - }, - "label": "`buf.slice()`", - "identifier": "`buf.slice()`", - "referenceType": "full" - }, - { - "type": "text", - "value": " creates a view over the existing ", - "position": { - "start": { "line": 253, "column": 46, "offset": 9621 }, - "end": { "line": 253, "column": 80, "offset": 9655 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 253, "column": 80, "offset": 9655 }, - "end": { "line": 253, "column": 88, "offset": 9663 } - } - }, - { - "type": "text", - "value": "\nwithout copying. This behavior can be surprising, and only exists for legacy\ncompatibility. ", - "position": { - "start": { "line": 253, "column": 88, "offset": 9663 }, - "end": { "line": 255, "column": 18, "offset": 9760 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "TypedArray.prototype.subarray()", - "position": { - "start": { "line": 255, "column": 19, "offset": 9761 }, - "end": { "line": 255, "column": 52, "offset": 9794 } - } - } - ], - "position": { - "start": { "line": 255, "column": 18, "offset": 9760 }, - "end": { "line": 255, "column": 55, "offset": 9797 } - }, - "label": "`TypedArray.prototype.subarray()`", - "identifier": "`typedarray.prototype.subarray()`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": " can be used to achieve\nthe behavior of ", - "position": { - "start": { "line": 255, "column": 55, "offset": 9797 }, - "end": { "line": 256, "column": 19, "offset": 9839 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "Buffer.prototype.slice()", - "position": { - "start": { "line": 256, "column": 20, "offset": 9840 }, - "end": { "line": 256, "column": 46, "offset": 9866 } - } - } - ], - "position": { - "start": { "line": 256, "column": 19, "offset": 9839 }, - "end": { "line": 256, "column": 62, "offset": 9882 } - }, - "label": "`buf.slice()`", - "identifier": "`buf.slice()`", - "referenceType": "full" - }, - { - "type": "text", - "value": " on both ", - "position": { - "start": { "line": 256, "column": 62, "offset": 9882 }, - "end": { "line": 256, "column": 71, "offset": 9891 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 256, "column": 71, "offset": 9891 }, - "end": { "line": 256, "column": 79, "offset": 9899 } - } - }, - { - "type": "text", - "value": "s\nand other ", - "position": { - "start": { "line": 256, "column": 79, "offset": 9899 }, - "end": { "line": 257, "column": 13, "offset": 9913 } - } - }, - { - "type": "inlineCode", - "value": "TypedArray", - "position": { - "start": { "line": 257, "column": 13, "offset": 9913 }, - "end": { "line": 257, "column": 25, "offset": 9925 } - } - }, - { - "type": "text", - "value": "s and should be preferred.", - "position": { - "start": { "line": 257, "column": 25, "offset": 9925 }, - "end": { "line": 257, "column": 51, "offset": 9951 } - } - } - ], - "position": { - "start": { "line": 252, "column": 3, "offset": 9491 }, - "end": { "line": 257, "column": 51, "offset": 9951 } - } - } - ], - "position": { - "start": { "line": 252, "column": 1, "offset": 9489 }, - "end": { "line": 257, "column": 51, "offset": 9951 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "buf.toString()", - "position": { - "start": { "line": 258, "column": 4, "offset": 9955 }, - "end": { "line": 258, "column": 20, "offset": 9971 } - } - } - ], - "position": { - "start": { "line": 258, "column": 3, "offset": 9954 }, - "end": { "line": 258, "column": 23, "offset": 9974 } - }, - "label": "`buf.toString()`", - "identifier": "`buf.tostring()`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": " is incompatible with its ", - "position": { - "start": { "line": 258, "column": 23, "offset": 9974 }, - "end": { "line": 258, "column": 49, "offset": 10000 } - } - }, - { - "type": "inlineCode", - "value": "TypedArray", - "position": { - "start": { "line": 258, "column": 49, "offset": 10000 }, - "end": { "line": 258, "column": 61, "offset": 10012 } - } - }, - { - "type": "text", - "value": " equivalent.", - "position": { - "start": { "line": 258, "column": 61, "offset": 10012 }, - "end": { "line": 258, "column": 73, "offset": 10024 } - } - } - ], - "position": { - "start": { "line": 258, "column": 3, "offset": 9954 }, - "end": { "line": 258, "column": 73, "offset": 10024 } - } - } - ], - "position": { - "start": { "line": 258, "column": 1, "offset": 9952 }, - "end": { "line": 258, "column": 73, "offset": 10024 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A number of methods, e.g. ", - "position": { - "start": { "line": 259, "column": 3, "offset": 10027 }, - "end": { "line": 259, "column": 29, "offset": 10053 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "buf.indexOf()", - "position": { - "start": { "line": 259, "column": 30, "offset": 10054 }, - "end": { "line": 259, "column": 45, "offset": 10069 } - } - } - ], - "position": { - "start": { "line": 259, "column": 29, "offset": 10053 }, - "end": { "line": 259, "column": 48, "offset": 10072 } - }, - "label": "`buf.indexOf()`", - "identifier": "`buf.indexof()`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": ", support additional arguments.", - "position": { - "start": { "line": 259, "column": 48, "offset": 10072 }, - "end": { "line": 259, "column": 79, "offset": 10103 } - } - } - ], - "position": { - "start": { "line": 259, "column": 3, "offset": 10027 }, - "end": { "line": 259, "column": 79, "offset": 10103 } - } - } - ], - "position": { - "start": { "line": 259, "column": 1, "offset": 10025 }, - "end": { "line": 259, "column": 79, "offset": 10103 } - } - } - ], - "position": { - "start": { "line": 252, "column": 1, "offset": 9489 }, - "end": { "line": 259, "column": 79, "offset": 10103 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "There are two ways to create new {TypedArray} instances from a ", - "position": { - "start": { "line": 261, "column": 1, "offset": 10105 }, - "end": { "line": 261, "column": 64, "offset": 10168 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 261, "column": 64, "offset": 10168 }, - "end": { "line": 261, "column": 72, "offset": 10176 } - } - }, - { - "type": "text", - "value": ":", - "position": { - "start": { "line": 261, "column": 72, "offset": 10176 }, - "end": { "line": 261, "column": 73, "offset": 10177 } - } - } - ], - "position": { - "start": { "line": 261, "column": 1, "offset": 10105 }, - "end": { "line": 261, "column": 73, "offset": 10177 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Passing a ", - "position": { - "start": { "line": 263, "column": 3, "offset": 10181 }, - "end": { "line": 263, "column": 13, "offset": 10191 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 263, "column": 13, "offset": 10191 }, - "end": { "line": 263, "column": 21, "offset": 10199 } - } - }, - { - "type": "text", - "value": " to a {TypedArray} constructor will copy the ", - "position": { - "start": { "line": 263, "column": 21, "offset": 10199 }, - "end": { "line": 263, "column": 66, "offset": 10244 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 263, "column": 66, "offset": 10244 }, - "end": { "line": 263, "column": 74, "offset": 10252 } - } - }, - { - "type": "text", - "value": "'s\ncontents, interpreted as an array of integers, and not as a byte sequence\nof the target type.", - "position": { - "start": { "line": 263, "column": 74, "offset": 10252 }, - "end": { "line": 265, "column": 22, "offset": 10352 } - } - } - ], - "position": { - "start": { "line": 263, "column": 3, "offset": 10181 }, - "end": { "line": 265, "column": 22, "offset": 10352 } - } - } - ], - "position": { - "start": { "line": 263, "column": 1, "offset": 10179 }, - "end": { "line": 265, "column": 22, "offset": 10352 } - } - } - ], - "position": { - "start": { "line": 263, "column": 1, "offset": 10179 }, - "end": { "line": 265, "column": 22, "offset": 10352 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from([1, 2, 3, 4]);\nconst uint32array = new Uint32Array(buf);\n\nconsole.log(uint32array);\n\n// Prints: Uint32Array(4) [ 1, 2, 3, 4 ]", - "position": { - "start": { "line": 267, "column": 1, "offset": 10354 }, - "end": { "line": 276, "column": 4, "offset": 10553 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from([1, 2, 3, 4]);\nconst uint32array = new Uint32Array(buf);\n\nconsole.log(uint32array);\n\n// Prints: Uint32Array(4) [ 1, 2, 3, 4 ]", - "position": { - "start": { "line": 278, "column": 1, "offset": 10555 }, - "end": { "line": 287, "column": 4, "offset": 10759 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Passing the ", - "position": { - "start": { "line": 289, "column": 3, "offset": 10763 }, - "end": { "line": 289, "column": 15, "offset": 10775 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 289, "column": 15, "offset": 10775 }, - "end": { "line": 289, "column": 23, "offset": 10783 } - } - }, - { - "type": "text", - "value": "'s underlying {ArrayBuffer} will create a\n{TypedArray} that shares its memory with the ", - "position": { - "start": { "line": 289, "column": 23, "offset": 10783 }, - "end": { "line": 290, "column": 48, "offset": 10872 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 290, "column": 48, "offset": 10872 }, - "end": { "line": 290, "column": 56, "offset": 10880 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 290, "column": 56, "offset": 10880 }, - "end": { "line": 290, "column": 57, "offset": 10881 } - } - } - ], - "position": { - "start": { "line": 289, "column": 3, "offset": 10763 }, - "end": { "line": 290, "column": 57, "offset": 10881 } - } - } - ], - "position": { - "start": { "line": 289, "column": 1, "offset": 10761 }, - "end": { "line": 290, "column": 57, "offset": 10881 } - } - } - ], - "position": { - "start": { "line": 289, "column": 1, "offset": 10761 }, - "end": { "line": 290, "column": 57, "offset": 10881 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from('hello', 'utf16le');\nconst uint16array = new Uint16Array(\n buf.buffer,\n buf.byteOffset,\n buf.length / Uint16Array.BYTES_PER_ELEMENT);\n\nconsole.log(uint16array);\n\n// Prints: Uint16Array(5) [ 104, 101, 108, 108, 111 ]", - "position": { - "start": { "line": 292, "column": 1, "offset": 10883 }, - "end": { "line": 304, "column": 4, "offset": 11175 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from('hello', 'utf16le');\nconst uint16array = new Uint16Array(\n buf.buffer,\n buf.byteOffset,\n buf.length / Uint16Array.BYTES_PER_ELEMENT);\n\nconsole.log(uint16array);\n\n// Prints: Uint16Array(5) [ 104, 101, 108, 108, 111 ]", - "position": { - "start": { "line": 306, "column": 1, "offset": 11177 }, - "end": { "line": 318, "column": 4, "offset": 11474 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "It is possible to create a new ", - "position": { - "start": { "line": 320, "column": 1, "offset": 11476 }, - "end": { "line": 320, "column": 32, "offset": 11507 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 320, "column": 32, "offset": 11507 }, - "end": { "line": 320, "column": 40, "offset": 11515 } - } - }, - { - "type": "text", - "value": " that shares the same allocated\nmemory as a {TypedArray} instance by using the ", - "position": { - "start": { "line": 320, "column": 40, "offset": 11515 }, - "end": { "line": 321, "column": 48, "offset": 11594 } - } - }, - { - "type": "inlineCode", - "value": "TypedArray", - "position": { - "start": { "line": 321, "column": 48, "offset": 11594 }, - "end": { "line": 321, "column": 60, "offset": 11606 } - } - }, - { - "type": "text", - "value": " object's\n", - "position": { - "start": { "line": 321, "column": 60, "offset": 11606 }, - "end": { "line": 322, "column": 1, "offset": 11616 } - } - }, - { - "type": "inlineCode", - "value": ".buffer", - "position": { - "start": { "line": 322, "column": 1, "offset": 11616 }, - "end": { "line": 322, "column": 10, "offset": 11625 } - } - }, - { - "type": "text", - "value": " property in the same way. ", - "position": { - "start": { "line": 322, "column": 10, "offset": 11625 }, - "end": { "line": 322, "column": 37, "offset": 11652 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "Buffer.from()", - "position": { - "start": { "line": 322, "column": 38, "offset": 11653 }, - "end": { "line": 322, "column": 53, "offset": 11668 } - } - } - ], - "position": { - "start": { "line": 322, "column": 37, "offset": 11652 }, - "end": { "line": 322, "column": 79, "offset": 11694 } - }, - "label": "`Buffer.from(arrayBuf)`", - "identifier": "`buffer.from(arraybuf)`", - "referenceType": "full" - }, - { - "type": "text", - "value": "\nbehaves like ", - "position": { - "start": { "line": 322, "column": 79, "offset": 11694 }, - "end": { "line": 323, "column": 14, "offset": 11708 } - } - }, - { - "type": "inlineCode", - "value": "new Uint8Array()", - "position": { - "start": { "line": 323, "column": 14, "offset": 11708 }, - "end": { "line": 323, "column": 32, "offset": 11726 } - } - }, - { - "type": "text", - "value": " in this context.", - "position": { - "start": { "line": 323, "column": 32, "offset": 11726 }, - "end": { "line": 323, "column": 49, "offset": 11743 } - } - } - ], - "position": { - "start": { "line": 320, "column": 1, "offset": 11476 }, - "end": { "line": 323, "column": 49, "offset": 11743 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst arr = new Uint16Array(2);\n\narr[0] = 5000;\narr[1] = 4000;\n\n// Copies the contents of `arr`.\nconst buf1 = Buffer.from(arr);\n\n// Shares memory with `arr`.\nconst buf2 = Buffer.from(arr.buffer);\n\nconsole.log(buf1);\n// Prints: \nconsole.log(buf2);\n// Prints: \n\narr[1] = 6000;\n\nconsole.log(buf1);\n// Prints: \nconsole.log(buf2);\n// Prints: ", - "position": { - "start": { "line": 325, "column": 1, "offset": 11745 }, - "end": { "line": 350, "column": 4, "offset": 12200 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst arr = new Uint16Array(2);\n\narr[0] = 5000;\narr[1] = 4000;\n\n// Copies the contents of `arr`.\nconst buf1 = Buffer.from(arr);\n\n// Shares memory with `arr`.\nconst buf2 = Buffer.from(arr.buffer);\n\nconsole.log(buf1);\n// Prints: \nconsole.log(buf2);\n// Prints: \n\narr[1] = 6000;\n\nconsole.log(buf1);\n// Prints: \nconsole.log(buf2);\n// Prints: ", - "position": { - "start": { "line": 352, "column": 1, "offset": 12202 }, - "end": { "line": 377, "column": 4, "offset": 12662 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "When creating a ", - "position": { - "start": { "line": 379, "column": 1, "offset": 12664 }, - "end": { "line": 379, "column": 17, "offset": 12680 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 379, "column": 17, "offset": 12680 }, - "end": { "line": 379, "column": 25, "offset": 12688 } - } - }, - { - "type": "text", - "value": " using a {TypedArray}'s ", - "position": { - "start": { "line": 379, "column": 25, "offset": 12688 }, - "end": { "line": 379, "column": 49, "offset": 12712 } - } - }, - { - "type": "inlineCode", - "value": ".buffer", - "position": { - "start": { "line": 379, "column": 49, "offset": 12712 }, - "end": { "line": 379, "column": 58, "offset": 12721 } - } - }, - { - "type": "text", - "value": ", it is\npossible to use only a portion of the underlying {ArrayBuffer} by passing in\n", - "position": { - "start": { "line": 379, "column": 58, "offset": 12721 }, - "end": { "line": 381, "column": 1, "offset": 12806 } - } - }, - { - "type": "inlineCode", - "value": "byteOffset", - "position": { - "start": { "line": 381, "column": 1, "offset": 12806 }, - "end": { "line": 381, "column": 13, "offset": 12818 } - } - }, - { - "type": "text", - "value": " and ", - "position": { - "start": { "line": 381, "column": 13, "offset": 12818 }, - "end": { "line": 381, "column": 18, "offset": 12823 } - } - }, - { - "type": "inlineCode", - "value": "length", - "position": { - "start": { "line": 381, "column": 18, "offset": 12823 }, - "end": { "line": 381, "column": 26, "offset": 12831 } - } - }, - { - "type": "text", - "value": " parameters.", - "position": { - "start": { "line": 381, "column": 26, "offset": 12831 }, - "end": { "line": 381, "column": 38, "offset": 12843 } - } - } - ], - "position": { - "start": { "line": 379, "column": 1, "offset": 12664 }, - "end": { "line": 381, "column": 38, "offset": 12843 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst arr = new Uint16Array(20);\nconst buf = Buffer.from(arr.buffer, 0, 16);\n\nconsole.log(buf.length);\n// Prints: 16", - "position": { - "start": { "line": 383, "column": 1, "offset": 12845 }, - "end": { "line": 391, "column": 4, "offset": 13011 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst arr = new Uint16Array(20);\nconst buf = Buffer.from(arr.buffer, 0, 16);\n\nconsole.log(buf.length);\n// Prints: 16", - "position": { - "start": { "line": 393, "column": 1, "offset": 13013 }, - "end": { "line": 401, "column": 4, "offset": 13184 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The ", - "position": { - "start": { "line": 403, "column": 1, "offset": 13186 }, - "end": { "line": 403, "column": 5, "offset": 13190 } - } - }, - { - "type": "inlineCode", - "value": "Buffer.from()", - "position": { - "start": { "line": 403, "column": 5, "offset": 13190 }, - "end": { "line": 403, "column": 20, "offset": 13205 } - } - }, - { - "type": "text", - "value": " and ", - "position": { - "start": { "line": 403, "column": 20, "offset": 13205 }, - "end": { "line": 403, "column": 25, "offset": 13210 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "TypedArray.from()", - "position": { - "start": { "line": 403, "column": 26, "offset": 13211 }, - "end": { "line": 403, "column": 45, "offset": 13230 } - } - } - ], - "position": { - "start": { "line": 403, "column": 25, "offset": 13210 }, - "end": { "line": 403, "column": 48, "offset": 13233 } - }, - "label": "`TypedArray.from()`", - "identifier": "`typedarray.from()`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": " have different signatures and\nimplementations. Specifically, the {TypedArray} variants accept a second\nargument that is a mapping function that is invoked on every element of the\ntyped array:", - "position": { - "start": { "line": 403, "column": 48, "offset": 13233 }, - "end": { "line": 406, "column": 13, "offset": 13425 } - } - } - ], - "position": { - "start": { "line": 403, "column": 1, "offset": 13186 }, - "end": { "line": 406, "column": 13, "offset": 13425 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "TypedArray.from(source[, mapFn[, thisArg]])", - "position": { - "start": { "line": 408, "column": 3, "offset": 13429 }, - "end": { "line": 408, "column": 48, "offset": 13474 } - } - } - ], - "position": { - "start": { "line": 408, "column": 3, "offset": 13429 }, - "end": { "line": 408, "column": 48, "offset": 13474 } - } - } - ], - "position": { - "start": { "line": 408, "column": 1, "offset": 13427 }, - "end": { "line": 408, "column": 48, "offset": 13474 } - } - } - ], - "position": { - "start": { "line": 408, "column": 1, "offset": 13427 }, - "end": { "line": 408, "column": 48, "offset": 13474 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The ", - "position": { - "start": { "line": 410, "column": 1, "offset": 13476 }, - "end": { "line": 410, "column": 5, "offset": 13480 } - } - }, - { - "type": "inlineCode", - "value": "Buffer.from()", - "position": { - "start": { "line": 410, "column": 5, "offset": 13480 }, - "end": { "line": 410, "column": 20, "offset": 13495 } - } - }, - { - "type": "text", - "value": " method, however, does not support the use of a mapping\nfunction:", - "position": { - "start": { "line": 410, "column": 20, "offset": 13495 }, - "end": { "line": 411, "column": 10, "offset": 13560 } - } - } - ], - "position": { - "start": { "line": 410, "column": 1, "offset": 13476 }, - "end": { "line": 411, "column": 10, "offset": 13560 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "Buffer.from(array)", - "position": { - "start": { "line": 413, "column": 4, "offset": 13565 }, - "end": { "line": 413, "column": 24, "offset": 13585 } - } - } - ], - "position": { - "start": { "line": 413, "column": 3, "offset": 13564 }, - "end": { "line": 413, "column": 27, "offset": 13588 } - }, - "label": "`Buffer.from(array)`", - "identifier": "`buffer.from(array)`", - "referenceType": "collapsed" - } - ], - "position": { - "start": { "line": 413, "column": 3, "offset": 13564 }, - "end": { "line": 413, "column": 27, "offset": 13588 } - } - } - ], - "position": { - "start": { "line": 413, "column": 1, "offset": 13562 }, - "end": { "line": 413, "column": 27, "offset": 13588 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "Buffer.from(buffer)", - "position": { - "start": { "line": 414, "column": 4, "offset": 13592 }, - "end": { "line": 414, "column": 25, "offset": 13613 } - } - } - ], - "position": { - "start": { "line": 414, "column": 3, "offset": 13591 }, - "end": { "line": 414, "column": 28, "offset": 13616 } - }, - "label": "`Buffer.from(buffer)`", - "identifier": "`buffer.from(buffer)`", - "referenceType": "collapsed" - } - ], - "position": { - "start": { "line": 414, "column": 3, "offset": 13591 }, - "end": { "line": 414, "column": 28, "offset": 13616 } - } - } - ], - "position": { - "start": { "line": 414, "column": 1, "offset": 13589 }, - "end": { "line": 414, "column": 28, "offset": 13616 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "Buffer.from(arrayBuffer[, byteOffset[, length]])", - "position": { - "start": { "line": 415, "column": 4, "offset": 13620 }, - "end": { "line": 415, "column": 54, "offset": 13670 } - } - } - ], - "position": { - "start": { "line": 415, "column": 3, "offset": 13619 }, - "end": { "line": 415, "column": 80, "offset": 13696 } - }, - "label": "`Buffer.from(arrayBuf)`", - "identifier": "`buffer.from(arraybuf)`", - "referenceType": "full" - } - ], - "position": { - "start": { "line": 415, "column": 3, "offset": 13619 }, - "end": { "line": 415, "column": 80, "offset": 13696 } - } - } - ], - "position": { - "start": { "line": 415, "column": 1, "offset": 13617 }, - "end": { "line": 415, "column": 80, "offset": 13696 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "Buffer.from(string[, encoding])", - "position": { - "start": { "line": 416, "column": 4, "offset": 13700 }, - "end": { "line": 416, "column": 37, "offset": 13733 } - } - } - ], - "position": { - "start": { "line": 416, "column": 3, "offset": 13699 }, - "end": { "line": 416, "column": 61, "offset": 13757 } - }, - "label": "`Buffer.from(string)`", - "identifier": "`buffer.from(string)`", - "referenceType": "full" - } - ], - "position": { - "start": { "line": 416, "column": 3, "offset": 13699 }, - "end": { "line": 416, "column": 61, "offset": 13757 } - } - } - ], - "position": { - "start": { "line": 416, "column": 1, "offset": 13697 }, - "end": { "line": 416, "column": 61, "offset": 13757 } - } - } - ], - "position": { - "start": { "line": 413, "column": 1, "offset": 13562 }, - "end": { "line": 416, "column": 61, "offset": 13757 } - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "Buffers and iteration", - "position": { - "start": { "line": 418, "column": 4, "offset": 13762 }, - "end": { "line": 418, "column": 25, "offset": 13783 } - } - } - ], - "position": { - "start": { "line": 418, "column": 1, "offset": 13759 }, - "end": { "line": 418, "column": 25, "offset": 13783 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 420, "column": 1, "offset": 13785 }, - "end": { "line": 420, "column": 9, "offset": 13793 } - } - }, - { - "type": "text", - "value": " instances can be iterated over using ", - "position": { - "start": { "line": 420, "column": 9, "offset": 13793 }, - "end": { "line": 420, "column": 47, "offset": 13831 } - } - }, - { - "type": "inlineCode", - "value": "for..of", - "position": { - "start": { "line": 420, "column": 47, "offset": 13831 }, - "end": { "line": 420, "column": 56, "offset": 13840 } - } - }, - { - "type": "text", - "value": " syntax:", - "position": { - "start": { "line": 420, "column": 56, "offset": 13840 }, - "end": { "line": 420, "column": 64, "offset": 13848 } - } - } - ], - "position": { - "start": { "line": 420, "column": 1, "offset": 13785 }, - "end": { "line": 420, "column": 64, "offset": 13848 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from([1, 2, 3]);\n\nfor (const b of buf) {\n console.log(b);\n}\n// Prints:\n// 1\n// 2\n// 3", - "position": { - "start": { "line": 422, "column": 1, "offset": 13850 }, - "end": { "line": 434, "column": 4, "offset": 14011 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from([1, 2, 3]);\n\nfor (const b of buf) {\n console.log(b);\n}\n// Prints:\n// 1\n// 2\n// 3", - "position": { - "start": { "line": 436, "column": 1, "offset": 14013 }, - "end": { "line": 448, "column": 4, "offset": 14179 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Additionally, the ", - "position": { - "start": { "line": 450, "column": 1, "offset": 14181 }, - "end": { "line": 450, "column": 19, "offset": 14199 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "buf.values()", - "position": { - "start": { "line": 450, "column": 20, "offset": 14200 }, - "end": { "line": 450, "column": 34, "offset": 14214 } - } - } - ], - "position": { - "start": { "line": 450, "column": 19, "offset": 14199 }, - "end": { "line": 450, "column": 37, "offset": 14217 } - }, - "label": "`buf.values()`", - "identifier": "`buf.values()`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": ", ", - "position": { - "start": { "line": 450, "column": 37, "offset": 14217 }, - "end": { "line": 450, "column": 39, "offset": 14219 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "buf.keys()", - "position": { - "start": { "line": 450, "column": 40, "offset": 14220 }, - "end": { "line": 450, "column": 52, "offset": 14232 } - } - } - ], - "position": { - "start": { "line": 450, "column": 39, "offset": 14219 }, - "end": { "line": 450, "column": 55, "offset": 14235 } - }, - "label": "`buf.keys()`", - "identifier": "`buf.keys()`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": ", and\n", - "position": { - "start": { "line": 450, "column": 55, "offset": 14235 }, - "end": { "line": 451, "column": 1, "offset": 14241 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "buf.entries()", - "position": { - "start": { "line": 451, "column": 2, "offset": 14242 }, - "end": { "line": 451, "column": 17, "offset": 14257 } - } - } - ], - "position": { - "start": { "line": 451, "column": 1, "offset": 14241 }, - "end": { "line": 451, "column": 20, "offset": 14260 } - }, - "label": "`buf.entries()`", - "identifier": "`buf.entries()`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": " methods can be used to create iterators.", - "position": { - "start": { "line": 451, "column": 20, "offset": 14260 }, - "end": { "line": 451, "column": 61, "offset": 14301 } - } - } - ], - "position": { - "start": { "line": 450, "column": 1, "offset": 14181 }, - "end": { "line": 451, "column": 61, "offset": 14301 } - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "Class: ", - "position": { - "start": { "line": 453, "column": 4, "offset": 14306 }, - "end": { "line": 453, "column": 11, "offset": 14313 } - } - }, - { - "type": "inlineCode", - "value": "Blob", - "position": { - "start": { "line": 453, "column": 11, "offset": 14313 }, - "end": { "line": 453, "column": 17, "offset": 14319 } - } - } - ], - "position": { - "start": { "line": 453, "column": 1, "offset": 14303 }, - "end": { "line": 453, "column": 17, "offset": 14319 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 455, "column": 1, "offset": 14321 }, - "end": { "line": 465, "column": 4, "offset": 14512 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A ", - "position": { - "start": { "line": 467, "column": 1, "offset": 14514 }, - "end": { "line": 467, "column": 3, "offset": 14516 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "Blob", - "position": { - "start": { "line": 467, "column": 4, "offset": 14517 }, - "end": { "line": 467, "column": 10, "offset": 14523 } - } - } - ], - "position": { - "start": { "line": 467, "column": 3, "offset": 14516 }, - "end": { "line": 467, "column": 13, "offset": 14526 } - }, - "label": "`Blob`", - "identifier": "`blob`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": " encapsulates immutable, raw data that can be safely shared across\nmultiple worker threads.", - "position": { - "start": { "line": 467, "column": 13, "offset": 14526 }, - "end": { "line": 468, "column": 25, "offset": 14617 } - } - } - ], - "position": { - "start": { "line": 467, "column": 1, "offset": 14514 }, - "end": { "line": 468, "column": 25, "offset": 14617 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "new buffer.Blob([sources[, options]])", - "position": { - "start": { "line": 470, "column": 5, "offset": 14623 }, - "end": { "line": 470, "column": 44, "offset": 14662 } - } - } - ], - "position": { - "start": { "line": 470, "column": 1, "offset": 14619 }, - "end": { "line": 470, "column": 44, "offset": 14662 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 472, "column": 1, "offset": 14664 }, - "end": { "line": 481, "column": 4, "offset": 14936 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "sources", - "position": { - "start": { "line": 483, "column": 3, "offset": 14940 }, - "end": { "line": 483, "column": 12, "offset": 14949 } - } - }, - { - "type": "text", - "value": " {string[]|ArrayBuffer[]|TypedArray[]|DataView[]|Blob[]} An\narray of string, {ArrayBuffer}, {TypedArray}, {DataView}, or {Blob} objects,\nor any mix of such objects, that will be stored within the ", - "position": { - "start": { "line": 483, "column": 12, "offset": 14949 }, - "end": { "line": 485, "column": 62, "offset": 15154 } - } - }, - { - "type": "inlineCode", - "value": "Blob", - "position": { - "start": { "line": 485, "column": 62, "offset": 15154 }, - "end": { "line": 485, "column": 68, "offset": 15160 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 485, "column": 68, "offset": 15160 }, - "end": { "line": 485, "column": 69, "offset": 15161 } - } - } - ], - "position": { - "start": { "line": 483, "column": 3, "offset": 14940 }, - "end": { "line": 485, "column": 69, "offset": 15161 } - } - } - ], - "position": { - "start": { "line": 483, "column": 1, "offset": 14938 }, - "end": { "line": 485, "column": 69, "offset": 15161 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "options", - "position": { - "start": { "line": 486, "column": 3, "offset": 15164 }, - "end": { "line": 486, "column": 12, "offset": 15173 } - } - }, - { - "type": "text", - "value": " {Object}", - "position": { - "start": { "line": 486, "column": 12, "offset": 15173 }, - "end": { "line": 486, "column": 21, "offset": 15182 } - } - } - ], - "position": { - "start": { "line": 486, "column": 3, "offset": 15164 }, - "end": { "line": 486, "column": 21, "offset": 15182 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "endings", - "position": { - "start": { - "line": 487, - "column": 5, - "offset": 15187 - }, - "end": { - "line": 487, - "column": 14, - "offset": 15196 - } - } - }, - { - "type": "text", - "value": " {string} One of either ", - "position": { - "start": { - "line": 487, - "column": 14, - "offset": 15196 - }, - "end": { - "line": 487, - "column": 38, - "offset": 15220 - } - } - }, - { - "type": "inlineCode", - "value": "'transparent'", - "position": { - "start": { - "line": 487, - "column": 38, - "offset": 15220 - }, - "end": { - "line": 487, - "column": 53, - "offset": 15235 - } - } - }, - { - "type": "text", - "value": " or ", - "position": { - "start": { - "line": 487, - "column": 53, - "offset": 15235 - }, - "end": { - "line": 487, - "column": 57, - "offset": 15239 - } - } - }, - { - "type": "inlineCode", - "value": "'native'", - "position": { - "start": { - "line": 487, - "column": 57, - "offset": 15239 - }, - "end": { - "line": 487, - "column": 67, - "offset": 15249 - } - } - }, - { - "type": "text", - "value": ". When set\nto ", - "position": { - "start": { - "line": 487, - "column": 67, - "offset": 15249 - }, - "end": { "line": 488, "column": 8, "offset": 15267 } - } - }, - { - "type": "inlineCode", - "value": "'native'", - "position": { - "start": { - "line": 488, - "column": 8, - "offset": 15267 - }, - "end": { - "line": 488, - "column": 18, - "offset": 15277 - } - } - }, - { - "type": "text", - "value": ", line endings in string source parts will be converted to\nthe platform native line-ending as specified by ", - "position": { - "start": { - "line": 488, - "column": 18, - "offset": 15277 - }, - "end": { - "line": 489, - "column": 53, - "offset": 15388 - } - } - }, - { - "type": "inlineCode", - "value": "require('node:os').EOL", - "position": { - "start": { - "line": 489, - "column": 53, - "offset": 15388 - }, - "end": { - "line": 489, - "column": 77, - "offset": 15412 - } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { - "line": 489, - "column": 77, - "offset": 15412 - }, - "end": { - "line": 489, - "column": 78, - "offset": 15413 - } - } - } - ], - "position": { - "start": { "line": 487, "column": 5, "offset": 15187 }, - "end": { "line": 489, "column": 78, "offset": 15413 } - } - } - ], - "position": { - "start": { "line": 487, "column": 3, "offset": 15185 }, - "end": { "line": 489, "column": 78, "offset": 15413 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "type", - "position": { - "start": { - "line": 490, - "column": 5, - "offset": 15418 - }, - "end": { - "line": 490, - "column": 11, - "offset": 15424 - } - } - }, - { - "type": "text", - "value": " {string} The Blob content-type. The intent is for ", - "position": { - "start": { - "line": 490, - "column": 11, - "offset": 15424 - }, - "end": { - "line": 490, - "column": 62, - "offset": 15475 - } - } - }, - { - "type": "inlineCode", - "value": "type", - "position": { - "start": { - "line": 490, - "column": 62, - "offset": 15475 - }, - "end": { - "line": 490, - "column": 68, - "offset": 15481 - } - } - }, - { - "type": "text", - "value": " to convey\nthe MIME media type of the data, however no validation of the type format\nis performed.", - "position": { - "start": { - "line": 490, - "column": 68, - "offset": 15481 - }, - "end": { - "line": 492, - "column": 18, - "offset": 15587 - } - } - } - ], - "position": { - "start": { "line": 490, "column": 5, "offset": 15418 }, - "end": { "line": 492, "column": 18, "offset": 15587 } - } - } - ], - "position": { - "start": { "line": 490, "column": 3, "offset": 15416 }, - "end": { "line": 492, "column": 18, "offset": 15587 } - } - } - ], - "position": { - "start": { "line": 487, "column": 3, "offset": 15185 }, - "end": { "line": 492, "column": 18, "offset": 15587 } - } - } - ], - "position": { - "start": { "line": 486, "column": 1, "offset": 15162 }, - "end": { "line": 492, "column": 18, "offset": 15587 } - } - } - ], - "position": { - "start": { "line": 483, "column": 1, "offset": 14938 }, - "end": { "line": 492, "column": 18, "offset": 15587 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Creates a new ", - "position": { - "start": { "line": 494, "column": 1, "offset": 15589 }, - "end": { "line": 494, "column": 15, "offset": 15603 } - } - }, - { - "type": "inlineCode", - "value": "Blob", - "position": { - "start": { "line": 494, "column": 15, "offset": 15603 }, - "end": { "line": 494, "column": 21, "offset": 15609 } - } - }, - { - "type": "text", - "value": " object containing a concatenation of the given sources.", - "position": { - "start": { "line": 494, "column": 21, "offset": 15609 }, - "end": { "line": 494, "column": 77, "offset": 15665 } - } - } - ], - "position": { - "start": { "line": 494, "column": 1, "offset": 15589 }, - "end": { "line": 494, "column": 77, "offset": 15665 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "{ArrayBuffer}, {TypedArray}, {DataView}, and {Buffer} sources are copied into\nthe 'Blob' and can therefore be safely modified after the 'Blob' is created.", - "position": { - "start": { "line": 496, "column": 1, "offset": 15667 }, - "end": { "line": 497, "column": 77, "offset": 15821 } - } - } - ], - "position": { - "start": { "line": 496, "column": 1, "offset": 15667 }, - "end": { "line": 497, "column": 77, "offset": 15821 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "String sources are encoded as UTF-8 byte sequences and copied into the Blob.\nUnmatched surrogate pairs within each string part will be replaced by Unicode\nU+FFFD replacement characters.", - "position": { - "start": { "line": 499, "column": 1, "offset": 15823 }, - "end": { "line": 501, "column": 31, "offset": 16008 } - } - } - ], - "position": { - "start": { "line": 499, "column": 1, "offset": 15823 }, - "end": { "line": 501, "column": 31, "offset": 16008 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "blob.arrayBuffer()", - "position": { - "start": { "line": 503, "column": 5, "offset": 16014 }, - "end": { "line": 503, "column": 25, "offset": 16034 } - } - } - ], - "position": { - "start": { "line": 503, "column": 1, "offset": 16010 }, - "end": { "line": 503, "column": 25, "offset": 16034 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 505, "column": 1, "offset": 16036 }, - "end": { "line": 509, "column": 4, "offset": 16081 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {Promise}", - "position": { - "start": { "line": 511, "column": 3, "offset": 16085 }, - "end": { "line": 511, "column": 21, "offset": 16103 } - } - } - ], - "position": { - "start": { "line": 511, "column": 3, "offset": 16085 }, - "end": { "line": 511, "column": 21, "offset": 16103 } - } - } - ], - "position": { - "start": { "line": 511, "column": 1, "offset": 16083 }, - "end": { "line": 511, "column": 21, "offset": 16103 } - } - } - ], - "position": { - "start": { "line": 511, "column": 1, "offset": 16083 }, - "end": { "line": 511, "column": 21, "offset": 16103 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns a promise that fulfills with an {ArrayBuffer} containing a copy of\nthe ", - "position": { - "start": { "line": 513, "column": 1, "offset": 16105 }, - "end": { "line": 514, "column": 5, "offset": 16184 } - } - }, - { - "type": "inlineCode", - "value": "Blob", - "position": { - "start": { "line": 514, "column": 5, "offset": 16184 }, - "end": { "line": 514, "column": 11, "offset": 16190 } - } - }, - { - "type": "text", - "value": " data.", - "position": { - "start": { "line": 514, "column": 11, "offset": 16190 }, - "end": { "line": 514, "column": 17, "offset": 16196 } - } - } - ], - "position": { - "start": { "line": 513, "column": 1, "offset": 16105 }, - "end": { "line": 514, "column": 17, "offset": 16196 } - } - }, - { - "type": "heading", - "depth": 4, - "children": [ - { - "type": "inlineCode", - "value": "blob.bytes()", - "position": { - "start": { "line": 516, "column": 6, "offset": 16203 }, - "end": { "line": 516, "column": 20, "offset": 16217 } - } - } - ], - "position": { - "start": { "line": 516, "column": 1, "offset": 16198 }, - "end": { "line": 516, "column": 20, "offset": 16217 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 518, "column": 1, "offset": 16219 }, - "end": { "line": 522, "column": 4, "offset": 16264 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The ", - "position": { - "start": { "line": 524, "column": 1, "offset": 16266 }, - "end": { "line": 524, "column": 5, "offset": 16270 } - } - }, - { - "type": "inlineCode", - "value": "blob.bytes()", - "position": { - "start": { "line": 524, "column": 5, "offset": 16270 }, - "end": { "line": 524, "column": 19, "offset": 16284 } - } - }, - { - "type": "text", - "value": " method returns the byte of the ", - "position": { - "start": { "line": 524, "column": 19, "offset": 16284 }, - "end": { "line": 524, "column": 51, "offset": 16316 } - } - }, - { - "type": "inlineCode", - "value": "Blob", - "position": { - "start": { "line": 524, "column": 51, "offset": 16316 }, - "end": { "line": 524, "column": 57, "offset": 16322 } - } - }, - { - "type": "text", - "value": " object as a ", - "position": { - "start": { "line": 524, "column": 57, "offset": 16322 }, - "end": { "line": 524, "column": 70, "offset": 16335 } - } - }, - { - "type": "inlineCode", - "value": "Promise", - "position": { - "start": { "line": 524, "column": 70, "offset": 16335 }, - "end": { "line": 524, "column": 91, "offset": 16356 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 524, "column": 91, "offset": 16356 }, - "end": { "line": 524, "column": 92, "offset": 16357 } - } - } - ], - "position": { - "start": { "line": 524, "column": 1, "offset": 16266 }, - "end": { "line": 524, "column": 92, "offset": 16357 } - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "const blob = new Blob(['hello']);\nblob.bytes().then((bytes) => {\n console.log(bytes); // Outputs: Uint8Array(5) [ 104, 101, 108, 108, 111 ]\n});", - "position": { - "start": { "line": 526, "column": 1, "offset": 16359 }, - "end": { "line": 531, "column": 4, "offset": 16513 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "blob.size", - "position": { - "start": { "line": 533, "column": 5, "offset": 16519 }, - "end": { "line": 533, "column": 16, "offset": 16530 } - } - } - ], - "position": { - "start": { "line": 533, "column": 1, "offset": 16515 }, - "end": { "line": 533, "column": 16, "offset": 16530 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 535, "column": 1, "offset": 16532 }, - "end": { "line": 539, "column": 4, "offset": 16577 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The total size of the ", - "position": { - "start": { "line": 541, "column": 1, "offset": 16579 }, - "end": { "line": 541, "column": 23, "offset": 16601 } - } - }, - { - "type": "inlineCode", - "value": "Blob", - "position": { - "start": { "line": 541, "column": 23, "offset": 16601 }, - "end": { "line": 541, "column": 29, "offset": 16607 } - } - }, - { - "type": "text", - "value": " in bytes.", - "position": { - "start": { "line": 541, "column": 29, "offset": 16607 }, - "end": { "line": 541, "column": 39, "offset": 16617 } - } - } - ], - "position": { - "start": { "line": 541, "column": 1, "offset": 16579 }, - "end": { "line": 541, "column": 39, "offset": 16617 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "blob.slice([start[, end[, type]]])", - "position": { - "start": { "line": 543, "column": 5, "offset": 16623 }, - "end": { "line": 543, "column": 41, "offset": 16659 } - } - } - ], - "position": { - "start": { "line": 543, "column": 1, "offset": 16619 }, - "end": { "line": 543, "column": 41, "offset": 16659 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 545, "column": 1, "offset": 16661 }, - "end": { "line": 549, "column": 4, "offset": 16706 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "start", - "position": { - "start": { "line": 551, "column": 3, "offset": 16710 }, - "end": { "line": 551, "column": 10, "offset": 16717 } - } - }, - { - "type": "text", - "value": " {number} The starting index.", - "position": { - "start": { "line": 551, "column": 10, "offset": 16717 }, - "end": { "line": 551, "column": 39, "offset": 16746 } - } - } - ], - "position": { - "start": { "line": 551, "column": 3, "offset": 16710 }, - "end": { "line": 551, "column": 39, "offset": 16746 } - } - } - ], - "position": { - "start": { "line": 551, "column": 1, "offset": 16708 }, - "end": { "line": 551, "column": 39, "offset": 16746 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "end", - "position": { - "start": { "line": 552, "column": 3, "offset": 16749 }, - "end": { "line": 552, "column": 8, "offset": 16754 } - } - }, - { - "type": "text", - "value": " {number} The ending index.", - "position": { - "start": { "line": 552, "column": 8, "offset": 16754 }, - "end": { "line": 552, "column": 35, "offset": 16781 } - } - } - ], - "position": { - "start": { "line": 552, "column": 3, "offset": 16749 }, - "end": { "line": 552, "column": 35, "offset": 16781 } - } - } - ], - "position": { - "start": { "line": 552, "column": 1, "offset": 16747 }, - "end": { "line": 552, "column": 35, "offset": 16781 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "type", - "position": { - "start": { "line": 553, "column": 3, "offset": 16784 }, - "end": { "line": 553, "column": 9, "offset": 16790 } - } - }, - { - "type": "text", - "value": " {string} The content-type for the new ", - "position": { - "start": { "line": 553, "column": 9, "offset": 16790 }, - "end": { "line": 553, "column": 48, "offset": 16829 } - } - }, - { - "type": "inlineCode", - "value": "Blob", - "position": { - "start": { "line": 553, "column": 48, "offset": 16829 }, - "end": { "line": 553, "column": 54, "offset": 16835 } - } - } - ], - "position": { - "start": { "line": 553, "column": 3, "offset": 16784 }, - "end": { "line": 553, "column": 54, "offset": 16835 } - } - } - ], - "position": { - "start": { "line": 553, "column": 1, "offset": 16782 }, - "end": { "line": 553, "column": 54, "offset": 16835 } - } - } - ], - "position": { - "start": { "line": 551, "column": 1, "offset": 16708 }, - "end": { "line": 553, "column": 54, "offset": 16835 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Creates and returns a new ", - "position": { - "start": { "line": 555, "column": 1, "offset": 16837 }, - "end": { "line": 555, "column": 27, "offset": 16863 } - } - }, - { - "type": "inlineCode", - "value": "Blob", - "position": { - "start": { "line": 555, "column": 27, "offset": 16863 }, - "end": { "line": 555, "column": 33, "offset": 16869 } - } - }, - { - "type": "text", - "value": " containing a subset of this ", - "position": { - "start": { "line": 555, "column": 33, "offset": 16869 }, - "end": { "line": 555, "column": 62, "offset": 16898 } - } - }, - { - "type": "inlineCode", - "value": "Blob", - "position": { - "start": { "line": 555, "column": 62, "offset": 16898 }, - "end": { "line": 555, "column": 68, "offset": 16904 } - } - }, - { - "type": "text", - "value": " objects\ndata. The original ", - "position": { - "start": { "line": 555, "column": 68, "offset": 16904 }, - "end": { "line": 556, "column": 20, "offset": 16932 } - } - }, - { - "type": "inlineCode", - "value": "Blob", - "position": { - "start": { "line": 556, "column": 20, "offset": 16932 }, - "end": { "line": 556, "column": 26, "offset": 16938 } - } - }, - { - "type": "text", - "value": " is not altered.", - "position": { - "start": { "line": 556, "column": 26, "offset": 16938 }, - "end": { "line": 556, "column": 42, "offset": 16954 } - } - } - ], - "position": { - "start": { "line": 555, "column": 1, "offset": 16837 }, - "end": { "line": 556, "column": 42, "offset": 16954 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "blob.stream()", - "position": { - "start": { "line": 558, "column": 5, "offset": 16960 }, - "end": { "line": 558, "column": 20, "offset": 16975 } - } - } - ], - "position": { - "start": { "line": 558, "column": 1, "offset": 16956 }, - "end": { "line": 558, "column": 20, "offset": 16975 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 560, "column": 1, "offset": 16977 }, - "end": { "line": 562, "column": 4, "offset": 17005 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {ReadableStream}", - "position": { - "start": { "line": 564, "column": 3, "offset": 17009 }, - "end": { "line": 564, "column": 28, "offset": 17034 } - } - } - ], - "position": { - "start": { "line": 564, "column": 3, "offset": 17009 }, - "end": { "line": 564, "column": 28, "offset": 17034 } - } - } - ], - "position": { - "start": { "line": 564, "column": 1, "offset": 17007 }, - "end": { "line": 564, "column": 28, "offset": 17034 } - } - } - ], - "position": { - "start": { "line": 564, "column": 1, "offset": 17007 }, - "end": { "line": 564, "column": 28, "offset": 17034 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns a new ", - "position": { - "start": { "line": 566, "column": 1, "offset": 17036 }, - "end": { "line": 566, "column": 15, "offset": 17050 } - } - }, - { - "type": "inlineCode", - "value": "ReadableStream", - "position": { - "start": { "line": 566, "column": 15, "offset": 17050 }, - "end": { "line": 566, "column": 31, "offset": 17066 } - } - }, - { - "type": "text", - "value": " that allows the content of the ", - "position": { - "start": { "line": 566, "column": 31, "offset": 17066 }, - "end": { "line": 566, "column": 63, "offset": 17098 } - } - }, - { - "type": "inlineCode", - "value": "Blob", - "position": { - "start": { "line": 566, "column": 63, "offset": 17098 }, - "end": { "line": 566, "column": 69, "offset": 17104 } - } - }, - { - "type": "text", - "value": " to be read.", - "position": { - "start": { "line": 566, "column": 69, "offset": 17104 }, - "end": { "line": 566, "column": 81, "offset": 17116 } - } - } - ], - "position": { - "start": { "line": 566, "column": 1, "offset": 17036 }, - "end": { "line": 566, "column": 81, "offset": 17116 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "blob.text()", - "position": { - "start": { "line": 568, "column": 5, "offset": 17122 }, - "end": { "line": 568, "column": 18, "offset": 17135 } - } - } - ], - "position": { - "start": { "line": 568, "column": 1, "offset": 17118 }, - "end": { "line": 568, "column": 18, "offset": 17135 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 570, "column": 1, "offset": 17137 }, - "end": { "line": 574, "column": 4, "offset": 17182 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {Promise}", - "position": { - "start": { "line": 576, "column": 3, "offset": 17186 }, - "end": { "line": 576, "column": 21, "offset": 17204 } - } - } - ], - "position": { - "start": { "line": 576, "column": 3, "offset": 17186 }, - "end": { "line": 576, "column": 21, "offset": 17204 } - } - } - ], - "position": { - "start": { "line": 576, "column": 1, "offset": 17184 }, - "end": { "line": 576, "column": 21, "offset": 17204 } - } - } - ], - "position": { - "start": { "line": 576, "column": 1, "offset": 17184 }, - "end": { "line": 576, "column": 21, "offset": 17204 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns a promise that fulfills with the contents of the ", - "position": { - "start": { "line": 578, "column": 1, "offset": 17206 }, - "end": { "line": 578, "column": 58, "offset": 17263 } - } - }, - { - "type": "inlineCode", - "value": "Blob", - "position": { - "start": { "line": 578, "column": 58, "offset": 17263 }, - "end": { "line": 578, "column": 64, "offset": 17269 } - } - }, - { - "type": "text", - "value": " decoded as a\nUTF-8 string.", - "position": { - "start": { "line": 578, "column": 64, "offset": 17269 }, - "end": { "line": 579, "column": 14, "offset": 17296 } - } - } - ], - "position": { - "start": { "line": 578, "column": 1, "offset": 17206 }, - "end": { "line": 579, "column": 14, "offset": 17296 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "blob.type", - "position": { - "start": { "line": 581, "column": 5, "offset": 17302 }, - "end": { "line": 581, "column": 16, "offset": 17313 } - } - } - ], - "position": { - "start": { "line": 581, "column": 1, "offset": 17298 }, - "end": { "line": 581, "column": 16, "offset": 17313 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 583, "column": 1, "offset": 17315 }, - "end": { "line": 587, "column": 4, "offset": 17360 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Type: {string}", - "position": { - "start": { "line": 589, "column": 3, "offset": 17364 }, - "end": { "line": 589, "column": 17, "offset": 17378 } - } - } - ], - "position": { - "start": { "line": 589, "column": 3, "offset": 17364 }, - "end": { "line": 589, "column": 17, "offset": 17378 } - } - } - ], - "position": { - "start": { "line": 589, "column": 1, "offset": 17362 }, - "end": { "line": 589, "column": 17, "offset": 17378 } - } - } - ], - "position": { - "start": { "line": 589, "column": 1, "offset": 17362 }, - "end": { "line": 589, "column": 17, "offset": 17378 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The content-type of the ", - "position": { - "start": { "line": 591, "column": 1, "offset": 17380 }, - "end": { "line": 591, "column": 25, "offset": 17404 } - } - }, - { - "type": "inlineCode", - "value": "Blob", - "position": { - "start": { "line": 591, "column": 25, "offset": 17404 }, - "end": { "line": 591, "column": 31, "offset": 17410 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 591, "column": 31, "offset": 17410 }, - "end": { "line": 591, "column": 32, "offset": 17411 } - } - } - ], - "position": { - "start": { "line": 591, "column": 1, "offset": 17380 }, - "end": { "line": 591, "column": 32, "offset": 17411 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "Blob", - "position": { - "start": { "line": 593, "column": 5, "offset": 17417 }, - "end": { "line": 593, "column": 11, "offset": 17423 } - } - }, - { - "type": "text", - "value": " objects and ", - "position": { - "start": { "line": 593, "column": 11, "offset": 17423 }, - "end": { "line": 593, "column": 24, "offset": 17436 } - } - }, - { - "type": "inlineCode", - "value": "MessageChannel", - "position": { - "start": { "line": 593, "column": 24, "offset": 17436 }, - "end": { "line": 593, "column": 40, "offset": 17452 } - } - } - ], - "position": { - "start": { "line": 593, "column": 1, "offset": 17413 }, - "end": { "line": 593, "column": 40, "offset": 17452 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Once a {Blob} object is created, it can be sent via ", - "position": { - "start": { "line": 595, "column": 1, "offset": 17454 }, - "end": { "line": 595, "column": 53, "offset": 17506 } - } - }, - { - "type": "inlineCode", - "value": "MessagePort", - "position": { - "start": { "line": 595, "column": 53, "offset": 17506 }, - "end": { "line": 595, "column": 66, "offset": 17519 } - } - }, - { - "type": "text", - "value": " to multiple\ndestinations without transferring or immediately copying the data. The data\ncontained by the ", - "position": { - "start": { "line": 595, "column": 66, "offset": 17519 }, - "end": { "line": 597, "column": 18, "offset": 17625 } - } - }, - { - "type": "inlineCode", - "value": "Blob", - "position": { - "start": { "line": 597, "column": 18, "offset": 17625 }, - "end": { "line": 597, "column": 24, "offset": 17631 } - } - }, - { - "type": "text", - "value": " is copied only when the ", - "position": { - "start": { "line": 597, "column": 24, "offset": 17631 }, - "end": { "line": 597, "column": 49, "offset": 17656 } - } - }, - { - "type": "inlineCode", - "value": "arrayBuffer()", - "position": { - "start": { "line": 597, "column": 49, "offset": 17656 }, - "end": { "line": 597, "column": 64, "offset": 17671 } - } - }, - { - "type": "text", - "value": " or ", - "position": { - "start": { "line": 597, "column": 64, "offset": 17671 }, - "end": { "line": 597, "column": 68, "offset": 17675 } - } - }, - { - "type": "inlineCode", - "value": "text()", - "position": { - "start": { "line": 597, "column": 68, "offset": 17675 }, - "end": { "line": 597, "column": 76, "offset": 17683 } - } - }, - { - "type": "text", - "value": "\nmethods are called.", - "position": { - "start": { "line": 597, "column": 76, "offset": 17683 }, - "end": { "line": 598, "column": 20, "offset": 17703 } - } - } - ], - "position": { - "start": { "line": 595, "column": 1, "offset": 17454 }, - "end": { "line": 598, "column": 20, "offset": 17703 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Blob } from 'node:buffer';\nimport { setTimeout as delay } from 'node:timers/promises';\n\nconst blob = new Blob(['hello there']);\n\nconst mc1 = new MessageChannel();\nconst mc2 = new MessageChannel();\n\nmc1.port1.onmessage = async ({ data }) => {\n console.log(await data.arrayBuffer());\n mc1.port1.close();\n};\n\nmc2.port1.onmessage = async ({ data }) => {\n await delay(1000);\n console.log(await data.arrayBuffer());\n mc2.port1.close();\n};\n\nmc1.port2.postMessage(blob);\nmc2.port2.postMessage(blob);\n\n// The Blob is still usable after posting.\nblob.text().then(console.log);", - "position": { - "start": { "line": 600, "column": 1, "offset": 17705 }, - "end": { "line": 625, "column": 4, "offset": 18296 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Blob } = require('node:buffer');\nconst { setTimeout: delay } = require('node:timers/promises');\n\nconst blob = new Blob(['hello there']);\n\nconst mc1 = new MessageChannel();\nconst mc2 = new MessageChannel();\n\nmc1.port1.onmessage = async ({ data }) => {\n console.log(await data.arrayBuffer());\n mc1.port1.close();\n};\n\nmc2.port1.onmessage = async ({ data }) => {\n await delay(1000);\n console.log(await data.arrayBuffer());\n mc2.port1.close();\n};\n\nmc1.port2.postMessage(blob);\nmc2.port2.postMessage(blob);\n\n// The Blob is still usable after posting.\nblob.text().then(console.log);", - "position": { - "start": { "line": 627, "column": 1, "offset": 18298 }, - "end": { "line": 652, "column": 4, "offset": 18897 } - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "Class: ", - "position": { - "start": { "line": 654, "column": 4, "offset": 18902 }, - "end": { "line": 654, "column": 11, "offset": 18909 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 654, "column": 11, "offset": 18909 }, - "end": { "line": 654, "column": 19, "offset": 18917 } - } - } - ], - "position": { - "start": { "line": 654, "column": 1, "offset": 18899 }, - "end": { "line": 654, "column": 19, "offset": 18917 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The ", - "position": { - "start": { "line": 656, "column": 1, "offset": 18919 }, - "end": { "line": 656, "column": 5, "offset": 18923 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 656, "column": 5, "offset": 18923 }, - "end": { "line": 656, "column": 13, "offset": 18931 } - } - }, - { - "type": "text", - "value": " class is a global type for dealing with binary data directly.\nIt can be constructed in a variety of ways.", - "position": { - "start": { "line": 656, "column": 13, "offset": 18931 }, - "end": { "line": 657, "column": 44, "offset": 19037 } - } - } - ], - "position": { - "start": { "line": 656, "column": 1, "offset": 18919 }, - "end": { "line": 657, "column": 44, "offset": 19037 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "text", - "value": "Static method: ", - "position": { - "start": { "line": 659, "column": 5, "offset": 19043 }, - "end": { "line": 659, "column": 20, "offset": 19058 } - } - }, - { - "type": "inlineCode", - "value": "Buffer.alloc(size[, fill[, encoding]])", - "position": { - "start": { "line": 659, "column": 20, "offset": 19058 }, - "end": { "line": 659, "column": 60, "offset": 19098 } - } - } - ], - "position": { - "start": { "line": 659, "column": 1, "offset": 19039 }, - "end": { "line": 659, "column": 60, "offset": 19098 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 661, "column": 1, "offset": 19100 }, - "end": { "line": 684, "column": 4, "offset": 20125 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "size", - "position": { - "start": { "line": 686, "column": 3, "offset": 20129 }, - "end": { "line": 686, "column": 9, "offset": 20135 } - } - }, - { - "type": "text", - "value": " {integer} The desired length of the new ", - "position": { - "start": { "line": 686, "column": 9, "offset": 20135 }, - "end": { "line": 686, "column": 50, "offset": 20176 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 686, "column": 50, "offset": 20176 }, - "end": { "line": 686, "column": 58, "offset": 20184 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 686, "column": 58, "offset": 20184 }, - "end": { "line": 686, "column": 59, "offset": 20185 } - } - } - ], - "position": { - "start": { "line": 686, "column": 3, "offset": 20129 }, - "end": { "line": 686, "column": 59, "offset": 20185 } - } - } - ], - "position": { - "start": { "line": 686, "column": 1, "offset": 20127 }, - "end": { "line": 686, "column": 59, "offset": 20185 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "fill", - "position": { - "start": { "line": 687, "column": 3, "offset": 20188 }, - "end": { "line": 687, "column": 9, "offset": 20194 } - } - }, - { - "type": "text", - "value": " {string|Buffer|Uint8Array|integer} A value to pre-fill the new ", - "position": { - "start": { "line": 687, "column": 9, "offset": 20194 }, - "end": { "line": 687, "column": 73, "offset": 20258 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 687, "column": 73, "offset": 20258 }, - "end": { "line": 687, "column": 81, "offset": 20266 } - } - }, - { - "type": "text", - "value": "\nwith. ", - "position": { - "start": { "line": 687, "column": 81, "offset": 20266 }, - "end": { "line": 688, "column": 9, "offset": 20275 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { "line": 688, "column": 11, "offset": 20277 }, - "end": { "line": 688, "column": 19, "offset": 20285 } - } - } - ], - "position": { - "start": { "line": 688, "column": 9, "offset": 20275 }, - "end": { "line": 688, "column": 21, "offset": 20287 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 688, "column": 21, "offset": 20287 }, - "end": { "line": 688, "column": 22, "offset": 20288 } - } - }, - { - "type": "inlineCode", - "value": "0", - "position": { - "start": { "line": 688, "column": 22, "offset": 20288 }, - "end": { "line": 688, "column": 25, "offset": 20291 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 688, "column": 25, "offset": 20291 }, - "end": { "line": 688, "column": 26, "offset": 20292 } - } - } - ], - "position": { - "start": { "line": 687, "column": 3, "offset": 20188 }, - "end": { "line": 688, "column": 26, "offset": 20292 } - } - } - ], - "position": { - "start": { "line": 687, "column": 1, "offset": 20186 }, - "end": { "line": 688, "column": 26, "offset": 20292 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "encoding", - "position": { - "start": { "line": 689, "column": 3, "offset": 20295 }, - "end": { "line": 689, "column": 13, "offset": 20305 } - } - }, - { - "type": "text", - "value": " {string} If ", - "position": { - "start": { "line": 689, "column": 13, "offset": 20305 }, - "end": { "line": 689, "column": 26, "offset": 20318 } - } - }, - { - "type": "inlineCode", - "value": "fill", - "position": { - "start": { "line": 689, "column": 26, "offset": 20318 }, - "end": { "line": 689, "column": 32, "offset": 20324 } - } - }, - { - "type": "text", - "value": " is a string, this is its encoding.\n", - "position": { - "start": { "line": 689, "column": 32, "offset": 20324 }, - "end": { "line": 690, "column": 1, "offset": 20360 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { "line": 690, "column": 5, "offset": 20364 }, - "end": { "line": 690, "column": 13, "offset": 20372 } - } - } - ], - "position": { - "start": { "line": 690, "column": 3, "offset": 20362 }, - "end": { "line": 690, "column": 15, "offset": 20374 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 690, "column": 15, "offset": 20374 }, - "end": { "line": 690, "column": 16, "offset": 20375 } - } - }, - { - "type": "inlineCode", - "value": "'utf8'", - "position": { - "start": { "line": 690, "column": 16, "offset": 20375 }, - "end": { "line": 690, "column": 24, "offset": 20383 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 690, "column": 24, "offset": 20383 }, - "end": { "line": 690, "column": 25, "offset": 20384 } - } - } - ], - "position": { - "start": { "line": 689, "column": 3, "offset": 20295 }, - "end": { "line": 690, "column": 25, "offset": 20384 } - } - } - ], - "position": { - "start": { "line": 689, "column": 1, "offset": 20293 }, - "end": { "line": 690, "column": 25, "offset": 20384 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {Buffer}", - "position": { - "start": { "line": 691, "column": 3, "offset": 20387 }, - "end": { "line": 691, "column": 20, "offset": 20404 } - } - } - ], - "position": { - "start": { "line": 691, "column": 3, "offset": 20387 }, - "end": { "line": 691, "column": 20, "offset": 20404 } - } - } - ], - "position": { - "start": { "line": 691, "column": 1, "offset": 20385 }, - "end": { "line": 691, "column": 20, "offset": 20404 } - } - } - ], - "position": { - "start": { "line": 686, "column": 1, "offset": 20127 }, - "end": { "line": 691, "column": 20, "offset": 20404 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Allocates a new ", - "position": { - "start": { "line": 693, "column": 1, "offset": 20406 }, - "end": { "line": 693, "column": 17, "offset": 20422 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 693, "column": 17, "offset": 20422 }, - "end": { "line": 693, "column": 25, "offset": 20430 } - } - }, - { - "type": "text", - "value": " of ", - "position": { - "start": { "line": 693, "column": 25, "offset": 20430 }, - "end": { "line": 693, "column": 29, "offset": 20434 } - } - }, - { - "type": "inlineCode", - "value": "size", - "position": { - "start": { "line": 693, "column": 29, "offset": 20434 }, - "end": { "line": 693, "column": 35, "offset": 20440 } - } - }, - { - "type": "text", - "value": " bytes. If ", - "position": { - "start": { "line": 693, "column": 35, "offset": 20440 }, - "end": { "line": 693, "column": 46, "offset": 20451 } - } - }, - { - "type": "inlineCode", - "value": "fill", - "position": { - "start": { "line": 693, "column": 46, "offset": 20451 }, - "end": { "line": 693, "column": 52, "offset": 20457 } - } - }, - { - "type": "text", - "value": " is ", - "position": { - "start": { "line": 693, "column": 52, "offset": 20457 }, - "end": { "line": 693, "column": 56, "offset": 20461 } - } - }, - { - "type": "inlineCode", - "value": "undefined", - "position": { - "start": { "line": 693, "column": 56, "offset": 20461 }, - "end": { "line": 693, "column": 67, "offset": 20472 } - } - }, - { - "type": "text", - "value": ", the\n", - "position": { - "start": { "line": 693, "column": 67, "offset": 20472 }, - "end": { "line": 694, "column": 1, "offset": 20478 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 694, "column": 1, "offset": 20478 }, - "end": { "line": 694, "column": 9, "offset": 20486 } - } - }, - { - "type": "text", - "value": " will be zero-filled.", - "position": { - "start": { "line": 694, "column": 9, "offset": 20486 }, - "end": { "line": 694, "column": 30, "offset": 20507 } - } - } - ], - "position": { - "start": { "line": 693, "column": 1, "offset": 20406 }, - "end": { "line": 694, "column": 30, "offset": 20507 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.alloc(5);\n\nconsole.log(buf);\n// Prints: ", - "position": { - "start": { "line": 696, "column": 1, "offset": 20509 }, - "end": { "line": 703, "column": 4, "offset": 20641 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.alloc(5);\n\nconsole.log(buf);\n// Prints: ", - "position": { - "start": { "line": 705, "column": 1, "offset": 20643 }, - "end": { "line": 712, "column": 4, "offset": 20780 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "If ", - "position": { - "start": { "line": 714, "column": 1, "offset": 20782 }, - "end": { "line": 714, "column": 4, "offset": 20785 } - } - }, - { - "type": "inlineCode", - "value": "size", - "position": { - "start": { "line": 714, "column": 4, "offset": 20785 }, - "end": { "line": 714, "column": 10, "offset": 20791 } - } - }, - { - "type": "text", - "value": " is larger than\n", - "position": { - "start": { "line": 714, "column": 10, "offset": 20791 }, - "end": { "line": 715, "column": 1, "offset": 20807 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "buffer.constants.MAX_LENGTH", - "position": { - "start": { "line": 715, "column": 2, "offset": 20808 }, - "end": { "line": 715, "column": 31, "offset": 20837 } - } - } - ], - "position": { - "start": { "line": 715, "column": 1, "offset": 20807 }, - "end": { "line": 715, "column": 34, "offset": 20840 } - }, - "label": "`buffer.constants.MAX_LENGTH`", - "identifier": "`buffer.constants.max_length`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": " or smaller than 0, ", - "position": { - "start": { "line": 715, "column": 34, "offset": 20840 }, - "end": { "line": 715, "column": 54, "offset": 20860 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "ERR_OUT_OF_RANGE", - "position": { - "start": { "line": 715, "column": 55, "offset": 20861 }, - "end": { "line": 715, "column": 73, "offset": 20879 } - } - } - ], - "position": { - "start": { "line": 715, "column": 54, "offset": 20860 }, - "end": { "line": 715, "column": 76, "offset": 20882 } - }, - "label": "`ERR_OUT_OF_RANGE`", - "identifier": "`err_out_of_range`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": "\nis thrown.", - "position": { - "start": { "line": 715, "column": 76, "offset": 20882 }, - "end": { "line": 716, "column": 11, "offset": 20893 } - } - } - ], - "position": { - "start": { "line": 714, "column": 1, "offset": 20782 }, - "end": { "line": 716, "column": 11, "offset": 20893 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "If ", - "position": { - "start": { "line": 718, "column": 1, "offset": 20895 }, - "end": { "line": 718, "column": 4, "offset": 20898 } - } - }, - { - "type": "inlineCode", - "value": "fill", - "position": { - "start": { "line": 718, "column": 4, "offset": 20898 }, - "end": { "line": 718, "column": 10, "offset": 20904 } - } - }, - { - "type": "text", - "value": " is specified, the allocated ", - "position": { - "start": { "line": 718, "column": 10, "offset": 20904 }, - "end": { "line": 718, "column": 39, "offset": 20933 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 718, "column": 39, "offset": 20933 }, - "end": { "line": 718, "column": 47, "offset": 20941 } - } - }, - { - "type": "text", - "value": " will be initialized by calling\n", - "position": { - "start": { "line": 718, "column": 47, "offset": 20941 }, - "end": { "line": 719, "column": 1, "offset": 20973 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "buf.fill(fill)", - "position": { - "start": { "line": 719, "column": 2, "offset": 20974 }, - "end": { "line": 719, "column": 18, "offset": 20990 } - } - } - ], - "position": { - "start": { "line": 719, "column": 1, "offset": 20973 }, - "end": { "line": 719, "column": 33, "offset": 21005 } - }, - "label": "`buf.fill()`", - "identifier": "`buf.fill()`", - "referenceType": "full" - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 719, "column": 33, "offset": 21005 }, - "end": { "line": 719, "column": 34, "offset": 21006 } - } - } - ], - "position": { - "start": { "line": 718, "column": 1, "offset": 20895 }, - "end": { "line": 719, "column": 34, "offset": 21006 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.alloc(5, 'a');\n\nconsole.log(buf);\n// Prints: ", - "position": { - "start": { "line": 721, "column": 1, "offset": 21008 }, - "end": { "line": 728, "column": 4, "offset": 21145 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.alloc(5, 'a');\n\nconsole.log(buf);\n// Prints: ", - "position": { - "start": { "line": 730, "column": 1, "offset": 21147 }, - "end": { "line": 737, "column": 4, "offset": 21289 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "If both ", - "position": { - "start": { "line": 739, "column": 1, "offset": 21291 }, - "end": { "line": 739, "column": 9, "offset": 21299 } - } - }, - { - "type": "inlineCode", - "value": "fill", - "position": { - "start": { "line": 739, "column": 9, "offset": 21299 }, - "end": { "line": 739, "column": 15, "offset": 21305 } - } - }, - { - "type": "text", - "value": " and ", - "position": { - "start": { "line": 739, "column": 15, "offset": 21305 }, - "end": { "line": 739, "column": 20, "offset": 21310 } - } - }, - { - "type": "inlineCode", - "value": "encoding", - "position": { - "start": { "line": 739, "column": 20, "offset": 21310 }, - "end": { "line": 739, "column": 30, "offset": 21320 } - } - }, - { - "type": "text", - "value": " are specified, the allocated ", - "position": { - "start": { "line": 739, "column": 30, "offset": 21320 }, - "end": { "line": 739, "column": 60, "offset": 21350 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 739, "column": 60, "offset": 21350 }, - "end": { "line": 739, "column": 68, "offset": 21358 } - } - }, - { - "type": "text", - "value": " will be\ninitialized by calling ", - "position": { - "start": { "line": 739, "column": 68, "offset": 21358 }, - "end": { "line": 740, "column": 24, "offset": 21390 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "buf.fill(fill, encoding)", - "position": { - "start": { "line": 740, "column": 25, "offset": 21391 }, - "end": { "line": 740, "column": 51, "offset": 21417 } - } - } - ], - "position": { - "start": { "line": 740, "column": 24, "offset": 21390 }, - "end": { "line": 740, "column": 66, "offset": 21432 } - }, - "label": "`buf.fill()`", - "identifier": "`buf.fill()`", - "referenceType": "full" - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 740, "column": 66, "offset": 21432 }, - "end": { "line": 740, "column": 67, "offset": 21433 } - } - } - ], - "position": { - "start": { "line": 739, "column": 1, "offset": 21291 }, - "end": { "line": 740, "column": 67, "offset": 21433 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.alloc(11, 'aGVsbG8gd29ybGQ=', 'base64');\n\nconsole.log(buf);\n// Prints: ", - "position": { - "start": { "line": 742, "column": 1, "offset": 21435 }, - "end": { "line": 749, "column": 4, "offset": 21616 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.alloc(11, 'aGVsbG8gd29ybGQ=', 'base64');\n\nconsole.log(buf);\n// Prints: ", - "position": { - "start": { "line": 751, "column": 1, "offset": 21618 }, - "end": { "line": 758, "column": 4, "offset": 21804 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calling ", - "position": { - "start": { "line": 760, "column": 1, "offset": 21806 }, - "end": { "line": 760, "column": 9, "offset": 21814 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "Buffer.alloc()", - "position": { - "start": { "line": 760, "column": 10, "offset": 21815 }, - "end": { "line": 760, "column": 26, "offset": 21831 } - } - } - ], - "position": { - "start": { "line": 760, "column": 9, "offset": 21814 }, - "end": { "line": 760, "column": 29, "offset": 21834 } - }, - "label": "`Buffer.alloc()`", - "identifier": "`buffer.alloc()`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": " can be measurably slower than the alternative\n", - "position": { - "start": { "line": 760, "column": 29, "offset": 21834 }, - "end": { "line": 761, "column": 1, "offset": 21881 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "Buffer.allocUnsafe()", - "position": { - "start": { "line": 761, "column": 2, "offset": 21882 }, - "end": { "line": 761, "column": 24, "offset": 21904 } - } - } - ], - "position": { - "start": { "line": 761, "column": 1, "offset": 21881 }, - "end": { "line": 761, "column": 27, "offset": 21907 } - }, - "label": "`Buffer.allocUnsafe()`", - "identifier": "`buffer.allocunsafe()`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": " but ensures that the newly created ", - "position": { - "start": { "line": 761, "column": 27, "offset": 21907 }, - "end": { "line": 761, "column": 63, "offset": 21943 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 761, "column": 63, "offset": 21943 }, - "end": { "line": 761, "column": 71, "offset": 21951 } - } - }, - { - "type": "text", - "value": " instance\ncontents will never contain sensitive data from previous allocations, including\ndata that might not have been allocated for ", - "position": { - "start": { "line": 761, "column": 71, "offset": 21951 }, - "end": { "line": 763, "column": 45, "offset": 22085 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 763, "column": 45, "offset": 22085 }, - "end": { "line": 763, "column": 53, "offset": 22093 } - } - }, - { - "type": "text", - "value": "s.", - "position": { - "start": { "line": 763, "column": 53, "offset": 22093 }, - "end": { "line": 763, "column": 55, "offset": 22095 } - } - } - ], - "position": { - "start": { "line": 760, "column": 1, "offset": 21806 }, - "end": { "line": 763, "column": 55, "offset": 22095 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A ", - "position": { - "start": { "line": 765, "column": 1, "offset": 22097 }, - "end": { "line": 765, "column": 3, "offset": 22099 } - } - }, - { - "type": "inlineCode", - "value": "TypeError", - "position": { - "start": { "line": 765, "column": 3, "offset": 22099 }, - "end": { "line": 765, "column": 14, "offset": 22110 } - } - }, - { - "type": "text", - "value": " will be thrown if ", - "position": { - "start": { "line": 765, "column": 14, "offset": 22110 }, - "end": { "line": 765, "column": 33, "offset": 22129 } - } - }, - { - "type": "inlineCode", - "value": "size", - "position": { - "start": { "line": 765, "column": 33, "offset": 22129 }, - "end": { "line": 765, "column": 39, "offset": 22135 } - } - }, - { - "type": "text", - "value": " is not a number.", - "position": { - "start": { "line": 765, "column": 39, "offset": 22135 }, - "end": { "line": 765, "column": 56, "offset": 22152 } - } - } - ], - "position": { - "start": { "line": 765, "column": 1, "offset": 22097 }, - "end": { "line": 765, "column": 56, "offset": 22152 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "text", - "value": "Static method: ", - "position": { - "start": { "line": 767, "column": 5, "offset": 22158 }, - "end": { "line": 767, "column": 20, "offset": 22173 } - } - }, - { - "type": "inlineCode", - "value": "Buffer.allocUnsafe(size)", - "position": { - "start": { "line": 767, "column": 20, "offset": 22173 }, - "end": { "line": 767, "column": 46, "offset": 22199 } - } - } - ], - "position": { - "start": { "line": 767, "column": 1, "offset": 22154 }, - "end": { "line": 767, "column": 46, "offset": 22199 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 769, "column": 1, "offset": 22201 }, - "end": { "line": 783, "column": 4, "offset": 22796 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "size", - "position": { - "start": { "line": 785, "column": 3, "offset": 22800 }, - "end": { "line": 785, "column": 9, "offset": 22806 } - } - }, - { - "type": "text", - "value": " {integer} The desired length of the new ", - "position": { - "start": { "line": 785, "column": 9, "offset": 22806 }, - "end": { "line": 785, "column": 50, "offset": 22847 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 785, "column": 50, "offset": 22847 }, - "end": { "line": 785, "column": 58, "offset": 22855 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 785, "column": 58, "offset": 22855 }, - "end": { "line": 785, "column": 59, "offset": 22856 } - } - } - ], - "position": { - "start": { "line": 785, "column": 3, "offset": 22800 }, - "end": { "line": 785, "column": 59, "offset": 22856 } - } - } - ], - "position": { - "start": { "line": 785, "column": 1, "offset": 22798 }, - "end": { "line": 785, "column": 59, "offset": 22856 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {Buffer}", - "position": { - "start": { "line": 786, "column": 3, "offset": 22859 }, - "end": { "line": 786, "column": 20, "offset": 22876 } - } - } - ], - "position": { - "start": { "line": 786, "column": 3, "offset": 22859 }, - "end": { "line": 786, "column": 20, "offset": 22876 } - } - } - ], - "position": { - "start": { "line": 786, "column": 1, "offset": 22857 }, - "end": { "line": 786, "column": 20, "offset": 22876 } - } - } - ], - "position": { - "start": { "line": 785, "column": 1, "offset": 22798 }, - "end": { "line": 786, "column": 20, "offset": 22876 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Allocates a new ", - "position": { - "start": { "line": 788, "column": 1, "offset": 22878 }, - "end": { "line": 788, "column": 17, "offset": 22894 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 788, "column": 17, "offset": 22894 }, - "end": { "line": 788, "column": 25, "offset": 22902 } - } - }, - { - "type": "text", - "value": " of ", - "position": { - "start": { "line": 788, "column": 25, "offset": 22902 }, - "end": { "line": 788, "column": 29, "offset": 22906 } - } - }, - { - "type": "inlineCode", - "value": "size", - "position": { - "start": { "line": 788, "column": 29, "offset": 22906 }, - "end": { "line": 788, "column": 35, "offset": 22912 } - } - }, - { - "type": "text", - "value": " bytes. If ", - "position": { - "start": { "line": 788, "column": 35, "offset": 22912 }, - "end": { "line": 788, "column": 46, "offset": 22923 } - } - }, - { - "type": "inlineCode", - "value": "size", - "position": { - "start": { "line": 788, "column": 46, "offset": 22923 }, - "end": { "line": 788, "column": 52, "offset": 22929 } - } - }, - { - "type": "text", - "value": " is larger than\n", - "position": { - "start": { "line": 788, "column": 52, "offset": 22929 }, - "end": { "line": 789, "column": 1, "offset": 22945 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "buffer.constants.MAX_LENGTH", - "position": { - "start": { "line": 789, "column": 2, "offset": 22946 }, - "end": { "line": 789, "column": 31, "offset": 22975 } - } - } - ], - "position": { - "start": { "line": 789, "column": 1, "offset": 22945 }, - "end": { "line": 789, "column": 34, "offset": 22978 } - }, - "label": "`buffer.constants.MAX_LENGTH`", - "identifier": "`buffer.constants.max_length`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": " or smaller than 0, ", - "position": { - "start": { "line": 789, "column": 34, "offset": 22978 }, - "end": { "line": 789, "column": 54, "offset": 22998 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "ERR_OUT_OF_RANGE", - "position": { - "start": { "line": 789, "column": 55, "offset": 22999 }, - "end": { "line": 789, "column": 73, "offset": 23017 } - } - } - ], - "position": { - "start": { "line": 789, "column": 54, "offset": 22998 }, - "end": { "line": 789, "column": 76, "offset": 23020 } - }, - "label": "`ERR_OUT_OF_RANGE`", - "identifier": "`err_out_of_range`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": "\nis thrown.", - "position": { - "start": { "line": 789, "column": 76, "offset": 23020 }, - "end": { "line": 790, "column": 11, "offset": 23031 } - } - } - ], - "position": { - "start": { "line": 788, "column": 1, "offset": 22878 }, - "end": { "line": 790, "column": 11, "offset": 23031 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The underlying memory for ", - "position": { - "start": { "line": 792, "column": 1, "offset": 23033 }, - "end": { "line": 792, "column": 27, "offset": 23059 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 792, "column": 27, "offset": 23059 }, - "end": { "line": 792, "column": 35, "offset": 23067 } - } - }, - { - "type": "text", - "value": " instances created in this way is ", - "position": { - "start": { "line": 792, "column": 35, "offset": 23067 }, - "end": { "line": 792, "column": 69, "offset": 23101 } - } - }, - { - "type": "emphasis", - "children": [ - { - "type": "text", - "value": "not\ninitialized", - "position": { - "start": { "line": 792, "column": 70, "offset": 23102 }, - "end": { "line": 793, "column": 12, "offset": 23117 } - } - } - ], - "position": { - "start": { "line": 792, "column": 69, "offset": 23101 }, - "end": { "line": 793, "column": 13, "offset": 23118 } - } - }, - { - "type": "text", - "value": ". The contents of the newly created ", - "position": { - "start": { "line": 793, "column": 13, "offset": 23118 }, - "end": { "line": 793, "column": 49, "offset": 23154 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 793, "column": 49, "offset": 23154 }, - "end": { "line": 793, "column": 57, "offset": 23162 } - } - }, - { - "type": "text", - "value": " are unknown and\n", - "position": { - "start": { "line": 793, "column": 57, "offset": 23162 }, - "end": { "line": 794, "column": 1, "offset": 23179 } - } - }, - { - "type": "emphasis", - "children": [ - { - "type": "text", - "value": "may contain sensitive data", - "position": { - "start": { "line": 794, "column": 2, "offset": 23180 }, - "end": { "line": 794, "column": 28, "offset": 23206 } - } - } - ], - "position": { - "start": { "line": 794, "column": 1, "offset": 23179 }, - "end": { "line": 794, "column": 29, "offset": 23207 } - } - }, - { - "type": "text", - "value": ". Use ", - "position": { - "start": { "line": 794, "column": 29, "offset": 23207 }, - "end": { "line": 794, "column": 35, "offset": 23213 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "Buffer.alloc()", - "position": { - "start": { "line": 794, "column": 36, "offset": 23214 }, - "end": { "line": 794, "column": 52, "offset": 23230 } - } - } - ], - "position": { - "start": { "line": 794, "column": 35, "offset": 23213 }, - "end": { "line": 794, "column": 55, "offset": 23233 } - }, - "label": "`Buffer.alloc()`", - "identifier": "`buffer.alloc()`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": " instead to initialize\n", - "position": { - "start": { "line": 794, "column": 55, "offset": 23233 }, - "end": { "line": 795, "column": 1, "offset": 23256 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 795, "column": 1, "offset": 23256 }, - "end": { "line": 795, "column": 9, "offset": 23264 } - } - }, - { - "type": "text", - "value": " instances with zeroes.", - "position": { - "start": { "line": 795, "column": 9, "offset": 23264 }, - "end": { "line": 795, "column": 32, "offset": 23287 } - } - } - ], - "position": { - "start": { "line": 792, "column": 1, "offset": 23033 }, - "end": { "line": 795, "column": 32, "offset": 23287 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.allocUnsafe(10);\n\nconsole.log(buf);\n// Prints (contents may vary): \n\nbuf.fill(0);\n\nconsole.log(buf);\n// Prints: ", - "position": { - "start": { "line": 797, "column": 1, "offset": 23289 }, - "end": { "line": 809, "column": 4, "offset": 23546 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.allocUnsafe(10);\n\nconsole.log(buf);\n// Prints (contents may vary): \n\nbuf.fill(0);\n\nconsole.log(buf);\n// Prints: ", - "position": { - "start": { "line": 811, "column": 1, "offset": 23548 }, - "end": { "line": 823, "column": 4, "offset": 23810 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A ", - "position": { - "start": { "line": 825, "column": 1, "offset": 23812 }, - "end": { "line": 825, "column": 3, "offset": 23814 } - } - }, - { - "type": "inlineCode", - "value": "TypeError", - "position": { - "start": { "line": 825, "column": 3, "offset": 23814 }, - "end": { "line": 825, "column": 14, "offset": 23825 } - } - }, - { - "type": "text", - "value": " will be thrown if ", - "position": { - "start": { "line": 825, "column": 14, "offset": 23825 }, - "end": { "line": 825, "column": 33, "offset": 23844 } - } - }, - { - "type": "inlineCode", - "value": "size", - "position": { - "start": { "line": 825, "column": 33, "offset": 23844 }, - "end": { "line": 825, "column": 39, "offset": 23850 } - } - }, - { - "type": "text", - "value": " is not a number.", - "position": { - "start": { "line": 825, "column": 39, "offset": 23850 }, - "end": { "line": 825, "column": 56, "offset": 23867 } - } - } - ], - "position": { - "start": { "line": 825, "column": 1, "offset": 23812 }, - "end": { "line": 825, "column": 56, "offset": 23867 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The ", - "position": { - "start": { "line": 827, "column": 1, "offset": 23869 }, - "end": { "line": 827, "column": 5, "offset": 23873 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 827, "column": 5, "offset": 23873 }, - "end": { "line": 827, "column": 13, "offset": 23881 } - } - }, - { - "type": "text", - "value": " module pre-allocates an internal ", - "position": { - "start": { "line": 827, "column": 13, "offset": 23881 }, - "end": { "line": 827, "column": 47, "offset": 23915 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 827, "column": 47, "offset": 23915 }, - "end": { "line": 827, "column": 55, "offset": 23923 } - } - }, - { - "type": "text", - "value": " instance of\nsize ", - "position": { - "start": { "line": 827, "column": 55, "offset": 23923 }, - "end": { "line": 828, "column": 6, "offset": 23941 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "Buffer.poolSize", - "position": { - "start": { "line": 828, "column": 7, "offset": 23942 }, - "end": { "line": 828, "column": 24, "offset": 23959 } - } - } - ], - "position": { - "start": { "line": 828, "column": 6, "offset": 23941 }, - "end": { "line": 828, "column": 27, "offset": 23962 } - }, - "label": "`Buffer.poolSize`", - "identifier": "`buffer.poolsize`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": " that is used as a pool for the fast allocation of new\n", - "position": { - "start": { "line": 828, "column": 27, "offset": 23962 }, - "end": { "line": 829, "column": 1, "offset": 24017 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 829, "column": 1, "offset": 24017 }, - "end": { "line": 829, "column": 9, "offset": 24025 } - } - }, - { - "type": "text", - "value": " instances created using ", - "position": { - "start": { "line": 829, "column": 9, "offset": 24025 }, - "end": { "line": 829, "column": 34, "offset": 24050 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "Buffer.allocUnsafe()", - "position": { - "start": { "line": 829, "column": 35, "offset": 24051 }, - "end": { "line": 829, "column": 57, "offset": 24073 } - } - } - ], - "position": { - "start": { "line": 829, "column": 34, "offset": 24050 }, - "end": { "line": 829, "column": 60, "offset": 24076 } - }, - "label": "`Buffer.allocUnsafe()`", - "identifier": "`buffer.allocunsafe()`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": ", ", - "position": { - "start": { "line": 829, "column": 60, "offset": 24076 }, - "end": { "line": 829, "column": 62, "offset": 24078 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "Buffer.from(array)", - "position": { - "start": { "line": 829, "column": 63, "offset": 24079 }, - "end": { "line": 829, "column": 83, "offset": 24099 } - } - } - ], - "position": { - "start": { "line": 829, "column": 62, "offset": 24078 }, - "end": { "line": 829, "column": 86, "offset": 24102 } - }, - "label": "`Buffer.from(array)`", - "identifier": "`buffer.from(array)`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": ",\n", - "position": { - "start": { "line": 829, "column": 86, "offset": 24102 }, - "end": { "line": 830, "column": 1, "offset": 24104 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "Buffer.from(string)", - "position": { - "start": { "line": 830, "column": 2, "offset": 24105 }, - "end": { "line": 830, "column": 23, "offset": 24126 } - } - } - ], - "position": { - "start": { "line": 830, "column": 1, "offset": 24104 }, - "end": { "line": 830, "column": 26, "offset": 24129 } - }, - "label": "`Buffer.from(string)`", - "identifier": "`buffer.from(string)`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": ", and ", - "position": { - "start": { "line": 830, "column": 26, "offset": 24129 }, - "end": { "line": 830, "column": 32, "offset": 24135 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "Buffer.concat()", - "position": { - "start": { "line": 830, "column": 33, "offset": 24136 }, - "end": { "line": 830, "column": 50, "offset": 24153 } - } - } - ], - "position": { - "start": { "line": 830, "column": 32, "offset": 24135 }, - "end": { "line": 830, "column": 53, "offset": 24156 } - }, - "label": "`Buffer.concat()`", - "identifier": "`buffer.concat()`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": " only when ", - "position": { - "start": { "line": 830, "column": 53, "offset": 24156 }, - "end": { "line": 830, "column": 64, "offset": 24167 } - } - }, - { - "type": "inlineCode", - "value": "size", - "position": { - "start": { "line": 830, "column": 64, "offset": 24167 }, - "end": { "line": 830, "column": 70, "offset": 24173 } - } - }, - { - "type": "text", - "value": " is less than\n", - "position": { - "start": { "line": 830, "column": 70, "offset": 24173 }, - "end": { "line": 831, "column": 1, "offset": 24187 } - } - }, - { - "type": "inlineCode", - "value": "Buffer.poolSize >>> 1", - "position": { - "start": { "line": 831, "column": 1, "offset": 24187 }, - "end": { "line": 831, "column": 24, "offset": 24210 } - } - }, - { - "type": "text", - "value": " (floor of ", - "position": { - "start": { "line": 831, "column": 24, "offset": 24210 }, - "end": { "line": 831, "column": 35, "offset": 24221 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "Buffer.poolSize", - "position": { - "start": { "line": 831, "column": 36, "offset": 24222 }, - "end": { "line": 831, "column": 53, "offset": 24239 } - } - } - ], - "position": { - "start": { "line": 831, "column": 35, "offset": 24221 }, - "end": { "line": 831, "column": 56, "offset": 24242 } - }, - "label": "`Buffer.poolSize`", - "identifier": "`buffer.poolsize`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": " divided by two).", - "position": { - "start": { "line": 831, "column": 56, "offset": 24242 }, - "end": { "line": 831, "column": 73, "offset": 24259 } - } - } - ], - "position": { - "start": { "line": 827, "column": 1, "offset": 23869 }, - "end": { "line": 831, "column": 73, "offset": 24259 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Use of this pre-allocated internal memory pool is a key difference between\ncalling ", - "position": { - "start": { "line": 833, "column": 1, "offset": 24261 }, - "end": { "line": 834, "column": 9, "offset": 24344 } - } - }, - { - "type": "inlineCode", - "value": "Buffer.alloc(size, fill)", - "position": { - "start": { "line": 834, "column": 9, "offset": 24344 }, - "end": { "line": 834, "column": 35, "offset": 24370 } - } - }, - { - "type": "text", - "value": " vs. ", - "position": { - "start": { "line": 834, "column": 35, "offset": 24370 }, - "end": { "line": 834, "column": 40, "offset": 24375 } - } - }, - { - "type": "inlineCode", - "value": "Buffer.allocUnsafe(size).fill(fill)", - "position": { - "start": { "line": 834, "column": 40, "offset": 24375 }, - "end": { "line": 834, "column": 77, "offset": 24412 } - } - }, - { - "type": "text", - "value": ".\nSpecifically, ", - "position": { - "start": { "line": 834, "column": 77, "offset": 24412 }, - "end": { "line": 835, "column": 15, "offset": 24428 } - } - }, - { - "type": "inlineCode", - "value": "Buffer.alloc(size, fill)", - "position": { - "start": { "line": 835, "column": 15, "offset": 24428 }, - "end": { "line": 835, "column": 41, "offset": 24454 } - } - }, - { - "type": "text", - "value": " will ", - "position": { - "start": { "line": 835, "column": 41, "offset": 24454 }, - "end": { "line": 835, "column": 47, "offset": 24460 } - } - }, - { - "type": "emphasis", - "children": [ - { - "type": "text", - "value": "never", - "position": { - "start": { "line": 835, "column": 48, "offset": 24461 }, - "end": { "line": 835, "column": 53, "offset": 24466 } - } - } - ], - "position": { - "start": { "line": 835, "column": 47, "offset": 24460 }, - "end": { "line": 835, "column": 54, "offset": 24467 } - } - }, - { - "type": "text", - "value": " use the internal ", - "position": { - "start": { "line": 835, "column": 54, "offset": 24467 }, - "end": { "line": 835, "column": 72, "offset": 24485 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 835, "column": 72, "offset": 24485 }, - "end": { "line": 835, "column": 80, "offset": 24493 } - } - }, - { - "type": "text", - "value": "\npool, while ", - "position": { - "start": { "line": 835, "column": 80, "offset": 24493 }, - "end": { "line": 836, "column": 13, "offset": 24506 } - } - }, - { - "type": "inlineCode", - "value": "Buffer.allocUnsafe(size).fill(fill)", - "position": { - "start": { "line": 836, "column": 13, "offset": 24506 }, - "end": { "line": 836, "column": 50, "offset": 24543 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 836, "column": 50, "offset": 24543 }, - "end": { "line": 836, "column": 51, "offset": 24544 } - } - }, - { - "type": "emphasis", - "children": [ - { - "type": "text", - "value": "will", - "position": { - "start": { "line": 836, "column": 52, "offset": 24545 }, - "end": { "line": 836, "column": 56, "offset": 24549 } - } - } - ], - "position": { - "start": { "line": 836, "column": 51, "offset": 24544 }, - "end": { "line": 836, "column": 57, "offset": 24550 } - } - }, - { - "type": "text", - "value": " use the internal\n", - "position": { - "start": { "line": 836, "column": 57, "offset": 24550 }, - "end": { "line": 837, "column": 1, "offset": 24568 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 837, "column": 1, "offset": 24568 }, - "end": { "line": 837, "column": 9, "offset": 24576 } - } - }, - { - "type": "text", - "value": " pool if ", - "position": { - "start": { "line": 837, "column": 9, "offset": 24576 }, - "end": { "line": 837, "column": 18, "offset": 24585 } - } - }, - { - "type": "inlineCode", - "value": "size", - "position": { - "start": { "line": 837, "column": 18, "offset": 24585 }, - "end": { "line": 837, "column": 24, "offset": 24591 } - } - }, - { - "type": "text", - "value": " is less than or equal to half ", - "position": { - "start": { "line": 837, "column": 24, "offset": 24591 }, - "end": { "line": 837, "column": 55, "offset": 24622 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "Buffer.poolSize", - "position": { - "start": { "line": 837, "column": 56, "offset": 24623 }, - "end": { "line": 837, "column": 73, "offset": 24640 } - } - } - ], - "position": { - "start": { "line": 837, "column": 55, "offset": 24622 }, - "end": { "line": 837, "column": 76, "offset": 24643 } - }, - "label": "`Buffer.poolSize`", - "identifier": "`buffer.poolsize`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": ". The\ndifference is subtle but can be important when an application requires the\nadditional performance that ", - "position": { - "start": { "line": 837, "column": 76, "offset": 24643 }, - "end": { "line": 839, "column": 29, "offset": 24752 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "Buffer.allocUnsafe()", - "position": { - "start": { "line": 839, "column": 30, "offset": 24753 }, - "end": { "line": 839, "column": 52, "offset": 24775 } - } - } - ], - "position": { - "start": { "line": 839, "column": 29, "offset": 24752 }, - "end": { "line": 839, "column": 55, "offset": 24778 } - }, - "label": "`Buffer.allocUnsafe()`", - "identifier": "`buffer.allocunsafe()`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": " provides.", - "position": { - "start": { "line": 839, "column": 55, "offset": 24778 }, - "end": { "line": 839, "column": 65, "offset": 24788 } - } - } - ], - "position": { - "start": { "line": 833, "column": 1, "offset": 24261 }, - "end": { "line": 839, "column": 65, "offset": 24788 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "text", - "value": "Static method: ", - "position": { - "start": { "line": 841, "column": 5, "offset": 24794 }, - "end": { "line": 841, "column": 20, "offset": 24809 } - } - }, - { - "type": "inlineCode", - "value": "Buffer.allocUnsafeSlow(size)", - "position": { - "start": { "line": 841, "column": 20, "offset": 24809 }, - "end": { "line": 841, "column": 50, "offset": 24839 } - } - } - ], - "position": { - "start": { "line": 841, "column": 1, "offset": 24790 }, - "end": { "line": 841, "column": 50, "offset": 24839 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 843, "column": 1, "offset": 24841 }, - "end": { "line": 854, "column": 4, "offset": 25295 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "size", - "position": { - "start": { "line": 856, "column": 3, "offset": 25299 }, - "end": { "line": 856, "column": 9, "offset": 25305 } - } - }, - { - "type": "text", - "value": " {integer} The desired length of the new ", - "position": { - "start": { "line": 856, "column": 9, "offset": 25305 }, - "end": { "line": 856, "column": 50, "offset": 25346 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 856, "column": 50, "offset": 25346 }, - "end": { "line": 856, "column": 58, "offset": 25354 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 856, "column": 58, "offset": 25354 }, - "end": { "line": 856, "column": 59, "offset": 25355 } - } - } - ], - "position": { - "start": { "line": 856, "column": 3, "offset": 25299 }, - "end": { "line": 856, "column": 59, "offset": 25355 } - } - } - ], - "position": { - "start": { "line": 856, "column": 1, "offset": 25297 }, - "end": { "line": 856, "column": 59, "offset": 25355 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {Buffer}", - "position": { - "start": { "line": 857, "column": 3, "offset": 25358 }, - "end": { "line": 857, "column": 20, "offset": 25375 } - } - } - ], - "position": { - "start": { "line": 857, "column": 3, "offset": 25358 }, - "end": { "line": 857, "column": 20, "offset": 25375 } - } - } - ], - "position": { - "start": { "line": 857, "column": 1, "offset": 25356 }, - "end": { "line": 857, "column": 20, "offset": 25375 } - } - } - ], - "position": { - "start": { "line": 856, "column": 1, "offset": 25297 }, - "end": { "line": 857, "column": 20, "offset": 25375 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Allocates a new ", - "position": { - "start": { "line": 859, "column": 1, "offset": 25377 }, - "end": { "line": 859, "column": 17, "offset": 25393 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 859, "column": 17, "offset": 25393 }, - "end": { "line": 859, "column": 25, "offset": 25401 } - } - }, - { - "type": "text", - "value": " of ", - "position": { - "start": { "line": 859, "column": 25, "offset": 25401 }, - "end": { "line": 859, "column": 29, "offset": 25405 } - } - }, - { - "type": "inlineCode", - "value": "size", - "position": { - "start": { "line": 859, "column": 29, "offset": 25405 }, - "end": { "line": 859, "column": 35, "offset": 25411 } - } - }, - { - "type": "text", - "value": " bytes. If ", - "position": { - "start": { "line": 859, "column": 35, "offset": 25411 }, - "end": { "line": 859, "column": 46, "offset": 25422 } - } - }, - { - "type": "inlineCode", - "value": "size", - "position": { - "start": { "line": 859, "column": 46, "offset": 25422 }, - "end": { "line": 859, "column": 52, "offset": 25428 } - } - }, - { - "type": "text", - "value": " is larger than\n", - "position": { - "start": { "line": 859, "column": 52, "offset": 25428 }, - "end": { "line": 860, "column": 1, "offset": 25444 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "buffer.constants.MAX_LENGTH", - "position": { - "start": { "line": 860, "column": 2, "offset": 25445 }, - "end": { "line": 860, "column": 31, "offset": 25474 } - } - } - ], - "position": { - "start": { "line": 860, "column": 1, "offset": 25444 }, - "end": { "line": 860, "column": 34, "offset": 25477 } - }, - "label": "`buffer.constants.MAX_LENGTH`", - "identifier": "`buffer.constants.max_length`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": " or smaller than 0, ", - "position": { - "start": { "line": 860, "column": 34, "offset": 25477 }, - "end": { "line": 860, "column": 54, "offset": 25497 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "ERR_OUT_OF_RANGE", - "position": { - "start": { "line": 860, "column": 55, "offset": 25498 }, - "end": { "line": 860, "column": 73, "offset": 25516 } - } - } - ], - "position": { - "start": { "line": 860, "column": 54, "offset": 25497 }, - "end": { "line": 860, "column": 76, "offset": 25519 } - }, - "label": "`ERR_OUT_OF_RANGE`", - "identifier": "`err_out_of_range`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": "\nis thrown. A zero-length ", - "position": { - "start": { "line": 860, "column": 76, "offset": 25519 }, - "end": { "line": 861, "column": 26, "offset": 25545 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 861, "column": 26, "offset": 25545 }, - "end": { "line": 861, "column": 34, "offset": 25553 } - } - }, - { - "type": "text", - "value": " is created if ", - "position": { - "start": { "line": 861, "column": 34, "offset": 25553 }, - "end": { "line": 861, "column": 49, "offset": 25568 } - } - }, - { - "type": "inlineCode", - "value": "size", - "position": { - "start": { "line": 861, "column": 49, "offset": 25568 }, - "end": { "line": 861, "column": 55, "offset": 25574 } - } - }, - { - "type": "text", - "value": " is 0.", - "position": { - "start": { "line": 861, "column": 55, "offset": 25574 }, - "end": { "line": 861, "column": 61, "offset": 25580 } - } - } - ], - "position": { - "start": { "line": 859, "column": 1, "offset": 25377 }, - "end": { "line": 861, "column": 61, "offset": 25580 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The underlying memory for ", - "position": { - "start": { "line": 863, "column": 1, "offset": 25582 }, - "end": { "line": 863, "column": 27, "offset": 25608 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 863, "column": 27, "offset": 25608 }, - "end": { "line": 863, "column": 35, "offset": 25616 } - } - }, - { - "type": "text", - "value": " instances created in this way is ", - "position": { - "start": { "line": 863, "column": 35, "offset": 25616 }, - "end": { "line": 863, "column": 69, "offset": 25650 } - } - }, - { - "type": "emphasis", - "children": [ - { - "type": "text", - "value": "not\ninitialized", - "position": { - "start": { "line": 863, "column": 70, "offset": 25651 }, - "end": { "line": 864, "column": 12, "offset": 25666 } - } - } - ], - "position": { - "start": { "line": 863, "column": 69, "offset": 25650 }, - "end": { "line": 864, "column": 13, "offset": 25667 } - } - }, - { - "type": "text", - "value": ". The contents of the newly created ", - "position": { - "start": { "line": 864, "column": 13, "offset": 25667 }, - "end": { "line": 864, "column": 49, "offset": 25703 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 864, "column": 49, "offset": 25703 }, - "end": { "line": 864, "column": 57, "offset": 25711 } - } - }, - { - "type": "text", - "value": " are unknown and\n", - "position": { - "start": { "line": 864, "column": 57, "offset": 25711 }, - "end": { "line": 865, "column": 1, "offset": 25728 } - } - }, - { - "type": "emphasis", - "children": [ - { - "type": "text", - "value": "may contain sensitive data", - "position": { - "start": { "line": 865, "column": 2, "offset": 25729 }, - "end": { "line": 865, "column": 28, "offset": 25755 } - } - } - ], - "position": { - "start": { "line": 865, "column": 1, "offset": 25728 }, - "end": { "line": 865, "column": 29, "offset": 25756 } - } - }, - { - "type": "text", - "value": ". Use ", - "position": { - "start": { "line": 865, "column": 29, "offset": 25756 }, - "end": { "line": 865, "column": 35, "offset": 25762 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "buf.fill(0)", - "position": { - "start": { "line": 865, "column": 36, "offset": 25763 }, - "end": { "line": 865, "column": 49, "offset": 25776 } - } - } - ], - "position": { - "start": { "line": 865, "column": 35, "offset": 25762 }, - "end": { "line": 865, "column": 64, "offset": 25791 } - }, - "label": "`buf.fill()`", - "identifier": "`buf.fill()`", - "referenceType": "full" - }, - { - "type": "text", - "value": " to initialize\nsuch ", - "position": { - "start": { "line": 865, "column": 64, "offset": 25791 }, - "end": { "line": 866, "column": 6, "offset": 25811 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 866, "column": 6, "offset": 25811 }, - "end": { "line": 866, "column": 14, "offset": 25819 } - } - }, - { - "type": "text", - "value": " instances with zeroes.", - "position": { - "start": { "line": 866, "column": 14, "offset": 25819 }, - "end": { "line": 866, "column": 37, "offset": 25842 } - } - } - ], - "position": { - "start": { "line": 863, "column": 1, "offset": 25582 }, - "end": { "line": 866, "column": 37, "offset": 25842 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "When using ", - "position": { - "start": { "line": 868, "column": 1, "offset": 25844 }, - "end": { "line": 868, "column": 12, "offset": 25855 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "Buffer.allocUnsafe()", - "position": { - "start": { "line": 868, "column": 13, "offset": 25856 }, - "end": { "line": 868, "column": 35, "offset": 25878 } - } - } - ], - "position": { - "start": { "line": 868, "column": 12, "offset": 25855 }, - "end": { "line": 868, "column": 38, "offset": 25881 } - }, - "label": "`Buffer.allocUnsafe()`", - "identifier": "`buffer.allocunsafe()`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": " to allocate new ", - "position": { - "start": { "line": 868, "column": 38, "offset": 25881 }, - "end": { "line": 868, "column": 55, "offset": 25898 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 868, "column": 55, "offset": 25898 }, - "end": { "line": 868, "column": 63, "offset": 25906 } - } - }, - { - "type": "text", - "value": " instances,\nallocations less than ", - "position": { - "start": { "line": 868, "column": 63, "offset": 25906 }, - "end": { "line": 869, "column": 23, "offset": 25940 } - } - }, - { - "type": "inlineCode", - "value": "Buffer.poolSize >>> 1", - "position": { - "start": { "line": 869, "column": 23, "offset": 25940 }, - "end": { "line": 869, "column": 46, "offset": 25963 } - } - }, - { - "type": "text", - "value": " (4KiB when default poolSize is used) are sliced\nfrom a single pre-allocated ", - "position": { - "start": { "line": 869, "column": 46, "offset": 25963 }, - "end": { "line": 870, "column": 29, "offset": 26040 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 870, "column": 29, "offset": 26040 }, - "end": { "line": 870, "column": 37, "offset": 26048 } - } - }, - { - "type": "text", - "value": ". This allows applications to avoid the\ngarbage collection overhead of creating many individually allocated ", - "position": { - "start": { "line": 870, "column": 37, "offset": 26048 }, - "end": { "line": 871, "column": 69, "offset": 26156 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 871, "column": 69, "offset": 26156 }, - "end": { "line": 871, "column": 77, "offset": 26164 } - } - }, - { - "type": "text", - "value": "\ninstances. This approach improves both performance and memory usage by\neliminating the need to track and clean up as many individual ", - "position": { - "start": { "line": 871, "column": 77, "offset": 26164 }, - "end": { "line": 873, "column": 63, "offset": 26298 } - } - }, - { - "type": "inlineCode", - "value": "ArrayBuffer", - "position": { - "start": { "line": 873, "column": 63, "offset": 26298 }, - "end": { "line": 873, "column": 76, "offset": 26311 } - } - }, - { - "type": "text", - "value": " objects.", - "position": { - "start": { "line": 873, "column": 76, "offset": 26311 }, - "end": { "line": 873, "column": 85, "offset": 26320 } - } - } - ], - "position": { - "start": { "line": 868, "column": 1, "offset": 25844 }, - "end": { "line": 873, "column": 85, "offset": 26320 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "However, in the case where a developer may need to retain a small chunk of\nmemory from a pool for an indeterminate amount of time, it may be appropriate\nto create an un-pooled ", - "position": { - "start": { "line": 875, "column": 1, "offset": 26322 }, - "end": { "line": 877, "column": 24, "offset": 26498 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 877, "column": 24, "offset": 26498 }, - "end": { "line": 877, "column": 32, "offset": 26506 } - } - }, - { - "type": "text", - "value": " instance using ", - "position": { - "start": { "line": 877, "column": 32, "offset": 26506 }, - "end": { "line": 877, "column": 48, "offset": 26522 } - } - }, - { - "type": "inlineCode", - "value": "Buffer.allocUnsafeSlow()", - "position": { - "start": { "line": 877, "column": 48, "offset": 26522 }, - "end": { "line": 877, "column": 74, "offset": 26548 } - } - }, - { - "type": "text", - "value": " and\nthen copying out the relevant bits.", - "position": { - "start": { "line": 877, "column": 74, "offset": 26548 }, - "end": { "line": 878, "column": 36, "offset": 26588 } - } - } - ], - "position": { - "start": { "line": 875, "column": 1, "offset": 26322 }, - "end": { "line": 878, "column": 36, "offset": 26588 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\n// Need to keep around a few small chunks of memory.\nconst store = [];\n\nsocket.on('readable', () => {\n let data;\n while (null !== (data = readable.read())) {\n // Allocate for retained data.\n const sb = Buffer.allocUnsafeSlow(10);\n\n // Copy the data into the new allocation.\n data.copy(sb, 0, 0, 10);\n\n store.push(sb);\n }\n});", - "position": { - "start": { "line": 880, "column": 1, "offset": 26590 }, - "end": { "line": 898, "column": 4, "offset": 26982 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\n// Need to keep around a few small chunks of memory.\nconst store = [];\n\nsocket.on('readable', () => {\n let data;\n while (null !== (data = readable.read())) {\n // Allocate for retained data.\n const sb = Buffer.allocUnsafeSlow(10);\n\n // Copy the data into the new allocation.\n data.copy(sb, 0, 0, 10);\n\n store.push(sb);\n }\n});", - "position": { - "start": { "line": 900, "column": 1, "offset": 26984 }, - "end": { "line": 918, "column": 4, "offset": 27381 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A ", - "position": { - "start": { "line": 920, "column": 1, "offset": 27383 }, - "end": { "line": 920, "column": 3, "offset": 27385 } - } - }, - { - "type": "inlineCode", - "value": "TypeError", - "position": { - "start": { "line": 920, "column": 3, "offset": 27385 }, - "end": { "line": 920, "column": 14, "offset": 27396 } - } - }, - { - "type": "text", - "value": " will be thrown if ", - "position": { - "start": { "line": 920, "column": 14, "offset": 27396 }, - "end": { "line": 920, "column": 33, "offset": 27415 } - } - }, - { - "type": "inlineCode", - "value": "size", - "position": { - "start": { "line": 920, "column": 33, "offset": 27415 }, - "end": { "line": 920, "column": 39, "offset": 27421 } - } - }, - { - "type": "text", - "value": " is not a number.", - "position": { - "start": { "line": 920, "column": 39, "offset": 27421 }, - "end": { "line": 920, "column": 56, "offset": 27438 } - } - } - ], - "position": { - "start": { "line": 920, "column": 1, "offset": 27383 }, - "end": { "line": 920, "column": 56, "offset": 27438 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "text", - "value": "Static method: ", - "position": { - "start": { "line": 922, "column": 5, "offset": 27444 }, - "end": { "line": 922, "column": 20, "offset": 27459 } - } - }, - { - "type": "inlineCode", - "value": "Buffer.byteLength(string[, encoding])", - "position": { - "start": { "line": 922, "column": 20, "offset": 27459 }, - "end": { "line": 922, "column": 59, "offset": 27498 } - } - } - ], - "position": { - "start": { "line": 922, "column": 1, "offset": 27440 }, - "end": { "line": 922, "column": 59, "offset": 27498 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 924, "column": 1, "offset": 27500 }, - "end": { "line": 934, "column": 4, "offset": 27863 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "string", - "position": { - "start": { "line": 936, "column": 3, "offset": 27867 }, - "end": { "line": 936, "column": 11, "offset": 27875 } - } - }, - { - "type": "text", - "value": " {string|Buffer|TypedArray|DataView|ArrayBuffer|SharedArrayBuffer} A\nvalue to calculate the length of.", - "position": { - "start": { "line": 936, "column": 11, "offset": 27875 }, - "end": { "line": 937, "column": 36, "offset": 27979 } - } - } - ], - "position": { - "start": { "line": 936, "column": 3, "offset": 27867 }, - "end": { "line": 937, "column": 36, "offset": 27979 } - } - } - ], - "position": { - "start": { "line": 936, "column": 1, "offset": 27865 }, - "end": { "line": 937, "column": 36, "offset": 27979 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "encoding", - "position": { - "start": { "line": 938, "column": 3, "offset": 27982 }, - "end": { "line": 938, "column": 13, "offset": 27992 } - } - }, - { - "type": "text", - "value": " {string} If ", - "position": { - "start": { "line": 938, "column": 13, "offset": 27992 }, - "end": { "line": 938, "column": 26, "offset": 28005 } - } - }, - { - "type": "inlineCode", - "value": "string", - "position": { - "start": { "line": 938, "column": 26, "offset": 28005 }, - "end": { "line": 938, "column": 34, "offset": 28013 } - } - }, - { - "type": "text", - "value": " is a string, this is its encoding.\n", - "position": { - "start": { "line": 938, "column": 34, "offset": 28013 }, - "end": { "line": 939, "column": 1, "offset": 28049 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { "line": 939, "column": 5, "offset": 28053 }, - "end": { "line": 939, "column": 13, "offset": 28061 } - } - } - ], - "position": { - "start": { "line": 939, "column": 3, "offset": 28051 }, - "end": { "line": 939, "column": 15, "offset": 28063 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 939, "column": 15, "offset": 28063 }, - "end": { "line": 939, "column": 16, "offset": 28064 } - } - }, - { - "type": "inlineCode", - "value": "'utf8'", - "position": { - "start": { "line": 939, "column": 16, "offset": 28064 }, - "end": { "line": 939, "column": 24, "offset": 28072 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 939, "column": 24, "offset": 28072 }, - "end": { "line": 939, "column": 25, "offset": 28073 } - } - } - ], - "position": { - "start": { "line": 938, "column": 3, "offset": 27982 }, - "end": { "line": 939, "column": 25, "offset": 28073 } - } - } - ], - "position": { - "start": { "line": 938, "column": 1, "offset": 27980 }, - "end": { "line": 939, "column": 25, "offset": 28073 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {integer} The number of bytes contained within ", - "position": { - "start": { "line": 940, "column": 3, "offset": 28076 }, - "end": { "line": 940, "column": 59, "offset": 28132 } - } - }, - { - "type": "inlineCode", - "value": "string", - "position": { - "start": { "line": 940, "column": 59, "offset": 28132 }, - "end": { "line": 940, "column": 67, "offset": 28140 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 940, "column": 67, "offset": 28140 }, - "end": { "line": 940, "column": 68, "offset": 28141 } - } - } - ], - "position": { - "start": { "line": 940, "column": 3, "offset": 28076 }, - "end": { "line": 940, "column": 68, "offset": 28141 } - } - } - ], - "position": { - "start": { "line": 940, "column": 1, "offset": 28074 }, - "end": { "line": 940, "column": 68, "offset": 28141 } - } - } - ], - "position": { - "start": { "line": 936, "column": 1, "offset": 27865 }, - "end": { "line": 940, "column": 68, "offset": 28141 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns the byte length of a string when encoded using ", - "position": { - "start": { "line": 942, "column": 1, "offset": 28143 }, - "end": { "line": 942, "column": 56, "offset": 28198 } - } - }, - { - "type": "inlineCode", - "value": "encoding", - "position": { - "start": { "line": 942, "column": 56, "offset": 28198 }, - "end": { "line": 942, "column": 66, "offset": 28208 } - } - }, - { - "type": "text", - "value": ".\nThis is not the same as ", - "position": { - "start": { "line": 942, "column": 66, "offset": 28208 }, - "end": { "line": 943, "column": 25, "offset": 28234 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "String.prototype.length", - "position": { - "start": { "line": 943, "column": 26, "offset": 28235 }, - "end": { "line": 943, "column": 51, "offset": 28260 } - } - } - ], - "position": { - "start": { "line": 943, "column": 25, "offset": 28234 }, - "end": { "line": 943, "column": 54, "offset": 28263 } - }, - "label": "`String.prototype.length`", - "identifier": "`string.prototype.length`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": ", which does not account\nfor the encoding that is used to convert the string into bytes.", - "position": { - "start": { "line": 943, "column": 54, "offset": 28263 }, - "end": { "line": 944, "column": 64, "offset": 28351 } - } - } - ], - "position": { - "start": { "line": 942, "column": 1, "offset": 28143 }, - "end": { "line": 944, "column": 64, "offset": 28351 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "For ", - "position": { - "start": { "line": 946, "column": 1, "offset": 28353 }, - "end": { "line": 946, "column": 5, "offset": 28357 } - } - }, - { - "type": "inlineCode", - "value": "'base64'", - "position": { - "start": { "line": 946, "column": 5, "offset": 28357 }, - "end": { "line": 946, "column": 15, "offset": 28367 } - } - }, - { - "type": "text", - "value": ", ", - "position": { - "start": { "line": 946, "column": 15, "offset": 28367 }, - "end": { "line": 946, "column": 17, "offset": 28369 } - } - }, - { - "type": "inlineCode", - "value": "'base64url'", - "position": { - "start": { "line": 946, "column": 17, "offset": 28369 }, - "end": { "line": 946, "column": 30, "offset": 28382 } - } - }, - { - "type": "text", - "value": ", and ", - "position": { - "start": { "line": 946, "column": 30, "offset": 28382 }, - "end": { "line": 946, "column": 36, "offset": 28388 } - } - }, - { - "type": "inlineCode", - "value": "'hex'", - "position": { - "start": { "line": 946, "column": 36, "offset": 28388 }, - "end": { "line": 946, "column": 43, "offset": 28395 } - } - }, - { - "type": "text", - "value": ", this function assumes valid input.\nFor strings that contain non-base64/hex-encoded data (e.g. whitespace), the\nreturn value might be greater than the length of a ", - "position": { - "start": { "line": 946, "column": 43, "offset": 28395 }, - "end": { "line": 948, "column": 52, "offset": 28559 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 948, "column": 52, "offset": 28559 }, - "end": { "line": 948, "column": 60, "offset": 28567 } - } - }, - { - "type": "text", - "value": " created from the\nstring.", - "position": { - "start": { "line": 948, "column": 60, "offset": 28567 }, - "end": { "line": 949, "column": 8, "offset": 28592 } - } - } - ], - "position": { - "start": { "line": 946, "column": 1, "offset": 28353 }, - "end": { "line": 949, "column": 8, "offset": 28592 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst str = '\\u00bd + \\u00bc = \\u00be';\n\nconsole.log(`${str}: ${str.length} characters, ` +\n `${Buffer.byteLength(str, 'utf8')} bytes`);\n// Prints: ½ + ¼ = ¾: 9 characters, 12 bytes", - "position": { - "start": { "line": 951, "column": 1, "offset": 28594 }, - "end": { "line": 959, "column": 4, "offset": 28836 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst str = '\\u00bd + \\u00bc = \\u00be';\n\nconsole.log(`${str}: ${str.length} characters, ` +\n `${Buffer.byteLength(str, 'utf8')} bytes`);\n// Prints: ½ + ¼ = ¾: 9 characters, 12 bytes", - "position": { - "start": { "line": 961, "column": 1, "offset": 28838 }, - "end": { "line": 969, "column": 4, "offset": 29085 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "When ", - "position": { - "start": { "line": 971, "column": 1, "offset": 29087 }, - "end": { "line": 971, "column": 6, "offset": 29092 } - } - }, - { - "type": "inlineCode", - "value": "string", - "position": { - "start": { "line": 971, "column": 6, "offset": 29092 }, - "end": { "line": 971, "column": 14, "offset": 29100 } - } - }, - { - "type": "text", - "value": " is a {Buffer|DataView|TypedArray|ArrayBuffer|SharedArrayBuffer},\nthe byte length as reported by ", - "position": { - "start": { "line": 971, "column": 14, "offset": 29100 }, - "end": { "line": 972, "column": 32, "offset": 29197 } - } - }, - { - "type": "inlineCode", - "value": ".byteLength", - "position": { - "start": { "line": 972, "column": 32, "offset": 29197 }, - "end": { "line": 972, "column": 45, "offset": 29210 } - } - }, - { - "type": "text", - "value": " is returned.", - "position": { - "start": { "line": 972, "column": 45, "offset": 29210 }, - "end": { "line": 972, "column": 58, "offset": 29223 } - } - } - ], - "position": { - "start": { "line": 971, "column": 1, "offset": 29087 }, - "end": { "line": 972, "column": 58, "offset": 29223 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "text", - "value": "Static method: ", - "position": { - "start": { "line": 974, "column": 5, "offset": 29229 }, - "end": { "line": 974, "column": 20, "offset": 29244 } - } - }, - { - "type": "inlineCode", - "value": "Buffer.compare(buf1, buf2)", - "position": { - "start": { "line": 974, "column": 20, "offset": 29244 }, - "end": { "line": 974, "column": 48, "offset": 29272 } - } - } - ], - "position": { - "start": { "line": 974, "column": 1, "offset": 29225 }, - "end": { "line": 974, "column": 48, "offset": 29272 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 976, "column": 1, "offset": 29274 }, - "end": { "line": 982, "column": 4, "offset": 29443 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "buf1", - "position": { - "start": { "line": 984, "column": 3, "offset": 29447 }, - "end": { "line": 984, "column": 9, "offset": 29453 } - } - }, - { - "type": "text", - "value": " {Buffer|Uint8Array}", - "position": { - "start": { "line": 984, "column": 9, "offset": 29453 }, - "end": { "line": 984, "column": 29, "offset": 29473 } - } - } - ], - "position": { - "start": { "line": 984, "column": 3, "offset": 29447 }, - "end": { "line": 984, "column": 29, "offset": 29473 } - } - } - ], - "position": { - "start": { "line": 984, "column": 1, "offset": 29445 }, - "end": { "line": 984, "column": 29, "offset": 29473 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "buf2", - "position": { - "start": { "line": 985, "column": 3, "offset": 29476 }, - "end": { "line": 985, "column": 9, "offset": 29482 } - } - }, - { - "type": "text", - "value": " {Buffer|Uint8Array}", - "position": { - "start": { "line": 985, "column": 9, "offset": 29482 }, - "end": { "line": 985, "column": 29, "offset": 29502 } - } - } - ], - "position": { - "start": { "line": 985, "column": 3, "offset": 29476 }, - "end": { "line": 985, "column": 29, "offset": 29502 } - } - } - ], - "position": { - "start": { "line": 985, "column": 1, "offset": 29474 }, - "end": { "line": 985, "column": 29, "offset": 29502 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {integer} Either ", - "position": { - "start": { "line": 986, "column": 3, "offset": 29505 }, - "end": { "line": 986, "column": 29, "offset": 29531 } - } - }, - { - "type": "inlineCode", - "value": "-1", - "position": { - "start": { "line": 986, "column": 29, "offset": 29531 }, - "end": { "line": 986, "column": 33, "offset": 29535 } - } - }, - { - "type": "text", - "value": ", ", - "position": { - "start": { "line": 986, "column": 33, "offset": 29535 }, - "end": { "line": 986, "column": 35, "offset": 29537 } - } - }, - { - "type": "inlineCode", - "value": "0", - "position": { - "start": { "line": 986, "column": 35, "offset": 29537 }, - "end": { "line": 986, "column": 38, "offset": 29540 } - } - }, - { - "type": "text", - "value": ", or ", - "position": { - "start": { "line": 986, "column": 38, "offset": 29540 }, - "end": { "line": 986, "column": 43, "offset": 29545 } - } - }, - { - "type": "inlineCode", - "value": "1", - "position": { - "start": { "line": 986, "column": 43, "offset": 29545 }, - "end": { "line": 986, "column": 46, "offset": 29548 } - } - }, - { - "type": "text", - "value": ", depending on the result of the\ncomparison. See ", - "position": { - "start": { "line": 986, "column": 46, "offset": 29548 }, - "end": { "line": 987, "column": 19, "offset": 29599 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "buf.compare()", - "position": { - "start": { "line": 987, "column": 20, "offset": 29600 }, - "end": { "line": 987, "column": 35, "offset": 29615 } - } - } - ], - "position": { - "start": { "line": 987, "column": 19, "offset": 29599 }, - "end": { "line": 987, "column": 38, "offset": 29618 } - }, - "label": "`buf.compare()`", - "identifier": "`buf.compare()`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": " for details.", - "position": { - "start": { "line": 987, "column": 38, "offset": 29618 }, - "end": { "line": 987, "column": 51, "offset": 29631 } - } - } - ], - "position": { - "start": { "line": 986, "column": 3, "offset": 29505 }, - "end": { "line": 987, "column": 51, "offset": 29631 } - } - } - ], - "position": { - "start": { "line": 986, "column": 1, "offset": 29503 }, - "end": { "line": 987, "column": 51, "offset": 29631 } - } - } - ], - "position": { - "start": { "line": 984, "column": 1, "offset": 29445 }, - "end": { "line": 987, "column": 51, "offset": 29631 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Compares ", - "position": { - "start": { "line": 989, "column": 1, "offset": 29633 }, - "end": { "line": 989, "column": 10, "offset": 29642 } - } - }, - { - "type": "inlineCode", - "value": "buf1", - "position": { - "start": { "line": 989, "column": 10, "offset": 29642 }, - "end": { "line": 989, "column": 16, "offset": 29648 } - } - }, - { - "type": "text", - "value": " to ", - "position": { - "start": { "line": 989, "column": 16, "offset": 29648 }, - "end": { "line": 989, "column": 20, "offset": 29652 } - } - }, - { - "type": "inlineCode", - "value": "buf2", - "position": { - "start": { "line": 989, "column": 20, "offset": 29652 }, - "end": { "line": 989, "column": 26, "offset": 29658 } - } - }, - { - "type": "text", - "value": ", typically for the purpose of sorting arrays of\n", - "position": { - "start": { "line": 989, "column": 26, "offset": 29658 }, - "end": { "line": 990, "column": 1, "offset": 29707 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 990, "column": 1, "offset": 29707 }, - "end": { "line": 990, "column": 9, "offset": 29715 } - } - }, - { - "type": "text", - "value": " instances. This is equivalent to calling\n", - "position": { - "start": { "line": 990, "column": 9, "offset": 29715 }, - "end": { "line": 991, "column": 1, "offset": 29757 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "buf1.compare(buf2)", - "position": { - "start": { "line": 991, "column": 2, "offset": 29758 }, - "end": { "line": 991, "column": 22, "offset": 29778 } - } - } - ], - "position": { - "start": { "line": 991, "column": 1, "offset": 29757 }, - "end": { "line": 991, "column": 40, "offset": 29796 } - }, - "label": "`buf.compare()`", - "identifier": "`buf.compare()`", - "referenceType": "full" - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 991, "column": 40, "offset": 29796 }, - "end": { "line": 991, "column": 41, "offset": 29797 } - } - } - ], - "position": { - "start": { "line": 989, "column": 1, "offset": 29633 }, - "end": { "line": 991, "column": 41, "offset": 29797 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf1 = Buffer.from('1234');\nconst buf2 = Buffer.from('0123');\nconst arr = [buf1, buf2];\n\nconsole.log(arr.sort(Buffer.compare));\n// Prints: [ , ]\n// (This result is equal to: [buf2, buf1].)", - "position": { - "start": { "line": 993, "column": 1, "offset": 29799 }, - "end": { "line": 1003, "column": 4, "offset": 30084 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf1 = Buffer.from('1234');\nconst buf2 = Buffer.from('0123');\nconst arr = [buf1, buf2];\n\nconsole.log(arr.sort(Buffer.compare));\n// Prints: [ , ]\n// (This result is equal to: [buf2, buf1].)", - "position": { - "start": { "line": 1005, "column": 1, "offset": 30086 }, - "end": { "line": 1015, "column": 4, "offset": 30376 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "text", - "value": "Static method: ", - "position": { - "start": { "line": 1017, "column": 5, "offset": 30382 }, - "end": { "line": 1017, "column": 20, "offset": 30397 } - } - }, - { - "type": "inlineCode", - "value": "Buffer.concat(list[, totalLength])", - "position": { - "start": { "line": 1017, "column": 20, "offset": 30397 }, - "end": { "line": 1017, "column": 56, "offset": 30433 } - } - } - ], - "position": { - "start": { "line": 1017, "column": 1, "offset": 30378 }, - "end": { "line": 1017, "column": 56, "offset": 30433 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 1019, "column": 1, "offset": 30435 }, - "end": { "line": 1025, "column": 4, "offset": 30612 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "list", - "position": { - "start": { "line": 1027, "column": 3, "offset": 30616 }, - "end": { "line": 1027, "column": 9, "offset": 30622 } - } - }, - { - "type": "text", - "value": " {Buffer[] | Uint8Array[]} List of ", - "position": { - "start": { "line": 1027, "column": 9, "offset": 30622 }, - "end": { "line": 1027, "column": 46, "offset": 30659 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 1027, "column": 46, "offset": 30659 }, - "end": { "line": 1027, "column": 54, "offset": 30667 } - } - }, - { - "type": "text", - "value": " or {Uint8Array}\ninstances to concatenate.", - "position": { - "start": { "line": 1027, "column": 54, "offset": 30667 }, - "end": { "line": 1028, "column": 28, "offset": 30711 } - } - } - ], - "position": { - "start": { "line": 1027, "column": 3, "offset": 30616 }, - "end": { "line": 1028, "column": 28, "offset": 30711 } - } - } - ], - "position": { - "start": { "line": 1027, "column": 1, "offset": 30614 }, - "end": { "line": 1028, "column": 28, "offset": 30711 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "totalLength", - "position": { - "start": { "line": 1029, "column": 3, "offset": 30714 }, - "end": { "line": 1029, "column": 16, "offset": 30727 } - } - }, - { - "type": "text", - "value": " {integer} Total length of the ", - "position": { - "start": { "line": 1029, "column": 16, "offset": 30727 }, - "end": { "line": 1029, "column": 47, "offset": 30758 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 1029, "column": 47, "offset": 30758 }, - "end": { "line": 1029, "column": 55, "offset": 30766 } - } - }, - { - "type": "text", - "value": " instances in ", - "position": { - "start": { "line": 1029, "column": 55, "offset": 30766 }, - "end": { "line": 1029, "column": 69, "offset": 30780 } - } - }, - { - "type": "inlineCode", - "value": "list", - "position": { - "start": { "line": 1029, "column": 69, "offset": 30780 }, - "end": { "line": 1029, "column": 75, "offset": 30786 } - } - }, - { - "type": "text", - "value": "\nwhen concatenated.", - "position": { - "start": { "line": 1029, "column": 75, "offset": 30786 }, - "end": { "line": 1030, "column": 21, "offset": 30807 } - } - } - ], - "position": { - "start": { "line": 1029, "column": 3, "offset": 30714 }, - "end": { "line": 1030, "column": 21, "offset": 30807 } - } - } - ], - "position": { - "start": { "line": 1029, "column": 1, "offset": 30712 }, - "end": { "line": 1030, "column": 21, "offset": 30807 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {Buffer}", - "position": { - "start": { "line": 1031, "column": 3, "offset": 30810 }, - "end": { "line": 1031, "column": 20, "offset": 30827 } - } - } - ], - "position": { - "start": { "line": 1031, "column": 3, "offset": 30810 }, - "end": { "line": 1031, "column": 20, "offset": 30827 } - } - } - ], - "position": { - "start": { "line": 1031, "column": 1, "offset": 30808 }, - "end": { "line": 1031, "column": 20, "offset": 30827 } - } - } - ], - "position": { - "start": { "line": 1027, "column": 1, "offset": 30614 }, - "end": { "line": 1031, "column": 20, "offset": 30827 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns a new ", - "position": { - "start": { "line": 1033, "column": 1, "offset": 30829 }, - "end": { "line": 1033, "column": 15, "offset": 30843 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 1033, "column": 15, "offset": 30843 }, - "end": { "line": 1033, "column": 23, "offset": 30851 } - } - }, - { - "type": "text", - "value": " which is the result of concatenating all the ", - "position": { - "start": { "line": 1033, "column": 23, "offset": 30851 }, - "end": { "line": 1033, "column": 69, "offset": 30897 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 1033, "column": 69, "offset": 30897 }, - "end": { "line": 1033, "column": 77, "offset": 30905 } - } - }, - { - "type": "text", - "value": "\ninstances in the ", - "position": { - "start": { "line": 1033, "column": 77, "offset": 30905 }, - "end": { "line": 1034, "column": 18, "offset": 30923 } - } - }, - { - "type": "inlineCode", - "value": "list", - "position": { - "start": { "line": 1034, "column": 18, "offset": 30923 }, - "end": { "line": 1034, "column": 24, "offset": 30929 } - } - }, - { - "type": "text", - "value": " together.", - "position": { - "start": { "line": 1034, "column": 24, "offset": 30929 }, - "end": { "line": 1034, "column": 34, "offset": 30939 } - } - } - ], - "position": { - "start": { "line": 1033, "column": 1, "offset": 30829 }, - "end": { "line": 1034, "column": 34, "offset": 30939 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "If the list has no items, or if the ", - "position": { - "start": { "line": 1036, "column": 1, "offset": 30941 }, - "end": { "line": 1036, "column": 37, "offset": 30977 } - } - }, - { - "type": "inlineCode", - "value": "totalLength", - "position": { - "start": { "line": 1036, "column": 37, "offset": 30977 }, - "end": { "line": 1036, "column": 50, "offset": 30990 } - } - }, - { - "type": "text", - "value": " is 0, then a new zero-length\n", - "position": { - "start": { "line": 1036, "column": 50, "offset": 30990 }, - "end": { "line": 1037, "column": 1, "offset": 31020 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 1037, "column": 1, "offset": 31020 }, - "end": { "line": 1037, "column": 9, "offset": 31028 } - } - }, - { - "type": "text", - "value": " is returned.", - "position": { - "start": { "line": 1037, "column": 9, "offset": 31028 }, - "end": { "line": 1037, "column": 22, "offset": 31041 } - } - } - ], - "position": { - "start": { "line": 1036, "column": 1, "offset": 30941 }, - "end": { "line": 1037, "column": 22, "offset": 31041 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "If ", - "position": { - "start": { "line": 1039, "column": 1, "offset": 31043 }, - "end": { "line": 1039, "column": 4, "offset": 31046 } - } - }, - { - "type": "inlineCode", - "value": "totalLength", - "position": { - "start": { "line": 1039, "column": 4, "offset": 31046 }, - "end": { "line": 1039, "column": 17, "offset": 31059 } - } - }, - { - "type": "text", - "value": " is not provided, it is calculated from the ", - "position": { - "start": { "line": 1039, "column": 17, "offset": 31059 }, - "end": { "line": 1039, "column": 61, "offset": 31103 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 1039, "column": 61, "offset": 31103 }, - "end": { "line": 1039, "column": 69, "offset": 31111 } - } - }, - { - "type": "text", - "value": " instances\nin ", - "position": { - "start": { "line": 1039, "column": 69, "offset": 31111 }, - "end": { "line": 1040, "column": 4, "offset": 31125 } - } - }, - { - "type": "inlineCode", - "value": "list", - "position": { - "start": { "line": 1040, "column": 4, "offset": 31125 }, - "end": { "line": 1040, "column": 10, "offset": 31131 } - } - }, - { - "type": "text", - "value": " by adding their lengths.", - "position": { - "start": { "line": 1040, "column": 10, "offset": 31131 }, - "end": { "line": 1040, "column": 35, "offset": 31156 } - } - } - ], - "position": { - "start": { "line": 1039, "column": 1, "offset": 31043 }, - "end": { "line": 1040, "column": 35, "offset": 31156 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "If ", - "position": { - "start": { "line": 1042, "column": 1, "offset": 31158 }, - "end": { "line": 1042, "column": 4, "offset": 31161 } - } - }, - { - "type": "inlineCode", - "value": "totalLength", - "position": { - "start": { "line": 1042, "column": 4, "offset": 31161 }, - "end": { "line": 1042, "column": 17, "offset": 31174 } - } - }, - { - "type": "text", - "value": " is provided, it is coerced to an unsigned integer. If the\ncombined length of the ", - "position": { - "start": { "line": 1042, "column": 17, "offset": 31174 }, - "end": { "line": 1043, "column": 24, "offset": 31256 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 1043, "column": 24, "offset": 31256 }, - "end": { "line": 1043, "column": 32, "offset": 31264 } - } - }, - { - "type": "text", - "value": "s in ", - "position": { - "start": { "line": 1043, "column": 32, "offset": 31264 }, - "end": { "line": 1043, "column": 37, "offset": 31269 } - } - }, - { - "type": "inlineCode", - "value": "list", - "position": { - "start": { "line": 1043, "column": 37, "offset": 31269 }, - "end": { "line": 1043, "column": 43, "offset": 31275 } - } - }, - { - "type": "text", - "value": " exceeds ", - "position": { - "start": { "line": 1043, "column": 43, "offset": 31275 }, - "end": { "line": 1043, "column": 52, "offset": 31284 } - } - }, - { - "type": "inlineCode", - "value": "totalLength", - "position": { - "start": { "line": 1043, "column": 52, "offset": 31284 }, - "end": { "line": 1043, "column": 65, "offset": 31297 } - } - }, - { - "type": "text", - "value": ", the result is\ntruncated to ", - "position": { - "start": { "line": 1043, "column": 65, "offset": 31297 }, - "end": { "line": 1044, "column": 14, "offset": 31326 } - } - }, - { - "type": "inlineCode", - "value": "totalLength", - "position": { - "start": { "line": 1044, "column": 14, "offset": 31326 }, - "end": { "line": 1044, "column": 27, "offset": 31339 } - } - }, - { - "type": "text", - "value": ". If the combined length of the ", - "position": { - "start": { "line": 1044, "column": 27, "offset": 31339 }, - "end": { "line": 1044, "column": 59, "offset": 31371 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 1044, "column": 59, "offset": 31371 }, - "end": { "line": 1044, "column": 67, "offset": 31379 } - } - }, - { - "type": "text", - "value": "s in ", - "position": { - "start": { "line": 1044, "column": 67, "offset": 31379 }, - "end": { "line": 1044, "column": 72, "offset": 31384 } - } - }, - { - "type": "inlineCode", - "value": "list", - "position": { - "start": { "line": 1044, "column": 72, "offset": 31384 }, - "end": { "line": 1044, "column": 78, "offset": 31390 } - } - }, - { - "type": "text", - "value": " is\nless than ", - "position": { - "start": { "line": 1044, "column": 78, "offset": 31390 }, - "end": { "line": 1045, "column": 11, "offset": 31404 } - } - }, - { - "type": "inlineCode", - "value": "totalLength", - "position": { - "start": { "line": 1045, "column": 11, "offset": 31404 }, - "end": { "line": 1045, "column": 24, "offset": 31417 } - } - }, - { - "type": "text", - "value": ", the remaining space is filled with zeros.", - "position": { - "start": { "line": 1045, "column": 24, "offset": 31417 }, - "end": { "line": 1045, "column": 67, "offset": 31460 } - } - } - ], - "position": { - "start": { "line": 1042, "column": 1, "offset": 31158 }, - "end": { "line": 1045, "column": 67, "offset": 31460 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\n// Create a single `Buffer` from a list of three `Buffer` instances.\n\nconst buf1 = Buffer.alloc(10);\nconst buf2 = Buffer.alloc(14);\nconst buf3 = Buffer.alloc(18);\nconst totalLength = buf1.length + buf2.length + buf3.length;\n\nconsole.log(totalLength);\n// Prints: 42\n\nconst bufA = Buffer.concat([buf1, buf2, buf3], totalLength);\n\nconsole.log(bufA);\n// Prints: \nconsole.log(bufA.length);\n// Prints: 42", - "position": { - "start": { "line": 1047, "column": 1, "offset": 31462 }, - "end": { "line": 1066, "column": 4, "offset": 31934 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\n// Create a single `Buffer` from a list of three `Buffer` instances.\n\nconst buf1 = Buffer.alloc(10);\nconst buf2 = Buffer.alloc(14);\nconst buf3 = Buffer.alloc(18);\nconst totalLength = buf1.length + buf2.length + buf3.length;\n\nconsole.log(totalLength);\n// Prints: 42\n\nconst bufA = Buffer.concat([buf1, buf2, buf3], totalLength);\n\nconsole.log(bufA);\n// Prints: \nconsole.log(bufA.length);\n// Prints: 42", - "position": { - "start": { "line": 1068, "column": 1, "offset": 31936 }, - "end": { "line": 1087, "column": 4, "offset": 32413 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "Buffer.concat()", - "position": { - "start": { "line": 1089, "column": 1, "offset": 32415 }, - "end": { "line": 1089, "column": 18, "offset": 32432 } - } - }, - { - "type": "text", - "value": " may also use the internal ", - "position": { - "start": { "line": 1089, "column": 18, "offset": 32432 }, - "end": { "line": 1089, "column": 45, "offset": 32459 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 1089, "column": 45, "offset": 32459 }, - "end": { "line": 1089, "column": 53, "offset": 32467 } - } - }, - { - "type": "text", - "value": " pool like\n", - "position": { - "start": { "line": 1089, "column": 53, "offset": 32467 }, - "end": { "line": 1090, "column": 1, "offset": 32478 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "Buffer.allocUnsafe()", - "position": { - "start": { "line": 1090, "column": 2, "offset": 32479 }, - "end": { "line": 1090, "column": 24, "offset": 32501 } - } - } - ], - "position": { - "start": { "line": 1090, "column": 1, "offset": 32478 }, - "end": { "line": 1090, "column": 27, "offset": 32504 } - }, - "label": "`Buffer.allocUnsafe()`", - "identifier": "`buffer.allocunsafe()`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": " does.", - "position": { - "start": { "line": 1090, "column": 27, "offset": 32504 }, - "end": { "line": 1090, "column": 33, "offset": 32510 } - } - } - ], - "position": { - "start": { "line": 1089, "column": 1, "offset": 32415 }, - "end": { "line": 1090, "column": 33, "offset": 32510 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "text", - "value": "Static method: ", - "position": { - "start": { "line": 1092, "column": 5, "offset": 32516 }, - "end": { "line": 1092, "column": 20, "offset": 32531 } - } - }, - { - "type": "inlineCode", - "value": "Buffer.copyBytesFrom(view[, offset[, length]])", - "position": { - "start": { "line": 1092, "column": 20, "offset": 32531 }, - "end": { "line": 1092, "column": 68, "offset": 32579 } - } - } - ], - "position": { - "start": { "line": 1092, "column": 1, "offset": 32512 }, - "end": { "line": 1092, "column": 68, "offset": 32579 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 1094, "column": 1, "offset": 32581 }, - "end": { "line": 1098, "column": 4, "offset": 32624 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "view", - "position": { - "start": { "line": 1100, "column": 3, "offset": 32628 }, - "end": { "line": 1100, "column": 9, "offset": 32634 } - } - }, - { - "type": "text", - "value": " {TypedArray} The {TypedArray} to copy.", - "position": { - "start": { "line": 1100, "column": 9, "offset": 32634 }, - "end": { "line": 1100, "column": 48, "offset": 32673 } - } - } - ], - "position": { - "start": { "line": 1100, "column": 3, "offset": 32628 }, - "end": { "line": 1100, "column": 48, "offset": 32673 } - } - } - ], - "position": { - "start": { "line": 1100, "column": 1, "offset": 32626 }, - "end": { "line": 1100, "column": 48, "offset": 32673 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 1101, "column": 3, "offset": 32676 }, - "end": { "line": 1101, "column": 11, "offset": 32684 } - } - }, - { - "type": "text", - "value": " {integer} The starting offset within ", - "position": { - "start": { "line": 1101, "column": 11, "offset": 32684 }, - "end": { "line": 1101, "column": 49, "offset": 32722 } - } - }, - { - "type": "inlineCode", - "value": "view", - "position": { - "start": { "line": 1101, "column": 49, "offset": 32722 }, - "end": { "line": 1101, "column": 55, "offset": 32728 } - } - }, - { - "type": "text", - "value": ". ", - "position": { - "start": { "line": 1101, "column": 55, "offset": 32728 }, - "end": { "line": 1101, "column": 57, "offset": 32730 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { - "line": 1101, - "column": 59, - "offset": 32732 - }, - "end": { "line": 1101, "column": 67, "offset": 32740 } - } - } - ], - "position": { - "start": { "line": 1101, "column": 57, "offset": 32730 }, - "end": { "line": 1101, "column": 69, "offset": 32742 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 1101, "column": 69, "offset": 32742 }, - "end": { "line": 1101, "column": 70, "offset": 32743 } - } - }, - { - "type": "inlineCode", - "value": "0", - "position": { - "start": { "line": 1101, "column": 70, "offset": 32743 }, - "end": { "line": 1101, "column": 73, "offset": 32746 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 1101, "column": 73, "offset": 32746 }, - "end": { "line": 1101, "column": 74, "offset": 32747 } - } - } - ], - "position": { - "start": { "line": 1101, "column": 3, "offset": 32676 }, - "end": { "line": 1101, "column": 74, "offset": 32747 } - } - } - ], - "position": { - "start": { "line": 1101, "column": 1, "offset": 32674 }, - "end": { "line": 1101, "column": 74, "offset": 32747 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "length", - "position": { - "start": { "line": 1102, "column": 3, "offset": 32750 }, - "end": { "line": 1102, "column": 11, "offset": 32758 } - } - }, - { - "type": "text", - "value": " {integer} The number of elements from ", - "position": { - "start": { "line": 1102, "column": 11, "offset": 32758 }, - "end": { "line": 1102, "column": 50, "offset": 32797 } - } - }, - { - "type": "inlineCode", - "value": "view", - "position": { - "start": { "line": 1102, "column": 50, "offset": 32797 }, - "end": { "line": 1102, "column": 56, "offset": 32803 } - } - }, - { - "type": "text", - "value": " to copy.\n", - "position": { - "start": { "line": 1102, "column": 56, "offset": 32803 }, - "end": { "line": 1103, "column": 1, "offset": 32813 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { "line": 1103, "column": 5, "offset": 32817 }, - "end": { "line": 1103, "column": 13, "offset": 32825 } - } - } - ], - "position": { - "start": { "line": 1103, "column": 3, "offset": 32815 }, - "end": { "line": 1103, "column": 15, "offset": 32827 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 1103, "column": 15, "offset": 32827 }, - "end": { "line": 1103, "column": 16, "offset": 32828 } - } - }, - { - "type": "inlineCode", - "value": "view.length - offset", - "position": { - "start": { "line": 1103, "column": 16, "offset": 32828 }, - "end": { "line": 1103, "column": 38, "offset": 32850 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 1103, "column": 38, "offset": 32850 }, - "end": { "line": 1103, "column": 39, "offset": 32851 } - } - } - ], - "position": { - "start": { "line": 1102, "column": 3, "offset": 32750 }, - "end": { "line": 1103, "column": 39, "offset": 32851 } - } - } - ], - "position": { - "start": { "line": 1102, "column": 1, "offset": 32748 }, - "end": { "line": 1103, "column": 39, "offset": 32851 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {Buffer}", - "position": { - "start": { "line": 1104, "column": 3, "offset": 32854 }, - "end": { "line": 1104, "column": 20, "offset": 32871 } - } - } - ], - "position": { - "start": { "line": 1104, "column": 3, "offset": 32854 }, - "end": { "line": 1104, "column": 20, "offset": 32871 } - } - } - ], - "position": { - "start": { "line": 1104, "column": 1, "offset": 32852 }, - "end": { "line": 1104, "column": 20, "offset": 32871 } - } - } - ], - "position": { - "start": { "line": 1100, "column": 1, "offset": 32626 }, - "end": { "line": 1104, "column": 20, "offset": 32871 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Copies the underlying memory of ", - "position": { - "start": { "line": 1106, "column": 1, "offset": 32873 }, - "end": { "line": 1106, "column": 33, "offset": 32905 } - } - }, - { - "type": "inlineCode", - "value": "view", - "position": { - "start": { "line": 1106, "column": 33, "offset": 32905 }, - "end": { "line": 1106, "column": 39, "offset": 32911 } - } - }, - { - "type": "text", - "value": " into a new ", - "position": { - "start": { "line": 1106, "column": 39, "offset": 32911 }, - "end": { "line": 1106, "column": 51, "offset": 32923 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 1106, "column": 51, "offset": 32923 }, - "end": { "line": 1106, "column": 59, "offset": 32931 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 1106, "column": 59, "offset": 32931 }, - "end": { "line": 1106, "column": 60, "offset": 32932 } - } - } - ], - "position": { - "start": { "line": 1106, "column": 1, "offset": 32873 }, - "end": { "line": 1106, "column": 60, "offset": 32932 } - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "const u16 = new Uint16Array([0, 0xffff]);\nconst buf = Buffer.copyBytesFrom(u16, 1, 1);\nu16[1] = 0;\nconsole.log(buf.length); // 2\nconsole.log(buf[0]); // 255\nconsole.log(buf[1]); // 255", - "position": { - "start": { "line": 1108, "column": 1, "offset": 32934 }, - "end": { "line": 1115, "column": 4, "offset": 33128 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "text", - "value": "Static method: ", - "position": { - "start": { "line": 1117, "column": 5, "offset": 33134 }, - "end": { "line": 1117, "column": 20, "offset": 33149 } - } - }, - { - "type": "inlineCode", - "value": "Buffer.from(array)", - "position": { - "start": { "line": 1117, "column": 20, "offset": 33149 }, - "end": { "line": 1117, "column": 40, "offset": 33169 } - } - } - ], - "position": { - "start": { "line": 1117, "column": 1, "offset": 33130 }, - "end": { "line": 1117, "column": 40, "offset": 33169 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 1119, "column": 1, "offset": 33171 }, - "end": { "line": 1121, "column": 4, "offset": 33199 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "array", - "position": { - "start": { "line": 1123, "column": 3, "offset": 33203 }, - "end": { "line": 1123, "column": 10, "offset": 33210 } - } - }, - { - "type": "text", - "value": " {integer[]}", - "position": { - "start": { "line": 1123, "column": 10, "offset": 33210 }, - "end": { "line": 1123, "column": 23, "offset": 33223 } - } - } - ], - "position": { - "start": { "line": 1123, "column": 3, "offset": 33203 }, - "end": { "line": 1123, "column": 23, "offset": 33223 } - } - } - ], - "position": { - "start": { "line": 1123, "column": 1, "offset": 33201 }, - "end": { "line": 1123, "column": 23, "offset": 33223 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {Buffer}", - "position": { - "start": { "line": 1124, "column": 3, "offset": 33226 }, - "end": { "line": 1124, "column": 20, "offset": 33243 } - } - } - ], - "position": { - "start": { "line": 1124, "column": 3, "offset": 33226 }, - "end": { "line": 1124, "column": 20, "offset": 33243 } - } - } - ], - "position": { - "start": { "line": 1124, "column": 1, "offset": 33224 }, - "end": { "line": 1124, "column": 20, "offset": 33243 } - } - } - ], - "position": { - "start": { "line": 1123, "column": 1, "offset": 33201 }, - "end": { "line": 1124, "column": 20, "offset": 33243 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Allocates a new ", - "position": { - "start": { "line": 1126, "column": 1, "offset": 33245 }, - "end": { "line": 1126, "column": 17, "offset": 33261 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 1126, "column": 17, "offset": 33261 }, - "end": { "line": 1126, "column": 25, "offset": 33269 } - } - }, - { - "type": "text", - "value": " using an ", - "position": { - "start": { "line": 1126, "column": 25, "offset": 33269 }, - "end": { "line": 1126, "column": 35, "offset": 33279 } - } - }, - { - "type": "inlineCode", - "value": "array", - "position": { - "start": { "line": 1126, "column": 35, "offset": 33279 }, - "end": { "line": 1126, "column": 42, "offset": 33286 } - } - }, - { - "type": "text", - "value": " of bytes in the range ", - "position": { - "start": { "line": 1126, "column": 42, "offset": 33286 }, - "end": { "line": 1126, "column": 65, "offset": 33309 } - } - }, - { - "type": "inlineCode", - "value": "0", - "position": { - "start": { "line": 1126, "column": 65, "offset": 33309 }, - "end": { "line": 1126, "column": 68, "offset": 33312 } - } - }, - { - "type": "text", - "value": " – ", - "position": { - "start": { "line": 1126, "column": 68, "offset": 33312 }, - "end": { "line": 1126, "column": 71, "offset": 33315 } - } - }, - { - "type": "inlineCode", - "value": "255", - "position": { - "start": { "line": 1126, "column": 71, "offset": 33315 }, - "end": { "line": 1126, "column": 76, "offset": 33320 } - } - }, - { - "type": "text", - "value": ".\nArray entries outside that range will be truncated to fit into it.", - "position": { - "start": { "line": 1126, "column": 76, "offset": 33320 }, - "end": { "line": 1127, "column": 67, "offset": 33388 } - } - } - ], - "position": { - "start": { "line": 1126, "column": 1, "offset": 33245 }, - "end": { "line": 1127, "column": 67, "offset": 33388 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\n// Creates a new Buffer containing the UTF-8 bytes of the string 'buffer'.\nconst buf = Buffer.from([0x62, 0x75, 0x66, 0x66, 0x65, 0x72]);", - "position": { - "start": { "line": 1129, "column": 1, "offset": 33390 }, - "end": { "line": 1134, "column": 4, "offset": 33577 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\n// Creates a new Buffer containing the UTF-8 bytes of the string 'buffer'.\nconst buf = Buffer.from([0x62, 0x75, 0x66, 0x66, 0x65, 0x72]);", - "position": { - "start": { "line": 1136, "column": 1, "offset": 33579 }, - "end": { "line": 1141, "column": 4, "offset": 33771 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "If ", - "position": { - "start": { "line": 1143, "column": 1, "offset": 33773 }, - "end": { "line": 1143, "column": 4, "offset": 33776 } - } - }, - { - "type": "inlineCode", - "value": "array", - "position": { - "start": { "line": 1143, "column": 4, "offset": 33776 }, - "end": { "line": 1143, "column": 11, "offset": 33783 } - } - }, - { - "type": "text", - "value": " is an ", - "position": { - "start": { "line": 1143, "column": 11, "offset": 33783 }, - "end": { "line": 1143, "column": 18, "offset": 33790 } - } - }, - { - "type": "inlineCode", - "value": "Array", - "position": { - "start": { "line": 1143, "column": 18, "offset": 33790 }, - "end": { "line": 1143, "column": 25, "offset": 33797 } - } - }, - { - "type": "text", - "value": "-like object (that is, one with a ", - "position": { - "start": { "line": 1143, "column": 25, "offset": 33797 }, - "end": { "line": 1143, "column": 59, "offset": 33831 } - } - }, - { - "type": "inlineCode", - "value": "length", - "position": { - "start": { "line": 1143, "column": 59, "offset": 33831 }, - "end": { "line": 1143, "column": 67, "offset": 33839 } - } - }, - { - "type": "text", - "value": " property of\ntype ", - "position": { - "start": { "line": 1143, "column": 67, "offset": 33839 }, - "end": { "line": 1144, "column": 6, "offset": 33857 } - } - }, - { - "type": "inlineCode", - "value": "number", - "position": { - "start": { "line": 1144, "column": 6, "offset": 33857 }, - "end": { "line": 1144, "column": 14, "offset": 33865 } - } - }, - { - "type": "text", - "value": "), it is treated as if it is an array, unless it is a ", - "position": { - "start": { "line": 1144, "column": 14, "offset": 33865 }, - "end": { "line": 1144, "column": 68, "offset": 33919 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 1144, "column": 68, "offset": 33919 }, - "end": { "line": 1144, "column": 76, "offset": 33927 } - } - }, - { - "type": "text", - "value": " or\na ", - "position": { - "start": { "line": 1144, "column": 76, "offset": 33927 }, - "end": { "line": 1145, "column": 3, "offset": 33933 } - } - }, - { - "type": "inlineCode", - "value": "Uint8Array", - "position": { - "start": { "line": 1145, "column": 3, "offset": 33933 }, - "end": { "line": 1145, "column": 15, "offset": 33945 } - } - }, - { - "type": "text", - "value": ". This means all other ", - "position": { - "start": { "line": 1145, "column": 15, "offset": 33945 }, - "end": { "line": 1145, "column": 38, "offset": 33968 } - } - }, - { - "type": "inlineCode", - "value": "TypedArray", - "position": { - "start": { "line": 1145, "column": 38, "offset": 33968 }, - "end": { "line": 1145, "column": 50, "offset": 33980 } - } - }, - { - "type": "text", - "value": " variants get treated as an\n", - "position": { - "start": { "line": 1145, "column": 50, "offset": 33980 }, - "end": { "line": 1146, "column": 1, "offset": 34008 } - } - }, - { - "type": "inlineCode", - "value": "Array", - "position": { - "start": { "line": 1146, "column": 1, "offset": 34008 }, - "end": { "line": 1146, "column": 8, "offset": 34015 } - } - }, - { - "type": "text", - "value": ". To create a ", - "position": { - "start": { "line": 1146, "column": 8, "offset": 34015 }, - "end": { "line": 1146, "column": 22, "offset": 34029 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 1146, "column": 22, "offset": 34029 }, - "end": { "line": 1146, "column": 30, "offset": 34037 } - } - }, - { - "type": "text", - "value": " from the bytes backing a ", - "position": { - "start": { "line": 1146, "column": 30, "offset": 34037 }, - "end": { "line": 1146, "column": 56, "offset": 34063 } - } - }, - { - "type": "inlineCode", - "value": "TypedArray", - "position": { - "start": { "line": 1146, "column": 56, "offset": 34063 }, - "end": { "line": 1146, "column": 68, "offset": 34075 } - } - }, - { - "type": "text", - "value": ", use\n", - "position": { - "start": { "line": 1146, "column": 68, "offset": 34075 }, - "end": { "line": 1147, "column": 1, "offset": 34081 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "Buffer.copyBytesFrom()", - "position": { - "start": { "line": 1147, "column": 2, "offset": 34082 }, - "end": { "line": 1147, "column": 26, "offset": 34106 } - } - } - ], - "position": { - "start": { "line": 1147, "column": 1, "offset": 34081 }, - "end": { "line": 1147, "column": 29, "offset": 34109 } - }, - "label": "`Buffer.copyBytesFrom()`", - "identifier": "`buffer.copybytesfrom()`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 1147, "column": 29, "offset": 34109 }, - "end": { "line": 1147, "column": 30, "offset": 34110 } - } - } - ], - "position": { - "start": { "line": 1143, "column": 1, "offset": 33773 }, - "end": { "line": 1147, "column": 30, "offset": 34110 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A ", - "position": { - "start": { "line": 1149, "column": 1, "offset": 34112 }, - "end": { "line": 1149, "column": 3, "offset": 34114 } - } - }, - { - "type": "inlineCode", - "value": "TypeError", - "position": { - "start": { "line": 1149, "column": 3, "offset": 34114 }, - "end": { "line": 1149, "column": 14, "offset": 34125 } - } - }, - { - "type": "text", - "value": " will be thrown if ", - "position": { - "start": { "line": 1149, "column": 14, "offset": 34125 }, - "end": { "line": 1149, "column": 33, "offset": 34144 } - } - }, - { - "type": "inlineCode", - "value": "array", - "position": { - "start": { "line": 1149, "column": 33, "offset": 34144 }, - "end": { "line": 1149, "column": 40, "offset": 34151 } - } - }, - { - "type": "text", - "value": " is not an ", - "position": { - "start": { "line": 1149, "column": 40, "offset": 34151 }, - "end": { "line": 1149, "column": 51, "offset": 34162 } - } - }, - { - "type": "inlineCode", - "value": "Array", - "position": { - "start": { "line": 1149, "column": 51, "offset": 34162 }, - "end": { "line": 1149, "column": 58, "offset": 34169 } - } - }, - { - "type": "text", - "value": " or another type\nappropriate for ", - "position": { - "start": { "line": 1149, "column": 58, "offset": 34169 }, - "end": { "line": 1150, "column": 17, "offset": 34202 } - } - }, - { - "type": "inlineCode", - "value": "Buffer.from()", - "position": { - "start": { "line": 1150, "column": 17, "offset": 34202 }, - "end": { "line": 1150, "column": 32, "offset": 34217 } - } - }, - { - "type": "text", - "value": " variants.", - "position": { - "start": { "line": 1150, "column": 32, "offset": 34217 }, - "end": { "line": 1150, "column": 42, "offset": 34227 } - } - } - ], - "position": { - "start": { "line": 1149, "column": 1, "offset": 34112 }, - "end": { "line": 1150, "column": 42, "offset": 34227 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "Buffer.from(array)", - "position": { - "start": { "line": 1152, "column": 1, "offset": 34229 }, - "end": { "line": 1152, "column": 21, "offset": 34249 } - } - }, - { - "type": "text", - "value": " and ", - "position": { - "start": { "line": 1152, "column": 21, "offset": 34249 }, - "end": { "line": 1152, "column": 26, "offset": 34254 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "Buffer.from(string)", - "position": { - "start": { "line": 1152, "column": 27, "offset": 34255 }, - "end": { "line": 1152, "column": 48, "offset": 34276 } - } - } - ], - "position": { - "start": { "line": 1152, "column": 26, "offset": 34254 }, - "end": { "line": 1152, "column": 51, "offset": 34279 } - }, - "label": "`Buffer.from(string)`", - "identifier": "`buffer.from(string)`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": " may also use the internal\n", - "position": { - "start": { "line": 1152, "column": 51, "offset": 34279 }, - "end": { "line": 1153, "column": 1, "offset": 34306 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 1153, "column": 1, "offset": 34306 }, - "end": { "line": 1153, "column": 9, "offset": 34314 } - } - }, - { - "type": "text", - "value": " pool like ", - "position": { - "start": { "line": 1153, "column": 9, "offset": 34314 }, - "end": { "line": 1153, "column": 20, "offset": 34325 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "Buffer.allocUnsafe()", - "position": { - "start": { "line": 1153, "column": 21, "offset": 34326 }, - "end": { "line": 1153, "column": 43, "offset": 34348 } - } - } - ], - "position": { - "start": { "line": 1153, "column": 20, "offset": 34325 }, - "end": { "line": 1153, "column": 46, "offset": 34351 } - }, - "label": "`Buffer.allocUnsafe()`", - "identifier": "`buffer.allocunsafe()`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": " does.", - "position": { - "start": { "line": 1153, "column": 46, "offset": 34351 }, - "end": { "line": 1153, "column": 52, "offset": 34357 } - } - } - ], - "position": { - "start": { "line": 1152, "column": 1, "offset": 34229 }, - "end": { "line": 1153, "column": 52, "offset": 34357 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "text", - "value": "Static method: ", - "position": { - "start": { "line": 1155, "column": 5, "offset": 34363 }, - "end": { "line": 1155, "column": 20, "offset": 34378 } - } - }, - { - "type": "inlineCode", - "value": "Buffer.from(arrayBuffer[, byteOffset[, length]])", - "position": { - "start": { "line": 1155, "column": 20, "offset": 34378 }, - "end": { "line": 1155, "column": 70, "offset": 34428 } - } - } - ], - "position": { - "start": { "line": 1155, "column": 1, "offset": 34359 }, - "end": { "line": 1155, "column": 70, "offset": 34428 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 1157, "column": 1, "offset": 34430 }, - "end": { "line": 1159, "column": 4, "offset": 34458 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "arrayBuffer", - "position": { - "start": { "line": 1161, "column": 3, "offset": 34462 }, - "end": { "line": 1161, "column": 16, "offset": 34475 } - } - }, - { - "type": "text", - "value": " {ArrayBuffer|SharedArrayBuffer} An {ArrayBuffer},\n{SharedArrayBuffer}, for example the ", - "position": { - "start": { "line": 1161, "column": 16, "offset": 34475 }, - "end": { "line": 1162, "column": 40, "offset": 34565 } - } - }, - { - "type": "inlineCode", - "value": ".buffer", - "position": { - "start": { "line": 1162, "column": 40, "offset": 34565 }, - "end": { "line": 1162, "column": 49, "offset": 34574 } - } - }, - { - "type": "text", - "value": " property of a\n{TypedArray}.", - "position": { - "start": { "line": 1162, "column": 49, "offset": 34574 }, - "end": { "line": 1163, "column": 16, "offset": 34604 } - } - } - ], - "position": { - "start": { "line": 1161, "column": 3, "offset": 34462 }, - "end": { "line": 1163, "column": 16, "offset": 34604 } - } - } - ], - "position": { - "start": { "line": 1161, "column": 1, "offset": 34460 }, - "end": { "line": 1163, "column": 16, "offset": 34604 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "byteOffset", - "position": { - "start": { "line": 1164, "column": 3, "offset": 34607 }, - "end": { "line": 1164, "column": 15, "offset": 34619 } - } - }, - { - "type": "text", - "value": " {integer} Index of first byte to expose. ", - "position": { - "start": { "line": 1164, "column": 15, "offset": 34619 }, - "end": { "line": 1164, "column": 57, "offset": 34661 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { - "line": 1164, - "column": 59, - "offset": 34663 - }, - "end": { "line": 1164, "column": 67, "offset": 34671 } - } - } - ], - "position": { - "start": { "line": 1164, "column": 57, "offset": 34661 }, - "end": { "line": 1164, "column": 69, "offset": 34673 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 1164, "column": 69, "offset": 34673 }, - "end": { "line": 1164, "column": 70, "offset": 34674 } - } - }, - { - "type": "inlineCode", - "value": "0", - "position": { - "start": { "line": 1164, "column": 70, "offset": 34674 }, - "end": { "line": 1164, "column": 73, "offset": 34677 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 1164, "column": 73, "offset": 34677 }, - "end": { "line": 1164, "column": 74, "offset": 34678 } - } - } - ], - "position": { - "start": { "line": 1164, "column": 3, "offset": 34607 }, - "end": { "line": 1164, "column": 74, "offset": 34678 } - } - } - ], - "position": { - "start": { "line": 1164, "column": 1, "offset": 34605 }, - "end": { "line": 1164, "column": 74, "offset": 34678 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "length", - "position": { - "start": { "line": 1165, "column": 3, "offset": 34681 }, - "end": { "line": 1165, "column": 11, "offset": 34689 } - } - }, - { - "type": "text", - "value": " {integer} Number of bytes to expose.\n", - "position": { - "start": { "line": 1165, "column": 11, "offset": 34689 }, - "end": { "line": 1166, "column": 1, "offset": 34727 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { "line": 1166, "column": 5, "offset": 34731 }, - "end": { "line": 1166, "column": 13, "offset": 34739 } - } - } - ], - "position": { - "start": { "line": 1166, "column": 3, "offset": 34729 }, - "end": { "line": 1166, "column": 15, "offset": 34741 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 1166, "column": 15, "offset": 34741 }, - "end": { "line": 1166, "column": 16, "offset": 34742 } - } - }, - { - "type": "inlineCode", - "value": "arrayBuffer.byteLength - byteOffset", - "position": { - "start": { "line": 1166, "column": 16, "offset": 34742 }, - "end": { "line": 1166, "column": 53, "offset": 34779 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 1166, "column": 53, "offset": 34779 }, - "end": { "line": 1166, "column": 54, "offset": 34780 } - } - } - ], - "position": { - "start": { "line": 1165, "column": 3, "offset": 34681 }, - "end": { "line": 1166, "column": 54, "offset": 34780 } - } - } - ], - "position": { - "start": { "line": 1165, "column": 1, "offset": 34679 }, - "end": { "line": 1166, "column": 54, "offset": 34780 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {Buffer}", - "position": { - "start": { "line": 1167, "column": 3, "offset": 34783 }, - "end": { "line": 1167, "column": 20, "offset": 34800 } - } - } - ], - "position": { - "start": { "line": 1167, "column": 3, "offset": 34783 }, - "end": { "line": 1167, "column": 20, "offset": 34800 } - } - } - ], - "position": { - "start": { "line": 1167, "column": 1, "offset": 34781 }, - "end": { "line": 1167, "column": 20, "offset": 34800 } - } - } - ], - "position": { - "start": { "line": 1161, "column": 1, "offset": 34460 }, - "end": { "line": 1167, "column": 20, "offset": 34800 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This creates a view of the {ArrayBuffer} without copying the underlying\nmemory. For example, when passed a reference to the ", - "position": { - "start": { "line": 1169, "column": 1, "offset": 34802 }, - "end": { "line": 1170, "column": 53, "offset": 34926 } - } - }, - { - "type": "inlineCode", - "value": ".buffer", - "position": { - "start": { "line": 1170, "column": 53, "offset": 34926 }, - "end": { "line": 1170, "column": 62, "offset": 34935 } - } - }, - { - "type": "text", - "value": " property of a\n{TypedArray} instance, the newly created ", - "position": { - "start": { "line": 1170, "column": 62, "offset": 34935 }, - "end": { "line": 1171, "column": 42, "offset": 34991 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 1171, "column": 42, "offset": 34991 }, - "end": { "line": 1171, "column": 50, "offset": 34999 } - } - }, - { - "type": "text", - "value": " will share the same\nallocated memory as the {TypedArray}'s underlying ", - "position": { - "start": { "line": 1171, "column": 50, "offset": 34999 }, - "end": { "line": 1172, "column": 51, "offset": 35070 } - } - }, - { - "type": "inlineCode", - "value": "ArrayBuffer", - "position": { - "start": { "line": 1172, "column": 51, "offset": 35070 }, - "end": { "line": 1172, "column": 64, "offset": 35083 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 1172, "column": 64, "offset": 35083 }, - "end": { "line": 1172, "column": 65, "offset": 35084 } - } - } - ], - "position": { - "start": { "line": 1169, "column": 1, "offset": 34802 }, - "end": { "line": 1172, "column": 65, "offset": 35084 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst arr = new Uint16Array(2);\n\narr[0] = 5000;\narr[1] = 4000;\n\n// Shares memory with `arr`.\nconst buf = Buffer.from(arr.buffer);\n\nconsole.log(buf);\n// Prints: \n\n// Changing the original Uint16Array changes the Buffer also.\narr[1] = 6000;\n\nconsole.log(buf);\n// Prints: ", - "position": { - "start": { "line": 1174, "column": 1, "offset": 35086 }, - "end": { "line": 1193, "column": 4, "offset": 35445 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst arr = new Uint16Array(2);\n\narr[0] = 5000;\narr[1] = 4000;\n\n// Shares memory with `arr`.\nconst buf = Buffer.from(arr.buffer);\n\nconsole.log(buf);\n// Prints: \n\n// Changing the original Uint16Array changes the Buffer also.\narr[1] = 6000;\n\nconsole.log(buf);\n// Prints: ", - "position": { - "start": { "line": 1195, "column": 1, "offset": 35447 }, - "end": { "line": 1214, "column": 4, "offset": 35811 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The optional ", - "position": { - "start": { "line": 1216, "column": 1, "offset": 35813 }, - "end": { "line": 1216, "column": 14, "offset": 35826 } - } - }, - { - "type": "inlineCode", - "value": "byteOffset", - "position": { - "start": { "line": 1216, "column": 14, "offset": 35826 }, - "end": { "line": 1216, "column": 26, "offset": 35838 } - } - }, - { - "type": "text", - "value": " and ", - "position": { - "start": { "line": 1216, "column": 26, "offset": 35838 }, - "end": { "line": 1216, "column": 31, "offset": 35843 } - } - }, - { - "type": "inlineCode", - "value": "length", - "position": { - "start": { "line": 1216, "column": 31, "offset": 35843 }, - "end": { "line": 1216, "column": 39, "offset": 35851 } - } - }, - { - "type": "text", - "value": " arguments specify a memory range within\nthe ", - "position": { - "start": { "line": 1216, "column": 39, "offset": 35851 }, - "end": { "line": 1217, "column": 5, "offset": 35896 } - } - }, - { - "type": "inlineCode", - "value": "arrayBuffer", - "position": { - "start": { "line": 1217, "column": 5, "offset": 35896 }, - "end": { "line": 1217, "column": 18, "offset": 35909 } - } - }, - { - "type": "text", - "value": " that will be shared by the ", - "position": { - "start": { "line": 1217, "column": 18, "offset": 35909 }, - "end": { "line": 1217, "column": 46, "offset": 35937 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 1217, "column": 46, "offset": 35937 }, - "end": { "line": 1217, "column": 54, "offset": 35945 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 1217, "column": 54, "offset": 35945 }, - "end": { "line": 1217, "column": 55, "offset": 35946 } - } - } - ], - "position": { - "start": { "line": 1216, "column": 1, "offset": 35813 }, - "end": { "line": 1217, "column": 55, "offset": 35946 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst ab = new ArrayBuffer(10);\nconst buf = Buffer.from(ab, 0, 2);\n\nconsole.log(buf.length);\n// Prints: 2", - "position": { - "start": { "line": 1219, "column": 1, "offset": 35948 }, - "end": { "line": 1227, "column": 4, "offset": 36103 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst ab = new ArrayBuffer(10);\nconst buf = Buffer.from(ab, 0, 2);\n\nconsole.log(buf.length);\n// Prints: 2", - "position": { - "start": { "line": 1229, "column": 1, "offset": 36105 }, - "end": { "line": 1237, "column": 4, "offset": 36265 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A ", - "position": { - "start": { "line": 1239, "column": 1, "offset": 36267 }, - "end": { "line": 1239, "column": 3, "offset": 36269 } - } - }, - { - "type": "inlineCode", - "value": "TypeError", - "position": { - "start": { "line": 1239, "column": 3, "offset": 36269 }, - "end": { "line": 1239, "column": 14, "offset": 36280 } - } - }, - { - "type": "text", - "value": " will be thrown if ", - "position": { - "start": { "line": 1239, "column": 14, "offset": 36280 }, - "end": { "line": 1239, "column": 33, "offset": 36299 } - } - }, - { - "type": "inlineCode", - "value": "arrayBuffer", - "position": { - "start": { "line": 1239, "column": 33, "offset": 36299 }, - "end": { "line": 1239, "column": 46, "offset": 36312 } - } - }, - { - "type": "text", - "value": " is not an {ArrayBuffer} or a\n{SharedArrayBuffer} or another type appropriate for ", - "position": { - "start": { "line": 1239, "column": 46, "offset": 36312 }, - "end": { "line": 1240, "column": 53, "offset": 36394 } - } - }, - { - "type": "inlineCode", - "value": "Buffer.from()", - "position": { - "start": { "line": 1240, "column": 53, "offset": 36394 }, - "end": { "line": 1240, "column": 68, "offset": 36409 } - } - }, - { - "type": "text", - "value": "\nvariants.", - "position": { - "start": { "line": 1240, "column": 68, "offset": 36409 }, - "end": { "line": 1241, "column": 10, "offset": 36419 } - } - } - ], - "position": { - "start": { "line": 1239, "column": 1, "offset": 36267 }, - "end": { "line": 1241, "column": 10, "offset": 36419 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "It is important to remember that a backing ", - "position": { - "start": { "line": 1243, "column": 1, "offset": 36421 }, - "end": { "line": 1243, "column": 44, "offset": 36464 } - } - }, - { - "type": "inlineCode", - "value": "ArrayBuffer", - "position": { - "start": { "line": 1243, "column": 44, "offset": 36464 }, - "end": { "line": 1243, "column": 57, "offset": 36477 } - } - }, - { - "type": "text", - "value": " can cover a range\nof memory that extends beyond the bounds of a ", - "position": { - "start": { "line": 1243, "column": 57, "offset": 36477 }, - "end": { "line": 1244, "column": 47, "offset": 36542 } - } - }, - { - "type": "inlineCode", - "value": "TypedArray", - "position": { - "start": { "line": 1244, "column": 47, "offset": 36542 }, - "end": { "line": 1244, "column": 59, "offset": 36554 } - } - }, - { - "type": "text", - "value": " view. A new\n", - "position": { - "start": { "line": 1244, "column": 59, "offset": 36554 }, - "end": { "line": 1245, "column": 1, "offset": 36567 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 1245, "column": 1, "offset": 36567 }, - "end": { "line": 1245, "column": 9, "offset": 36575 } - } - }, - { - "type": "text", - "value": " created using the ", - "position": { - "start": { "line": 1245, "column": 9, "offset": 36575 }, - "end": { "line": 1245, "column": 28, "offset": 36594 } - } - }, - { - "type": "inlineCode", - "value": "buffer", - "position": { - "start": { "line": 1245, "column": 28, "offset": 36594 }, - "end": { "line": 1245, "column": 36, "offset": 36602 } - } - }, - { - "type": "text", - "value": " property of a ", - "position": { - "start": { "line": 1245, "column": 36, "offset": 36602 }, - "end": { "line": 1245, "column": 51, "offset": 36617 } - } - }, - { - "type": "inlineCode", - "value": "TypedArray", - "position": { - "start": { "line": 1245, "column": 51, "offset": 36617 }, - "end": { "line": 1245, "column": 63, "offset": 36629 } - } - }, - { - "type": "text", - "value": " may extend\nbeyond the range of the ", - "position": { - "start": { "line": 1245, "column": 63, "offset": 36629 }, - "end": { "line": 1246, "column": 25, "offset": 36665 } - } - }, - { - "type": "inlineCode", - "value": "TypedArray", - "position": { - "start": { "line": 1246, "column": 25, "offset": 36665 }, - "end": { "line": 1246, "column": 37, "offset": 36677 } - } - }, - { - "type": "text", - "value": ":", - "position": { - "start": { "line": 1246, "column": 37, "offset": 36677 }, - "end": { "line": 1246, "column": 38, "offset": 36678 } - } - } - ], - "position": { - "start": { "line": 1243, "column": 1, "offset": 36421 }, - "end": { "line": 1246, "column": 38, "offset": 36678 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst arrA = Uint8Array.from([0x63, 0x64, 0x65, 0x66]); // 4 elements\nconst arrB = new Uint8Array(arrA.buffer, 1, 2); // 2 elements\nconsole.log(arrA.buffer === arrB.buffer); // true\n\nconst buf = Buffer.from(arrB.buffer);\nconsole.log(buf);\n// Prints: ", - "position": { - "start": { "line": 1248, "column": 1, "offset": 36680 }, - "end": { "line": 1258, "column": 4, "offset": 37000 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst arrA = Uint8Array.from([0x63, 0x64, 0x65, 0x66]); // 4 elements\nconst arrB = new Uint8Array(arrA.buffer, 1, 2); // 2 elements\nconsole.log(arrA.buffer === arrB.buffer); // true\n\nconst buf = Buffer.from(arrB.buffer);\nconsole.log(buf);\n// Prints: ", - "position": { - "start": { "line": 1260, "column": 1, "offset": 37002 }, - "end": { "line": 1270, "column": 4, "offset": 37327 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "text", - "value": "Static method: ", - "position": { - "start": { "line": 1272, "column": 5, "offset": 37333 }, - "end": { "line": 1272, "column": 20, "offset": 37348 } - } - }, - { - "type": "inlineCode", - "value": "Buffer.from(buffer)", - "position": { - "start": { "line": 1272, "column": 20, "offset": 37348 }, - "end": { "line": 1272, "column": 41, "offset": 37369 } - } - } - ], - "position": { - "start": { "line": 1272, "column": 1, "offset": 37329 }, - "end": { "line": 1272, "column": 41, "offset": 37369 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 1274, "column": 1, "offset": 37371 }, - "end": { "line": 1276, "column": 4, "offset": 37399 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "buffer", - "position": { - "start": { "line": 1278, "column": 3, "offset": 37403 }, - "end": { "line": 1278, "column": 11, "offset": 37411 } - } - }, - { - "type": "text", - "value": " {Buffer|Uint8Array} An existing ", - "position": { - "start": { "line": 1278, "column": 11, "offset": 37411 }, - "end": { "line": 1278, "column": 44, "offset": 37444 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 1278, "column": 44, "offset": 37444 }, - "end": { "line": 1278, "column": 52, "offset": 37452 } - } - }, - { - "type": "text", - "value": " or {Uint8Array} from\nwhich to copy data.", - "position": { - "start": { "line": 1278, "column": 52, "offset": 37452 }, - "end": { "line": 1279, "column": 22, "offset": 37495 } - } - } - ], - "position": { - "start": { "line": 1278, "column": 3, "offset": 37403 }, - "end": { "line": 1279, "column": 22, "offset": 37495 } - } - } - ], - "position": { - "start": { "line": 1278, "column": 1, "offset": 37401 }, - "end": { "line": 1279, "column": 22, "offset": 37495 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {Buffer}", - "position": { - "start": { "line": 1280, "column": 3, "offset": 37498 }, - "end": { "line": 1280, "column": 20, "offset": 37515 } - } - } - ], - "position": { - "start": { "line": 1280, "column": 3, "offset": 37498 }, - "end": { "line": 1280, "column": 20, "offset": 37515 } - } - } - ], - "position": { - "start": { "line": 1280, "column": 1, "offset": 37496 }, - "end": { "line": 1280, "column": 20, "offset": 37515 } - } - } - ], - "position": { - "start": { "line": 1278, "column": 1, "offset": 37401 }, - "end": { "line": 1280, "column": 20, "offset": 37515 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Copies the passed ", - "position": { - "start": { "line": 1282, "column": 1, "offset": 37517 }, - "end": { "line": 1282, "column": 19, "offset": 37535 } - } - }, - { - "type": "inlineCode", - "value": "buffer", - "position": { - "start": { "line": 1282, "column": 19, "offset": 37535 }, - "end": { "line": 1282, "column": 27, "offset": 37543 } - } - }, - { - "type": "text", - "value": " data onto a new ", - "position": { - "start": { "line": 1282, "column": 27, "offset": 37543 }, - "end": { "line": 1282, "column": 44, "offset": 37560 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 1282, "column": 44, "offset": 37560 }, - "end": { "line": 1282, "column": 52, "offset": 37568 } - } - }, - { - "type": "text", - "value": " instance.", - "position": { - "start": { "line": 1282, "column": 52, "offset": 37568 }, - "end": { "line": 1282, "column": 62, "offset": 37578 } - } - } - ], - "position": { - "start": { "line": 1282, "column": 1, "offset": 37517 }, - "end": { "line": 1282, "column": 62, "offset": 37578 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf1 = Buffer.from('buffer');\nconst buf2 = Buffer.from(buf1);\n\nbuf1[0] = 0x61;\n\nconsole.log(buf1.toString());\n// Prints: auffer\nconsole.log(buf2.toString());\n// Prints: buffer", - "position": { - "start": { "line": 1284, "column": 1, "offset": 37580 }, - "end": { "line": 1296, "column": 4, "offset": 37811 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf1 = Buffer.from('buffer');\nconst buf2 = Buffer.from(buf1);\n\nbuf1[0] = 0x61;\n\nconsole.log(buf1.toString());\n// Prints: auffer\nconsole.log(buf2.toString());\n// Prints: buffer", - "position": { - "start": { "line": 1298, "column": 1, "offset": 37813 }, - "end": { "line": 1310, "column": 4, "offset": 38049 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A ", - "position": { - "start": { "line": 1312, "column": 1, "offset": 38051 }, - "end": { "line": 1312, "column": 3, "offset": 38053 } - } - }, - { - "type": "inlineCode", - "value": "TypeError", - "position": { - "start": { "line": 1312, "column": 3, "offset": 38053 }, - "end": { "line": 1312, "column": 14, "offset": 38064 } - } - }, - { - "type": "text", - "value": " will be thrown if ", - "position": { - "start": { "line": 1312, "column": 14, "offset": 38064 }, - "end": { "line": 1312, "column": 33, "offset": 38083 } - } - }, - { - "type": "inlineCode", - "value": "buffer", - "position": { - "start": { "line": 1312, "column": 33, "offset": 38083 }, - "end": { "line": 1312, "column": 41, "offset": 38091 } - } - }, - { - "type": "text", - "value": " is not a ", - "position": { - "start": { "line": 1312, "column": 41, "offset": 38091 }, - "end": { "line": 1312, "column": 51, "offset": 38101 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 1312, "column": 51, "offset": 38101 }, - "end": { "line": 1312, "column": 59, "offset": 38109 } - } - }, - { - "type": "text", - "value": " or another type\nappropriate for ", - "position": { - "start": { "line": 1312, "column": 59, "offset": 38109 }, - "end": { "line": 1313, "column": 17, "offset": 38142 } - } - }, - { - "type": "inlineCode", - "value": "Buffer.from()", - "position": { - "start": { "line": 1313, "column": 17, "offset": 38142 }, - "end": { "line": 1313, "column": 32, "offset": 38157 } - } - }, - { - "type": "text", - "value": " variants.", - "position": { - "start": { "line": 1313, "column": 32, "offset": 38157 }, - "end": { "line": 1313, "column": 42, "offset": 38167 } - } - } - ], - "position": { - "start": { "line": 1312, "column": 1, "offset": 38051 }, - "end": { "line": 1313, "column": 42, "offset": 38167 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "text", - "value": "Static method: ", - "position": { - "start": { "line": 1315, "column": 5, "offset": 38173 }, - "end": { "line": 1315, "column": 20, "offset": 38188 } - } - }, - { - "type": "inlineCode", - "value": "Buffer.from(object[, offsetOrEncoding[, length]])", - "position": { - "start": { "line": 1315, "column": 20, "offset": 38188 }, - "end": { "line": 1315, "column": 71, "offset": 38239 } - } - } - ], - "position": { - "start": { "line": 1315, "column": 1, "offset": 38169 }, - "end": { "line": 1315, "column": 71, "offset": 38239 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 1317, "column": 1, "offset": 38241 }, - "end": { "line": 1319, "column": 4, "offset": 38268 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "object", - "position": { - "start": { "line": 1321, "column": 3, "offset": 38272 }, - "end": { "line": 1321, "column": 11, "offset": 38280 } - } - }, - { - "type": "text", - "value": " {Object} An object supporting ", - "position": { - "start": { "line": 1321, "column": 11, "offset": 38280 }, - "end": { "line": 1321, "column": 42, "offset": 38311 } - } - }, - { - "type": "inlineCode", - "value": "Symbol.toPrimitive", - "position": { - "start": { "line": 1321, "column": 42, "offset": 38311 }, - "end": { "line": 1321, "column": 62, "offset": 38331 } - } - }, - { - "type": "text", - "value": " or ", - "position": { - "start": { "line": 1321, "column": 62, "offset": 38331 }, - "end": { "line": 1321, "column": 66, "offset": 38335 } - } - }, - { - "type": "inlineCode", - "value": "valueOf()", - "position": { - "start": { "line": 1321, "column": 66, "offset": 38335 }, - "end": { "line": 1321, "column": 77, "offset": 38346 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 1321, "column": 77, "offset": 38346 }, - "end": { "line": 1321, "column": 78, "offset": 38347 } - } - } - ], - "position": { - "start": { "line": 1321, "column": 3, "offset": 38272 }, - "end": { "line": 1321, "column": 78, "offset": 38347 } - } - } - ], - "position": { - "start": { "line": 1321, "column": 1, "offset": 38270 }, - "end": { "line": 1321, "column": 78, "offset": 38347 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "offsetOrEncoding", - "position": { - "start": { "line": 1322, "column": 3, "offset": 38350 }, - "end": { "line": 1322, "column": 21, "offset": 38368 } - } - }, - { - "type": "text", - "value": " {integer|string} A byte-offset or encoding.", - "position": { - "start": { "line": 1322, "column": 21, "offset": 38368 }, - "end": { "line": 1322, "column": 65, "offset": 38412 } - } - } - ], - "position": { - "start": { "line": 1322, "column": 3, "offset": 38350 }, - "end": { "line": 1322, "column": 65, "offset": 38412 } - } - } - ], - "position": { - "start": { "line": 1322, "column": 1, "offset": 38348 }, - "end": { "line": 1322, "column": 65, "offset": 38412 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "length", - "position": { - "start": { "line": 1323, "column": 3, "offset": 38415 }, - "end": { "line": 1323, "column": 11, "offset": 38423 } - } - }, - { - "type": "text", - "value": " {integer} A length.", - "position": { - "start": { "line": 1323, "column": 11, "offset": 38423 }, - "end": { "line": 1323, "column": 31, "offset": 38443 } - } - } - ], - "position": { - "start": { "line": 1323, "column": 3, "offset": 38415 }, - "end": { "line": 1323, "column": 31, "offset": 38443 } - } - } - ], - "position": { - "start": { "line": 1323, "column": 1, "offset": 38413 }, - "end": { "line": 1323, "column": 31, "offset": 38443 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {Buffer}", - "position": { - "start": { "line": 1324, "column": 3, "offset": 38446 }, - "end": { "line": 1324, "column": 20, "offset": 38463 } - } - } - ], - "position": { - "start": { "line": 1324, "column": 3, "offset": 38446 }, - "end": { "line": 1324, "column": 20, "offset": 38463 } - } - } - ], - "position": { - "start": { "line": 1324, "column": 1, "offset": 38444 }, - "end": { "line": 1324, "column": 20, "offset": 38463 } - } - } - ], - "position": { - "start": { "line": 1321, "column": 1, "offset": 38270 }, - "end": { "line": 1324, "column": 20, "offset": 38463 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "For objects whose ", - "position": { - "start": { "line": 1326, "column": 1, "offset": 38465 }, - "end": { "line": 1326, "column": 19, "offset": 38483 } - } - }, - { - "type": "inlineCode", - "value": "valueOf()", - "position": { - "start": { "line": 1326, "column": 19, "offset": 38483 }, - "end": { "line": 1326, "column": 30, "offset": 38494 } - } - }, - { - "type": "text", - "value": " function returns a value not strictly equal to\n", - "position": { - "start": { "line": 1326, "column": 30, "offset": 38494 }, - "end": { "line": 1327, "column": 1, "offset": 38542 } - } - }, - { - "type": "inlineCode", - "value": "object", - "position": { - "start": { "line": 1327, "column": 1, "offset": 38542 }, - "end": { "line": 1327, "column": 9, "offset": 38550 } - } - }, - { - "type": "text", - "value": ", returns ", - "position": { - "start": { "line": 1327, "column": 9, "offset": 38550 }, - "end": { "line": 1327, "column": 19, "offset": 38560 } - } - }, - { - "type": "inlineCode", - "value": "Buffer.from(object.valueOf(), offsetOrEncoding, length)", - "position": { - "start": { "line": 1327, "column": 19, "offset": 38560 }, - "end": { "line": 1327, "column": 76, "offset": 38617 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 1327, "column": 76, "offset": 38617 }, - "end": { "line": 1327, "column": 77, "offset": 38618 } - } - } - ], - "position": { - "start": { "line": 1326, "column": 1, "offset": 38465 }, - "end": { "line": 1327, "column": 77, "offset": 38618 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from(new String('this is a test'));\n// Prints: ", - "position": { - "start": { "line": 1329, "column": 1, "offset": 38620 }, - "end": { "line": 1334, "column": 4, "offset": 38786 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from(new String('this is a test'));\n// Prints: ", - "position": { - "start": { "line": 1336, "column": 1, "offset": 38788 }, - "end": { "line": 1341, "column": 4, "offset": 38959 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "For objects that support ", - "position": { - "start": { "line": 1343, "column": 1, "offset": 38961 }, - "end": { "line": 1343, "column": 26, "offset": 38986 } - } - }, - { - "type": "inlineCode", - "value": "Symbol.toPrimitive", - "position": { - "start": { "line": 1343, "column": 26, "offset": 38986 }, - "end": { "line": 1343, "column": 46, "offset": 39006 } - } - }, - { - "type": "text", - "value": ", returns\n", - "position": { - "start": { "line": 1343, "column": 46, "offset": 39006 }, - "end": { "line": 1344, "column": 1, "offset": 39016 } - } - }, - { - "type": "inlineCode", - "value": "Buffer.from(object[Symbol.toPrimitive]('string'), offsetOrEncoding)", - "position": { - "start": { "line": 1344, "column": 1, "offset": 39016 }, - "end": { "line": 1344, "column": 70, "offset": 39085 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 1344, "column": 70, "offset": 39085 }, - "end": { "line": 1344, "column": 71, "offset": 39086 } - } - } - ], - "position": { - "start": { "line": 1343, "column": 1, "offset": 38961 }, - "end": { "line": 1344, "column": 71, "offset": 39086 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nclass Foo {\n [Symbol.toPrimitive]() {\n return 'this is a test';\n }\n}\n\nconst buf = Buffer.from(new Foo(), 'utf8');\n// Prints: ", - "position": { - "start": { "line": 1346, "column": 1, "offset": 39088 }, - "end": { "line": 1357, "column": 4, "offset": 39318 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nclass Foo {\n [Symbol.toPrimitive]() {\n return 'this is a test';\n }\n}\n\nconst buf = Buffer.from(new Foo(), 'utf8');\n// Prints: ", - "position": { - "start": { "line": 1359, "column": 1, "offset": 39320 }, - "end": { "line": 1370, "column": 4, "offset": 39555 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A ", - "position": { - "start": { "line": 1372, "column": 1, "offset": 39557 }, - "end": { "line": 1372, "column": 3, "offset": 39559 } - } - }, - { - "type": "inlineCode", - "value": "TypeError", - "position": { - "start": { "line": 1372, "column": 3, "offset": 39559 }, - "end": { "line": 1372, "column": 14, "offset": 39570 } - } - }, - { - "type": "text", - "value": " will be thrown if ", - "position": { - "start": { "line": 1372, "column": 14, "offset": 39570 }, - "end": { "line": 1372, "column": 33, "offset": 39589 } - } - }, - { - "type": "inlineCode", - "value": "object", - "position": { - "start": { "line": 1372, "column": 33, "offset": 39589 }, - "end": { "line": 1372, "column": 41, "offset": 39597 } - } - }, - { - "type": "text", - "value": " does not have the mentioned methods or\nis not of another type appropriate for ", - "position": { - "start": { "line": 1372, "column": 41, "offset": 39597 }, - "end": { "line": 1373, "column": 40, "offset": 39676 } - } - }, - { - "type": "inlineCode", - "value": "Buffer.from()", - "position": { - "start": { "line": 1373, "column": 40, "offset": 39676 }, - "end": { "line": 1373, "column": 55, "offset": 39691 } - } - }, - { - "type": "text", - "value": " variants.", - "position": { - "start": { "line": 1373, "column": 55, "offset": 39691 }, - "end": { "line": 1373, "column": 65, "offset": 39701 } - } - } - ], - "position": { - "start": { "line": 1372, "column": 1, "offset": 39557 }, - "end": { "line": 1373, "column": 65, "offset": 39701 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "text", - "value": "Static method: ", - "position": { - "start": { "line": 1375, "column": 5, "offset": 39707 }, - "end": { "line": 1375, "column": 20, "offset": 39722 } - } - }, - { - "type": "inlineCode", - "value": "Buffer.from(string[, encoding])", - "position": { - "start": { "line": 1375, "column": 20, "offset": 39722 }, - "end": { "line": 1375, "column": 53, "offset": 39755 } - } - } - ], - "position": { - "start": { "line": 1375, "column": 1, "offset": 39703 }, - "end": { "line": 1375, "column": 53, "offset": 39755 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 1377, "column": 1, "offset": 39757 }, - "end": { "line": 1379, "column": 4, "offset": 39785 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "string", - "position": { - "start": { "line": 1381, "column": 3, "offset": 39789 }, - "end": { "line": 1381, "column": 11, "offset": 39797 } - } - }, - { - "type": "text", - "value": " {string} A string to encode.", - "position": { - "start": { "line": 1381, "column": 11, "offset": 39797 }, - "end": { "line": 1381, "column": 40, "offset": 39826 } - } - } - ], - "position": { - "start": { "line": 1381, "column": 3, "offset": 39789 }, - "end": { "line": 1381, "column": 40, "offset": 39826 } - } - } - ], - "position": { - "start": { "line": 1381, "column": 1, "offset": 39787 }, - "end": { "line": 1381, "column": 40, "offset": 39826 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "encoding", - "position": { - "start": { "line": 1382, "column": 3, "offset": 39829 }, - "end": { "line": 1382, "column": 13, "offset": 39839 } - } - }, - { - "type": "text", - "value": " {string} The encoding of ", - "position": { - "start": { "line": 1382, "column": 13, "offset": 39839 }, - "end": { "line": 1382, "column": 39, "offset": 39865 } - } - }, - { - "type": "inlineCode", - "value": "string", - "position": { - "start": { "line": 1382, "column": 39, "offset": 39865 }, - "end": { "line": 1382, "column": 47, "offset": 39873 } - } - }, - { - "type": "text", - "value": ". ", - "position": { - "start": { "line": 1382, "column": 47, "offset": 39873 }, - "end": { "line": 1382, "column": 49, "offset": 39875 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { - "line": 1382, - "column": 51, - "offset": 39877 - }, - "end": { "line": 1382, "column": 59, "offset": 39885 } - } - } - ], - "position": { - "start": { "line": 1382, "column": 49, "offset": 39875 }, - "end": { "line": 1382, "column": 61, "offset": 39887 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 1382, "column": 61, "offset": 39887 }, - "end": { "line": 1382, "column": 62, "offset": 39888 } - } - }, - { - "type": "inlineCode", - "value": "'utf8'", - "position": { - "start": { "line": 1382, "column": 62, "offset": 39888 }, - "end": { "line": 1382, "column": 70, "offset": 39896 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 1382, "column": 70, "offset": 39896 }, - "end": { "line": 1382, "column": 71, "offset": 39897 } - } - } - ], - "position": { - "start": { "line": 1382, "column": 3, "offset": 39829 }, - "end": { "line": 1382, "column": 71, "offset": 39897 } - } - } - ], - "position": { - "start": { "line": 1382, "column": 1, "offset": 39827 }, - "end": { "line": 1382, "column": 71, "offset": 39897 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {Buffer}", - "position": { - "start": { "line": 1383, "column": 3, "offset": 39900 }, - "end": { "line": 1383, "column": 20, "offset": 39917 } - } - } - ], - "position": { - "start": { "line": 1383, "column": 3, "offset": 39900 }, - "end": { "line": 1383, "column": 20, "offset": 39917 } - } - } - ], - "position": { - "start": { "line": 1383, "column": 1, "offset": 39898 }, - "end": { "line": 1383, "column": 20, "offset": 39917 } - } - } - ], - "position": { - "start": { "line": 1381, "column": 1, "offset": 39787 }, - "end": { "line": 1383, "column": 20, "offset": 39917 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Creates a new ", - "position": { - "start": { "line": 1385, "column": 1, "offset": 39919 }, - "end": { "line": 1385, "column": 15, "offset": 39933 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 1385, "column": 15, "offset": 39933 }, - "end": { "line": 1385, "column": 23, "offset": 39941 } - } - }, - { - "type": "text", - "value": " containing ", - "position": { - "start": { "line": 1385, "column": 23, "offset": 39941 }, - "end": { "line": 1385, "column": 35, "offset": 39953 } - } - }, - { - "type": "inlineCode", - "value": "string", - "position": { - "start": { "line": 1385, "column": 35, "offset": 39953 }, - "end": { "line": 1385, "column": 43, "offset": 39961 } - } - }, - { - "type": "text", - "value": ". The ", - "position": { - "start": { "line": 1385, "column": 43, "offset": 39961 }, - "end": { "line": 1385, "column": 49, "offset": 39967 } - } - }, - { - "type": "inlineCode", - "value": "encoding", - "position": { - "start": { "line": 1385, "column": 49, "offset": 39967 }, - "end": { "line": 1385, "column": 59, "offset": 39977 } - } - }, - { - "type": "text", - "value": " parameter identifies\nthe character encoding to be used when converting ", - "position": { - "start": { "line": 1385, "column": 59, "offset": 39977 }, - "end": { "line": 1386, "column": 51, "offset": 40049 } - } - }, - { - "type": "inlineCode", - "value": "string", - "position": { - "start": { "line": 1386, "column": 51, "offset": 40049 }, - "end": { "line": 1386, "column": 59, "offset": 40057 } - } - }, - { - "type": "text", - "value": " into bytes.", - "position": { - "start": { "line": 1386, "column": 59, "offset": 40057 }, - "end": { "line": 1386, "column": 71, "offset": 40069 } - } - } - ], - "position": { - "start": { "line": 1385, "column": 1, "offset": 39919 }, - "end": { "line": 1386, "column": 71, "offset": 40069 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf1 = Buffer.from('this is a tést');\nconst buf2 = Buffer.from('7468697320697320612074c3a97374', 'hex');\n\nconsole.log(buf1.toString());\n// Prints: this is a tést\nconsole.log(buf2.toString());\n// Prints: this is a tést\nconsole.log(buf1.toString('latin1'));\n// Prints: this is a tést", - "position": { - "start": { "line": 1388, "column": 1, "offset": 40071 }, - "end": { "line": 1400, "column": 4, "offset": 40409 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf1 = Buffer.from('this is a tést');\nconst buf2 = Buffer.from('7468697320697320612074c3a97374', 'hex');\n\nconsole.log(buf1.toString());\n// Prints: this is a tést\nconsole.log(buf2.toString());\n// Prints: this is a tést\nconsole.log(buf1.toString('latin1'));\n// Prints: this is a tést", - "position": { - "start": { "line": 1402, "column": 1, "offset": 40411 }, - "end": { "line": 1414, "column": 4, "offset": 40754 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A ", - "position": { - "start": { "line": 1416, "column": 1, "offset": 40756 }, - "end": { "line": 1416, "column": 3, "offset": 40758 } - } - }, - { - "type": "inlineCode", - "value": "TypeError", - "position": { - "start": { "line": 1416, "column": 3, "offset": 40758 }, - "end": { "line": 1416, "column": 14, "offset": 40769 } - } - }, - { - "type": "text", - "value": " will be thrown if ", - "position": { - "start": { "line": 1416, "column": 14, "offset": 40769 }, - "end": { "line": 1416, "column": 33, "offset": 40788 } - } - }, - { - "type": "inlineCode", - "value": "string", - "position": { - "start": { "line": 1416, "column": 33, "offset": 40788 }, - "end": { "line": 1416, "column": 41, "offset": 40796 } - } - }, - { - "type": "text", - "value": " is not a string or another type\nappropriate for ", - "position": { - "start": { "line": 1416, "column": 41, "offset": 40796 }, - "end": { "line": 1417, "column": 17, "offset": 40845 } - } - }, - { - "type": "inlineCode", - "value": "Buffer.from()", - "position": { - "start": { "line": 1417, "column": 17, "offset": 40845 }, - "end": { "line": 1417, "column": 32, "offset": 40860 } - } - }, - { - "type": "text", - "value": " variants.", - "position": { - "start": { "line": 1417, "column": 32, "offset": 40860 }, - "end": { "line": 1417, "column": 42, "offset": 40870 } - } - } - ], - "position": { - "start": { "line": 1416, "column": 1, "offset": 40756 }, - "end": { "line": 1417, "column": 42, "offset": 40870 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "Buffer.from(string)", - "position": { - "start": { "line": 1419, "column": 2, "offset": 40873 }, - "end": { "line": 1419, "column": 23, "offset": 40894 } - } - } - ], - "position": { - "start": { "line": 1419, "column": 1, "offset": 40872 }, - "end": { "line": 1419, "column": 26, "offset": 40897 } - }, - "label": "`Buffer.from(string)`", - "identifier": "`buffer.from(string)`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": " may also use the internal ", - "position": { - "start": { "line": 1419, "column": 26, "offset": 40897 }, - "end": { "line": 1419, "column": 53, "offset": 40924 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 1419, "column": 53, "offset": 40924 }, - "end": { "line": 1419, "column": 61, "offset": 40932 } - } - }, - { - "type": "text", - "value": " pool like\n", - "position": { - "start": { "line": 1419, "column": 61, "offset": 40932 }, - "end": { "line": 1420, "column": 1, "offset": 40943 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "Buffer.allocUnsafe()", - "position": { - "start": { "line": 1420, "column": 2, "offset": 40944 }, - "end": { "line": 1420, "column": 24, "offset": 40966 } - } - } - ], - "position": { - "start": { "line": 1420, "column": 1, "offset": 40943 }, - "end": { "line": 1420, "column": 27, "offset": 40969 } - }, - "label": "`Buffer.allocUnsafe()`", - "identifier": "`buffer.allocunsafe()`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": " does.", - "position": { - "start": { "line": 1420, "column": 27, "offset": 40969 }, - "end": { "line": 1420, "column": 33, "offset": 40975 } - } - } - ], - "position": { - "start": { "line": 1419, "column": 1, "offset": 40872 }, - "end": { "line": 1420, "column": 33, "offset": 40975 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "text", - "value": "Static method: ", - "position": { - "start": { "line": 1422, "column": 5, "offset": 40981 }, - "end": { "line": 1422, "column": 20, "offset": 40996 } - } - }, - { - "type": "inlineCode", - "value": "Buffer.isBuffer(obj)", - "position": { - "start": { "line": 1422, "column": 20, "offset": 40996 }, - "end": { "line": 1422, "column": 42, "offset": 41018 } - } - } - ], - "position": { - "start": { "line": 1422, "column": 1, "offset": 40977 }, - "end": { "line": 1422, "column": 42, "offset": 41018 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 1424, "column": 1, "offset": 41020 }, - "end": { "line": 1426, "column": 4, "offset": 41049 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "obj", - "position": { - "start": { "line": 1428, "column": 3, "offset": 41053 }, - "end": { "line": 1428, "column": 8, "offset": 41058 } - } - }, - { - "type": "text", - "value": " {Object}", - "position": { - "start": { "line": 1428, "column": 8, "offset": 41058 }, - "end": { "line": 1428, "column": 17, "offset": 41067 } - } - } - ], - "position": { - "start": { "line": 1428, "column": 3, "offset": 41053 }, - "end": { "line": 1428, "column": 17, "offset": 41067 } - } - } - ], - "position": { - "start": { "line": 1428, "column": 1, "offset": 41051 }, - "end": { "line": 1428, "column": 17, "offset": 41067 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {boolean}", - "position": { - "start": { "line": 1429, "column": 3, "offset": 41070 }, - "end": { "line": 1429, "column": 21, "offset": 41088 } - } - } - ], - "position": { - "start": { "line": 1429, "column": 3, "offset": 41070 }, - "end": { "line": 1429, "column": 21, "offset": 41088 } - } - } - ], - "position": { - "start": { "line": 1429, "column": 1, "offset": 41068 }, - "end": { "line": 1429, "column": 21, "offset": 41088 } - } - } - ], - "position": { - "start": { "line": 1428, "column": 1, "offset": 41051 }, - "end": { "line": 1429, "column": 21, "offset": 41088 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns ", - "position": { - "start": { "line": 1431, "column": 1, "offset": 41090 }, - "end": { "line": 1431, "column": 9, "offset": 41098 } - } - }, - { - "type": "inlineCode", - "value": "true", - "position": { - "start": { "line": 1431, "column": 9, "offset": 41098 }, - "end": { "line": 1431, "column": 15, "offset": 41104 } - } - }, - { - "type": "text", - "value": " if ", - "position": { - "start": { "line": 1431, "column": 15, "offset": 41104 }, - "end": { "line": 1431, "column": 19, "offset": 41108 } - } - }, - { - "type": "inlineCode", - "value": "obj", - "position": { - "start": { "line": 1431, "column": 19, "offset": 41108 }, - "end": { "line": 1431, "column": 24, "offset": 41113 } - } - }, - { - "type": "text", - "value": " is a ", - "position": { - "start": { "line": 1431, "column": 24, "offset": 41113 }, - "end": { "line": 1431, "column": 30, "offset": 41119 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 1431, "column": 30, "offset": 41119 }, - "end": { "line": 1431, "column": 38, "offset": 41127 } - } - }, - { - "type": "text", - "value": ", ", - "position": { - "start": { "line": 1431, "column": 38, "offset": 41127 }, - "end": { "line": 1431, "column": 40, "offset": 41129 } - } - }, - { - "type": "inlineCode", - "value": "false", - "position": { - "start": { "line": 1431, "column": 40, "offset": 41129 }, - "end": { "line": 1431, "column": 47, "offset": 41136 } - } - }, - { - "type": "text", - "value": " otherwise.", - "position": { - "start": { "line": 1431, "column": 47, "offset": 41136 }, - "end": { "line": 1431, "column": 58, "offset": 41147 } - } - } - ], - "position": { - "start": { "line": 1431, "column": 1, "offset": 41090 }, - "end": { "line": 1431, "column": 58, "offset": 41147 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nBuffer.isBuffer(Buffer.alloc(10)); // true\nBuffer.isBuffer(Buffer.from('foo')); // true\nBuffer.isBuffer('a string'); // false\nBuffer.isBuffer([]); // false\nBuffer.isBuffer(new Uint8Array(1024)); // false", - "position": { - "start": { "line": 1433, "column": 1, "offset": 41149 }, - "end": { "line": 1441, "column": 4, "offset": 41402 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nBuffer.isBuffer(Buffer.alloc(10)); // true\nBuffer.isBuffer(Buffer.from('foo')); // true\nBuffer.isBuffer('a string'); // false\nBuffer.isBuffer([]); // false\nBuffer.isBuffer(new Uint8Array(1024)); // false", - "position": { - "start": { "line": 1443, "column": 1, "offset": 41404 }, - "end": { "line": 1451, "column": 4, "offset": 41662 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "text", - "value": "Static method: ", - "position": { - "start": { "line": 1453, "column": 5, "offset": 41668 }, - "end": { "line": 1453, "column": 20, "offset": 41683 } - } - }, - { - "type": "inlineCode", - "value": "Buffer.isEncoding(encoding)", - "position": { - "start": { "line": 1453, "column": 20, "offset": 41683 }, - "end": { "line": 1453, "column": 49, "offset": 41712 } - } - } - ], - "position": { - "start": { "line": 1453, "column": 1, "offset": 41664 }, - "end": { "line": 1453, "column": 49, "offset": 41712 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 1455, "column": 1, "offset": 41714 }, - "end": { "line": 1457, "column": 4, "offset": 41741 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "encoding", - "position": { - "start": { "line": 1459, "column": 3, "offset": 41745 }, - "end": { "line": 1459, "column": 13, "offset": 41755 } - } - }, - { - "type": "text", - "value": " {string} A character encoding name to check.", - "position": { - "start": { "line": 1459, "column": 13, "offset": 41755 }, - "end": { "line": 1459, "column": 58, "offset": 41800 } - } - } - ], - "position": { - "start": { "line": 1459, "column": 3, "offset": 41745 }, - "end": { "line": 1459, "column": 58, "offset": 41800 } - } - } - ], - "position": { - "start": { "line": 1459, "column": 1, "offset": 41743 }, - "end": { "line": 1459, "column": 58, "offset": 41800 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {boolean}", - "position": { - "start": { "line": 1460, "column": 3, "offset": 41803 }, - "end": { "line": 1460, "column": 21, "offset": 41821 } - } - } - ], - "position": { - "start": { "line": 1460, "column": 3, "offset": 41803 }, - "end": { "line": 1460, "column": 21, "offset": 41821 } - } - } - ], - "position": { - "start": { "line": 1460, "column": 1, "offset": 41801 }, - "end": { "line": 1460, "column": 21, "offset": 41821 } - } - } - ], - "position": { - "start": { "line": 1459, "column": 1, "offset": 41743 }, - "end": { "line": 1460, "column": 21, "offset": 41821 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns ", - "position": { - "start": { "line": 1462, "column": 1, "offset": 41823 }, - "end": { "line": 1462, "column": 9, "offset": 41831 } - } - }, - { - "type": "inlineCode", - "value": "true", - "position": { - "start": { "line": 1462, "column": 9, "offset": 41831 }, - "end": { "line": 1462, "column": 15, "offset": 41837 } - } - }, - { - "type": "text", - "value": " if ", - "position": { - "start": { "line": 1462, "column": 15, "offset": 41837 }, - "end": { "line": 1462, "column": 19, "offset": 41841 } - } - }, - { - "type": "inlineCode", - "value": "encoding", - "position": { - "start": { "line": 1462, "column": 19, "offset": 41841 }, - "end": { "line": 1462, "column": 29, "offset": 41851 } - } - }, - { - "type": "text", - "value": " is the name of a supported character encoding,\nor ", - "position": { - "start": { "line": 1462, "column": 29, "offset": 41851 }, - "end": { "line": 1463, "column": 4, "offset": 41902 } - } - }, - { - "type": "inlineCode", - "value": "false", - "position": { - "start": { "line": 1463, "column": 4, "offset": 41902 }, - "end": { "line": 1463, "column": 11, "offset": 41909 } - } - }, - { - "type": "text", - "value": " otherwise.", - "position": { - "start": { "line": 1463, "column": 11, "offset": 41909 }, - "end": { "line": 1463, "column": 22, "offset": 41920 } - } - } - ], - "position": { - "start": { "line": 1462, "column": 1, "offset": 41823 }, - "end": { "line": 1463, "column": 22, "offset": 41920 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconsole.log(Buffer.isEncoding('utf8'));\n// Prints: true\n\nconsole.log(Buffer.isEncoding('hex'));\n// Prints: true\n\nconsole.log(Buffer.isEncoding('utf/8'));\n// Prints: false\n\nconsole.log(Buffer.isEncoding(''));\n// Prints: false", - "position": { - "start": { "line": 1465, "column": 1, "offset": 41922 }, - "end": { "line": 1479, "column": 4, "offset": 42196 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconsole.log(Buffer.isEncoding('utf8'));\n// Prints: true\n\nconsole.log(Buffer.isEncoding('hex'));\n// Prints: true\n\nconsole.log(Buffer.isEncoding('utf/8'));\n// Prints: false\n\nconsole.log(Buffer.isEncoding(''));\n// Prints: false", - "position": { - "start": { "line": 1481, "column": 1, "offset": 42198 }, - "end": { "line": 1495, "column": 4, "offset": 42477 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "text", - "value": "Class property: ", - "position": { - "start": { "line": 1497, "column": 5, "offset": 42483 }, - "end": { "line": 1497, "column": 21, "offset": 42499 } - } - }, - { - "type": "inlineCode", - "value": "Buffer.poolSize", - "position": { - "start": { "line": 1497, "column": 21, "offset": 42499 }, - "end": { "line": 1497, "column": 38, "offset": 42516 } - } - } - ], - "position": { - "start": { "line": 1497, "column": 1, "offset": 42479 }, - "end": { "line": 1497, "column": 38, "offset": 42516 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 1499, "column": 1, "offset": 42518 }, - "end": { "line": 1501, "column": 4, "offset": 42546 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "{integer} ", - "position": { - "start": { "line": 1503, "column": 3, "offset": 42550 }, - "end": { "line": 1503, "column": 13, "offset": 42560 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { - "line": 1503, - "column": 15, - "offset": 42562 - }, - "end": { "line": 1503, "column": 23, "offset": 42570 } - } - } - ], - "position": { - "start": { "line": 1503, "column": 13, "offset": 42560 }, - "end": { "line": 1503, "column": 25, "offset": 42572 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 1503, "column": 25, "offset": 42572 }, - "end": { "line": 1503, "column": 26, "offset": 42573 } - } - }, - { - "type": "inlineCode", - "value": "8192", - "position": { - "start": { "line": 1503, "column": 26, "offset": 42573 }, - "end": { "line": 1503, "column": 32, "offset": 42579 } - } - } - ], - "position": { - "start": { "line": 1503, "column": 3, "offset": 42550 }, - "end": { "line": 1503, "column": 32, "offset": 42579 } - } - } - ], - "position": { - "start": { "line": 1503, "column": 1, "offset": 42548 }, - "end": { "line": 1503, "column": 32, "offset": 42579 } - } - } - ], - "position": { - "start": { "line": 1503, "column": 1, "offset": 42548 }, - "end": { "line": 1503, "column": 32, "offset": 42579 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This is the size (in bytes) of pre-allocated internal ", - "position": { - "start": { "line": 1505, "column": 1, "offset": 42581 }, - "end": { "line": 1505, "column": 55, "offset": 42635 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 1505, "column": 55, "offset": 42635 }, - "end": { "line": 1505, "column": 63, "offset": 42643 } - } - }, - { - "type": "text", - "value": " instances used\nfor pooling. This value may be modified.", - "position": { - "start": { "line": 1505, "column": 63, "offset": 42643 }, - "end": { "line": 1506, "column": 41, "offset": 42699 } - } - } - ], - "position": { - "start": { "line": 1505, "column": 1, "offset": 42581 }, - "end": { "line": 1506, "column": 41, "offset": 42699 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf[index]", - "position": { - "start": { "line": 1508, "column": 5, "offset": 42705 }, - "end": { "line": 1508, "column": 17, "offset": 42717 } - } - } - ], - "position": { - "start": { "line": 1508, "column": 1, "offset": 42701 }, - "end": { "line": 1508, "column": 17, "offset": 42717 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "index", - "position": { - "start": { "line": 1510, "column": 3, "offset": 42721 }, - "end": { "line": 1510, "column": 10, "offset": 42728 } - } - }, - { - "type": "text", - "value": " {integer}", - "position": { - "start": { "line": 1510, "column": 10, "offset": 42728 }, - "end": { "line": 1510, "column": 20, "offset": 42738 } - } - } - ], - "position": { - "start": { "line": 1510, "column": 3, "offset": 42721 }, - "end": { "line": 1510, "column": 20, "offset": 42738 } - } - } - ], - "position": { - "start": { "line": 1510, "column": 1, "offset": 42719 }, - "end": { "line": 1510, "column": 20, "offset": 42738 } - } - } - ], - "position": { - "start": { "line": 1510, "column": 1, "offset": 42719 }, - "end": { "line": 1510, "column": 20, "offset": 42738 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The index operator ", - "position": { - "start": { "line": 1512, "column": 1, "offset": 42740 }, - "end": { "line": 1512, "column": 20, "offset": 42759 } - } - }, - { - "type": "inlineCode", - "value": "[index]", - "position": { - "start": { "line": 1512, "column": 20, "offset": 42759 }, - "end": { "line": 1512, "column": 29, "offset": 42768 } - } - }, - { - "type": "text", - "value": " can be used to get and set the octet at position\n", - "position": { - "start": { "line": 1512, "column": 29, "offset": 42768 }, - "end": { "line": 1513, "column": 1, "offset": 42818 } - } - }, - { - "type": "inlineCode", - "value": "index", - "position": { - "start": { "line": 1513, "column": 1, "offset": 42818 }, - "end": { "line": 1513, "column": 8, "offset": 42825 } - } - }, - { - "type": "text", - "value": " in ", - "position": { - "start": { "line": 1513, "column": 8, "offset": 42825 }, - "end": { "line": 1513, "column": 12, "offset": 42829 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 1513, "column": 12, "offset": 42829 }, - "end": { "line": 1513, "column": 17, "offset": 42834 } - } - }, - { - "type": "text", - "value": ". The values refer to individual bytes, so the legal value\nrange is between ", - "position": { - "start": { "line": 1513, "column": 17, "offset": 42834 }, - "end": { "line": 1514, "column": 18, "offset": 42910 } - } - }, - { - "type": "inlineCode", - "value": "0x00", - "position": { - "start": { "line": 1514, "column": 18, "offset": 42910 }, - "end": { "line": 1514, "column": 24, "offset": 42916 } - } - }, - { - "type": "text", - "value": " and ", - "position": { - "start": { "line": 1514, "column": 24, "offset": 42916 }, - "end": { "line": 1514, "column": 29, "offset": 42921 } - } - }, - { - "type": "inlineCode", - "value": "0xFF", - "position": { - "start": { "line": 1514, "column": 29, "offset": 42921 }, - "end": { "line": 1514, "column": 35, "offset": 42927 } - } - }, - { - "type": "text", - "value": " (hex) or ", - "position": { - "start": { "line": 1514, "column": 35, "offset": 42927 }, - "end": { "line": 1514, "column": 45, "offset": 42937 } - } - }, - { - "type": "inlineCode", - "value": "0", - "position": { - "start": { "line": 1514, "column": 45, "offset": 42937 }, - "end": { "line": 1514, "column": 48, "offset": 42940 } - } - }, - { - "type": "text", - "value": " and ", - "position": { - "start": { "line": 1514, "column": 48, "offset": 42940 }, - "end": { "line": 1514, "column": 53, "offset": 42945 } - } - }, - { - "type": "inlineCode", - "value": "255", - "position": { - "start": { "line": 1514, "column": 53, "offset": 42945 }, - "end": { "line": 1514, "column": 58, "offset": 42950 } - } - }, - { - "type": "text", - "value": " (decimal).", - "position": { - "start": { "line": 1514, "column": 58, "offset": 42950 }, - "end": { "line": 1514, "column": 69, "offset": 42961 } - } - } - ], - "position": { - "start": { "line": 1512, "column": 1, "offset": 42740 }, - "end": { "line": 1514, "column": 69, "offset": 42961 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This operator is inherited from ", - "position": { - "start": { "line": 1516, "column": 1, "offset": 42963 }, - "end": { "line": 1516, "column": 33, "offset": 42995 } - } - }, - { - "type": "inlineCode", - "value": "Uint8Array", - "position": { - "start": { "line": 1516, "column": 33, "offset": 42995 }, - "end": { "line": 1516, "column": 45, "offset": 43007 } - } - }, - { - "type": "text", - "value": ", so its behavior on out-of-bounds\naccess is the same as ", - "position": { - "start": { "line": 1516, "column": 45, "offset": 43007 }, - "end": { "line": 1517, "column": 23, "offset": 43064 } - } - }, - { - "type": "inlineCode", - "value": "Uint8Array", - "position": { - "start": { "line": 1517, "column": 23, "offset": 43064 }, - "end": { "line": 1517, "column": 35, "offset": 43076 } - } - }, - { - "type": "text", - "value": ". In other words, ", - "position": { - "start": { "line": 1517, "column": 35, "offset": 43076 }, - "end": { "line": 1517, "column": 53, "offset": 43094 } - } - }, - { - "type": "inlineCode", - "value": "buf[index]", - "position": { - "start": { "line": 1517, "column": 53, "offset": 43094 }, - "end": { "line": 1517, "column": 65, "offset": 43106 } - } - }, - { - "type": "text", - "value": " returns\n", - "position": { - "start": { "line": 1517, "column": 65, "offset": 43106 }, - "end": { "line": 1518, "column": 1, "offset": 43115 } - } - }, - { - "type": "inlineCode", - "value": "undefined", - "position": { - "start": { "line": 1518, "column": 1, "offset": 43115 }, - "end": { "line": 1518, "column": 12, "offset": 43126 } - } - }, - { - "type": "text", - "value": " when ", - "position": { - "start": { "line": 1518, "column": 12, "offset": 43126 }, - "end": { "line": 1518, "column": 18, "offset": 43132 } - } - }, - { - "type": "inlineCode", - "value": "index", - "position": { - "start": { "line": 1518, "column": 18, "offset": 43132 }, - "end": { "line": 1518, "column": 25, "offset": 43139 } - } - }, - { - "type": "text", - "value": " is negative or greater or equal to ", - "position": { - "start": { "line": 1518, "column": 25, "offset": 43139 }, - "end": { "line": 1518, "column": 61, "offset": 43175 } - } - }, - { - "type": "inlineCode", - "value": "buf.length", - "position": { - "start": { "line": 1518, "column": 61, "offset": 43175 }, - "end": { "line": 1518, "column": 73, "offset": 43187 } - } - }, - { - "type": "text", - "value": ", and\n", - "position": { - "start": { "line": 1518, "column": 73, "offset": 43187 }, - "end": { "line": 1519, "column": 1, "offset": 43193 } - } - }, - { - "type": "inlineCode", - "value": "buf[index] = value", - "position": { - "start": { "line": 1519, "column": 1, "offset": 43193 }, - "end": { "line": 1519, "column": 21, "offset": 43213 } - } - }, - { - "type": "text", - "value": " does not modify the buffer if ", - "position": { - "start": { "line": 1519, "column": 21, "offset": 43213 }, - "end": { "line": 1519, "column": 52, "offset": 43244 } - } - }, - { - "type": "inlineCode", - "value": "index", - "position": { - "start": { "line": 1519, "column": 52, "offset": 43244 }, - "end": { "line": 1519, "column": 59, "offset": 43251 } - } - }, - { - "type": "text", - "value": " is negative or\n", - "position": { - "start": { "line": 1519, "column": 59, "offset": 43251 }, - "end": { "line": 1520, "column": 1, "offset": 43267 } - } - }, - { - "type": "inlineCode", - "value": ">= buf.length", - "position": { - "start": { "line": 1520, "column": 1, "offset": 43267 }, - "end": { "line": 1520, "column": 16, "offset": 43282 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 1520, "column": 16, "offset": 43282 }, - "end": { "line": 1520, "column": 17, "offset": 43283 } - } - } - ], - "position": { - "start": { "line": 1516, "column": 1, "offset": 42963 }, - "end": { "line": 1520, "column": 17, "offset": 43283 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\n// Copy an ASCII string into a `Buffer` one byte at a time.\n// (This only works for ASCII-only strings. In general, one should use\n// `Buffer.from()` to perform this conversion.)\n\nconst str = 'Node.js';\nconst buf = Buffer.allocUnsafe(str.length);\n\nfor (let i = 0; i < str.length; i++) {\n buf[i] = str.charCodeAt(i);\n}\n\nconsole.log(buf.toString('utf8'));\n// Prints: Node.js", - "position": { - "start": { "line": 1522, "column": 1, "offset": 43285 }, - "end": { "line": 1538, "column": 4, "offset": 43708 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\n// Copy an ASCII string into a `Buffer` one byte at a time.\n// (This only works for ASCII-only strings. In general, one should use\n// `Buffer.from()` to perform this conversion.)\n\nconst str = 'Node.js';\nconst buf = Buffer.allocUnsafe(str.length);\n\nfor (let i = 0; i < str.length; i++) {\n buf[i] = str.charCodeAt(i);\n}\n\nconsole.log(buf.toString('utf8'));\n// Prints: Node.js", - "position": { - "start": { "line": 1540, "column": 1, "offset": 43710 }, - "end": { "line": 1556, "column": 4, "offset": 44138 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.buffer", - "position": { - "start": { "line": 1558, "column": 5, "offset": 44144 }, - "end": { "line": 1558, "column": 17, "offset": 44156 } - } - } - ], - "position": { - "start": { "line": 1558, "column": 1, "offset": 44140 }, - "end": { "line": 1558, "column": 17, "offset": 44156 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "{ArrayBuffer} The underlying ", - "position": { - "start": { "line": 1560, "column": 3, "offset": 44160 }, - "end": { "line": 1560, "column": 32, "offset": 44189 } - } - }, - { - "type": "inlineCode", - "value": "ArrayBuffer", - "position": { - "start": { "line": 1560, "column": 32, "offset": 44189 }, - "end": { "line": 1560, "column": 45, "offset": 44202 } - } - }, - { - "type": "text", - "value": " object based on which this ", - "position": { - "start": { "line": 1560, "column": 45, "offset": 44202 }, - "end": { "line": 1560, "column": 73, "offset": 44230 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 1560, "column": 73, "offset": 44230 }, - "end": { "line": 1560, "column": 81, "offset": 44238 } - } - }, - { - "type": "text", - "value": "\nobject is created.", - "position": { - "start": { "line": 1560, "column": 81, "offset": 44238 }, - "end": { "line": 1561, "column": 21, "offset": 44259 } - } - } - ], - "position": { - "start": { "line": 1560, "column": 3, "offset": 44160 }, - "end": { "line": 1561, "column": 21, "offset": 44259 } - } - } - ], - "position": { - "start": { "line": 1560, "column": 1, "offset": 44158 }, - "end": { "line": 1561, "column": 21, "offset": 44259 } - } - } - ], - "position": { - "start": { "line": 1560, "column": 1, "offset": 44158 }, - "end": { "line": 1561, "column": 21, "offset": 44259 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This ", - "position": { - "start": { "line": 1563, "column": 1, "offset": 44261 }, - "end": { "line": 1563, "column": 6, "offset": 44266 } - } - }, - { - "type": "inlineCode", - "value": "ArrayBuffer", - "position": { - "start": { "line": 1563, "column": 6, "offset": 44266 }, - "end": { "line": 1563, "column": 19, "offset": 44279 } - } - }, - { - "type": "text", - "value": " is not guaranteed to correspond exactly to the original\n", - "position": { - "start": { "line": 1563, "column": 19, "offset": 44279 }, - "end": { "line": 1564, "column": 1, "offset": 44336 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 1564, "column": 1, "offset": 44336 }, - "end": { "line": 1564, "column": 9, "offset": 44344 } - } - }, - { - "type": "text", - "value": ". See the notes on ", - "position": { - "start": { "line": 1564, "column": 9, "offset": 44344 }, - "end": { "line": 1564, "column": 28, "offset": 44363 } - } - }, - { - "type": "inlineCode", - "value": "buf.byteOffset", - "position": { - "start": { "line": 1564, "column": 28, "offset": 44363 }, - "end": { "line": 1564, "column": 44, "offset": 44379 } - } - }, - { - "type": "text", - "value": " for details.", - "position": { - "start": { "line": 1564, "column": 44, "offset": 44379 }, - "end": { "line": 1564, "column": 57, "offset": 44392 } - } - } - ], - "position": { - "start": { "line": 1563, "column": 1, "offset": 44261 }, - "end": { "line": 1564, "column": 57, "offset": 44392 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst arrayBuffer = new ArrayBuffer(16);\nconst buffer = Buffer.from(arrayBuffer);\n\nconsole.log(buffer.buffer === arrayBuffer);\n// Prints: true", - "position": { - "start": { "line": 1566, "column": 1, "offset": 44394 }, - "end": { "line": 1574, "column": 4, "offset": 44586 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst arrayBuffer = new ArrayBuffer(16);\nconst buffer = Buffer.from(arrayBuffer);\n\nconsole.log(buffer.buffer === arrayBuffer);\n// Prints: true", - "position": { - "start": { "line": 1576, "column": 1, "offset": 44588 }, - "end": { "line": 1584, "column": 4, "offset": 44785 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.byteOffset", - "position": { - "start": { "line": 1586, "column": 5, "offset": 44791 }, - "end": { "line": 1586, "column": 21, "offset": 44807 } - } - } - ], - "position": { - "start": { "line": 1586, "column": 1, "offset": 44787 }, - "end": { "line": 1586, "column": 21, "offset": 44807 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "{integer} The ", - "position": { - "start": { "line": 1588, "column": 3, "offset": 44811 }, - "end": { "line": 1588, "column": 17, "offset": 44825 } - } - }, - { - "type": "inlineCode", - "value": "byteOffset", - "position": { - "start": { "line": 1588, "column": 17, "offset": 44825 }, - "end": { "line": 1588, "column": 29, "offset": 44837 } - } - }, - { - "type": "text", - "value": " of the ", - "position": { - "start": { "line": 1588, "column": 29, "offset": 44837 }, - "end": { "line": 1588, "column": 37, "offset": 44845 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 1588, "column": 37, "offset": 44845 }, - "end": { "line": 1588, "column": 45, "offset": 44853 } - } - }, - { - "type": "text", - "value": "'s underlying ", - "position": { - "start": { "line": 1588, "column": 45, "offset": 44853 }, - "end": { "line": 1588, "column": 59, "offset": 44867 } - } - }, - { - "type": "inlineCode", - "value": "ArrayBuffer", - "position": { - "start": { "line": 1588, "column": 59, "offset": 44867 }, - "end": { "line": 1588, "column": 72, "offset": 44880 } - } - }, - { - "type": "text", - "value": " object.", - "position": { - "start": { "line": 1588, "column": 72, "offset": 44880 }, - "end": { "line": 1588, "column": 80, "offset": 44888 } - } - } - ], - "position": { - "start": { "line": 1588, "column": 3, "offset": 44811 }, - "end": { "line": 1588, "column": 80, "offset": 44888 } - } - } - ], - "position": { - "start": { "line": 1588, "column": 1, "offset": 44809 }, - "end": { "line": 1588, "column": 80, "offset": 44888 } - } - } - ], - "position": { - "start": { "line": 1588, "column": 1, "offset": 44809 }, - "end": { "line": 1588, "column": 80, "offset": 44888 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "When setting ", - "position": { - "start": { "line": 1590, "column": 1, "offset": 44890 }, - "end": { "line": 1590, "column": 14, "offset": 44903 } - } - }, - { - "type": "inlineCode", - "value": "byteOffset", - "position": { - "start": { "line": 1590, "column": 14, "offset": 44903 }, - "end": { "line": 1590, "column": 26, "offset": 44915 } - } - }, - { - "type": "text", - "value": " in ", - "position": { - "start": { "line": 1590, "column": 26, "offset": 44915 }, - "end": { "line": 1590, "column": 30, "offset": 44919 } - } - }, - { - "type": "inlineCode", - "value": "Buffer.from(ArrayBuffer, byteOffset, length)", - "position": { - "start": { "line": 1590, "column": 30, "offset": 44919 }, - "end": { "line": 1590, "column": 76, "offset": 44965 } - } - }, - { - "type": "text", - "value": ",\nor sometimes when allocating a ", - "position": { - "start": { "line": 1590, "column": 76, "offset": 44965 }, - "end": { "line": 1591, "column": 32, "offset": 44998 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 1591, "column": 32, "offset": 44998 }, - "end": { "line": 1591, "column": 40, "offset": 45006 } - } - }, - { - "type": "text", - "value": " smaller than ", - "position": { - "start": { "line": 1591, "column": 40, "offset": 45006 }, - "end": { "line": 1591, "column": 54, "offset": 45020 } - } - }, - { - "type": "inlineCode", - "value": "Buffer.poolSize", - "position": { - "start": { "line": 1591, "column": 54, "offset": 45020 }, - "end": { "line": 1591, "column": 71, "offset": 45037 } - } - }, - { - "type": "text", - "value": ", the\nbuffer does not start from a zero offset on the underlying ", - "position": { - "start": { "line": 1591, "column": 71, "offset": 45037 }, - "end": { "line": 1592, "column": 60, "offset": 45102 } - } - }, - { - "type": "inlineCode", - "value": "ArrayBuffer", - "position": { - "start": { "line": 1592, "column": 60, "offset": 45102 }, - "end": { "line": 1592, "column": 73, "offset": 45115 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 1592, "column": 73, "offset": 45115 }, - "end": { "line": 1592, "column": 74, "offset": 45116 } - } - } - ], - "position": { - "start": { "line": 1590, "column": 1, "offset": 44890 }, - "end": { "line": 1592, "column": 74, "offset": 45116 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This can cause problems when accessing the underlying ", - "position": { - "start": { "line": 1594, "column": 1, "offset": 45118 }, - "end": { "line": 1594, "column": 55, "offset": 45172 } - } - }, - { - "type": "inlineCode", - "value": "ArrayBuffer", - "position": { - "start": { "line": 1594, "column": 55, "offset": 45172 }, - "end": { "line": 1594, "column": 68, "offset": 45185 } - } - }, - { - "type": "text", - "value": " directly\nusing ", - "position": { - "start": { "line": 1594, "column": 68, "offset": 45185 }, - "end": { "line": 1595, "column": 7, "offset": 45201 } - } - }, - { - "type": "inlineCode", - "value": "buf.buffer", - "position": { - "start": { "line": 1595, "column": 7, "offset": 45201 }, - "end": { "line": 1595, "column": 19, "offset": 45213 } - } - }, - { - "type": "text", - "value": ", as other parts of the ", - "position": { - "start": { "line": 1595, "column": 19, "offset": 45213 }, - "end": { "line": 1595, "column": 43, "offset": 45237 } - } - }, - { - "type": "inlineCode", - "value": "ArrayBuffer", - "position": { - "start": { "line": 1595, "column": 43, "offset": 45237 }, - "end": { "line": 1595, "column": 56, "offset": 45250 } - } - }, - { - "type": "text", - "value": " may be unrelated\nto the ", - "position": { - "start": { "line": 1595, "column": 56, "offset": 45250 }, - "end": { "line": 1596, "column": 8, "offset": 45275 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 1596, "column": 8, "offset": 45275 }, - "end": { "line": 1596, "column": 16, "offset": 45283 } - } - }, - { - "type": "text", - "value": " object itself.", - "position": { - "start": { "line": 1596, "column": 16, "offset": 45283 }, - "end": { "line": 1596, "column": 31, "offset": 45298 } - } - } - ], - "position": { - "start": { "line": 1594, "column": 1, "offset": 45118 }, - "end": { "line": 1596, "column": 31, "offset": 45298 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A common issue when creating a ", - "position": { - "start": { "line": 1598, "column": 1, "offset": 45300 }, - "end": { "line": 1598, "column": 32, "offset": 45331 } - } - }, - { - "type": "inlineCode", - "value": "TypedArray", - "position": { - "start": { "line": 1598, "column": 32, "offset": 45331 }, - "end": { "line": 1598, "column": 44, "offset": 45343 } - } - }, - { - "type": "text", - "value": " object that shares its memory with\na ", - "position": { - "start": { "line": 1598, "column": 44, "offset": 45343 }, - "end": { "line": 1599, "column": 3, "offset": 45381 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 1599, "column": 3, "offset": 45381 }, - "end": { "line": 1599, "column": 11, "offset": 45389 } - } - }, - { - "type": "text", - "value": " is that in this case one needs to specify the ", - "position": { - "start": { "line": 1599, "column": 11, "offset": 45389 }, - "end": { "line": 1599, "column": 58, "offset": 45436 } - } - }, - { - "type": "inlineCode", - "value": "byteOffset", - "position": { - "start": { "line": 1599, "column": 58, "offset": 45436 }, - "end": { "line": 1599, "column": 70, "offset": 45448 } - } - }, - { - "type": "text", - "value": " correctly:", - "position": { - "start": { "line": 1599, "column": 70, "offset": 45448 }, - "end": { "line": 1599, "column": 81, "offset": 45459 } - } - } - ], - "position": { - "start": { "line": 1598, "column": 1, "offset": 45300 }, - "end": { "line": 1599, "column": 81, "offset": 45459 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\n// Create a buffer smaller than `Buffer.poolSize`.\nconst nodeBuffer = Buffer.from([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);\n\n// When casting the Node.js Buffer to an Int8Array, use the byteOffset\n// to refer only to the part of `nodeBuffer.buffer` that contains the memory\n// for `nodeBuffer`.\nnew Int8Array(nodeBuffer.buffer, nodeBuffer.byteOffset, nodeBuffer.length);", - "position": { - "start": { "line": 1601, "column": 1, "offset": 45461 }, - "end": { "line": 1611, "column": 4, "offset": 45871 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\n// Create a buffer smaller than `Buffer.poolSize`.\nconst nodeBuffer = Buffer.from([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);\n\n// When casting the Node.js Buffer to an Int8Array, use the byteOffset\n// to refer only to the part of `nodeBuffer.buffer` that contains the memory\n// for `nodeBuffer`.\nnew Int8Array(nodeBuffer.buffer, nodeBuffer.byteOffset, nodeBuffer.length);", - "position": { - "start": { "line": 1613, "column": 1, "offset": 45873 }, - "end": { "line": 1623, "column": 4, "offset": 46288 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.compare(target[, targetStart[, targetEnd[, sourceStart[, sourceEnd]]]])", - "position": { - "start": { "line": 1625, "column": 5, "offset": 46294 }, - "end": { "line": 1625, "column": 82, "offset": 46371 } - } - } - ], - "position": { - "start": { "line": 1625, "column": 1, "offset": 46290 }, - "end": { "line": 1625, "column": 82, "offset": 46371 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 1627, "column": 1, "offset": 46373 }, - "end": { "line": 1636, "column": 4, "offset": 46707 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "target", - "position": { - "start": { "line": 1638, "column": 3, "offset": 46711 }, - "end": { "line": 1638, "column": 11, "offset": 46719 } - } - }, - { - "type": "text", - "value": " {Buffer|Uint8Array} A ", - "position": { - "start": { "line": 1638, "column": 11, "offset": 46719 }, - "end": { "line": 1638, "column": 34, "offset": 46742 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 1638, "column": 34, "offset": 46742 }, - "end": { "line": 1638, "column": 42, "offset": 46750 } - } - }, - { - "type": "text", - "value": " or {Uint8Array} with which to\ncompare ", - "position": { - "start": { "line": 1638, "column": 42, "offset": 46750 }, - "end": { "line": 1639, "column": 11, "offset": 46791 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 1639, "column": 11, "offset": 46791 }, - "end": { "line": 1639, "column": 16, "offset": 46796 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 1639, "column": 16, "offset": 46796 }, - "end": { "line": 1639, "column": 17, "offset": 46797 } - } - } - ], - "position": { - "start": { "line": 1638, "column": 3, "offset": 46711 }, - "end": { "line": 1639, "column": 17, "offset": 46797 } - } - } - ], - "position": { - "start": { "line": 1638, "column": 1, "offset": 46709 }, - "end": { "line": 1639, "column": 17, "offset": 46797 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "targetStart", - "position": { - "start": { "line": 1640, "column": 3, "offset": 46800 }, - "end": { "line": 1640, "column": 16, "offset": 46813 } - } - }, - { - "type": "text", - "value": " {integer} The offset within ", - "position": { - "start": { "line": 1640, "column": 16, "offset": 46813 }, - "end": { "line": 1640, "column": 45, "offset": 46842 } - } - }, - { - "type": "inlineCode", - "value": "target", - "position": { - "start": { "line": 1640, "column": 45, "offset": 46842 }, - "end": { "line": 1640, "column": 53, "offset": 46850 } - } - }, - { - "type": "text", - "value": " at which to begin\ncomparison. ", - "position": { - "start": { "line": 1640, "column": 53, "offset": 46850 }, - "end": { "line": 1641, "column": 15, "offset": 46883 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { - "line": 1641, - "column": 17, - "offset": 46885 - }, - "end": { "line": 1641, "column": 25, "offset": 46893 } - } - } - ], - "position": { - "start": { "line": 1641, "column": 15, "offset": 46883 }, - "end": { "line": 1641, "column": 27, "offset": 46895 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 1641, "column": 27, "offset": 46895 }, - "end": { "line": 1641, "column": 28, "offset": 46896 } - } - }, - { - "type": "inlineCode", - "value": "0", - "position": { - "start": { "line": 1641, "column": 28, "offset": 46896 }, - "end": { "line": 1641, "column": 31, "offset": 46899 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 1641, "column": 31, "offset": 46899 }, - "end": { "line": 1641, "column": 32, "offset": 46900 } - } - } - ], - "position": { - "start": { "line": 1640, "column": 3, "offset": 46800 }, - "end": { "line": 1641, "column": 32, "offset": 46900 } - } - } - ], - "position": { - "start": { "line": 1640, "column": 1, "offset": 46798 }, - "end": { "line": 1641, "column": 32, "offset": 46900 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "targetEnd", - "position": { - "start": { "line": 1642, "column": 3, "offset": 46903 }, - "end": { "line": 1642, "column": 14, "offset": 46914 } - } - }, - { - "type": "text", - "value": " {integer} The offset within ", - "position": { - "start": { "line": 1642, "column": 14, "offset": 46914 }, - "end": { "line": 1642, "column": 43, "offset": 46943 } - } - }, - { - "type": "inlineCode", - "value": "target", - "position": { - "start": { "line": 1642, "column": 43, "offset": 46943 }, - "end": { "line": 1642, "column": 51, "offset": 46951 } - } - }, - { - "type": "text", - "value": " at which to end comparison\n(not inclusive). ", - "position": { - "start": { "line": 1642, "column": 51, "offset": 46951 }, - "end": { "line": 1643, "column": 20, "offset": 46998 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { - "line": 1643, - "column": 22, - "offset": 47000 - }, - "end": { "line": 1643, "column": 30, "offset": 47008 } - } - } - ], - "position": { - "start": { "line": 1643, "column": 20, "offset": 46998 }, - "end": { "line": 1643, "column": 32, "offset": 47010 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 1643, "column": 32, "offset": 47010 }, - "end": { "line": 1643, "column": 33, "offset": 47011 } - } - }, - { - "type": "inlineCode", - "value": "target.length", - "position": { - "start": { "line": 1643, "column": 33, "offset": 47011 }, - "end": { "line": 1643, "column": 48, "offset": 47026 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 1643, "column": 48, "offset": 47026 }, - "end": { "line": 1643, "column": 49, "offset": 47027 } - } - } - ], - "position": { - "start": { "line": 1642, "column": 3, "offset": 46903 }, - "end": { "line": 1643, "column": 49, "offset": 47027 } - } - } - ], - "position": { - "start": { "line": 1642, "column": 1, "offset": 46901 }, - "end": { "line": 1643, "column": 49, "offset": 47027 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "sourceStart", - "position": { - "start": { "line": 1644, "column": 3, "offset": 47030 }, - "end": { "line": 1644, "column": 16, "offset": 47043 } - } - }, - { - "type": "text", - "value": " {integer} The offset within ", - "position": { - "start": { "line": 1644, "column": 16, "offset": 47043 }, - "end": { "line": 1644, "column": 45, "offset": 47072 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 1644, "column": 45, "offset": 47072 }, - "end": { "line": 1644, "column": 50, "offset": 47077 } - } - }, - { - "type": "text", - "value": " at which to begin comparison.\n", - "position": { - "start": { "line": 1644, "column": 50, "offset": 47077 }, - "end": { "line": 1645, "column": 1, "offset": 47108 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { "line": 1645, "column": 5, "offset": 47112 }, - "end": { "line": 1645, "column": 13, "offset": 47120 } - } - } - ], - "position": { - "start": { "line": 1645, "column": 3, "offset": 47110 }, - "end": { "line": 1645, "column": 15, "offset": 47122 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 1645, "column": 15, "offset": 47122 }, - "end": { "line": 1645, "column": 16, "offset": 47123 } - } - }, - { - "type": "inlineCode", - "value": "0", - "position": { - "start": { "line": 1645, "column": 16, "offset": 47123 }, - "end": { "line": 1645, "column": 19, "offset": 47126 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 1645, "column": 19, "offset": 47126 }, - "end": { "line": 1645, "column": 20, "offset": 47127 } - } - } - ], - "position": { - "start": { "line": 1644, "column": 3, "offset": 47030 }, - "end": { "line": 1645, "column": 20, "offset": 47127 } - } - } - ], - "position": { - "start": { "line": 1644, "column": 1, "offset": 47028 }, - "end": { "line": 1645, "column": 20, "offset": 47127 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "sourceEnd", - "position": { - "start": { "line": 1646, "column": 3, "offset": 47130 }, - "end": { "line": 1646, "column": 14, "offset": 47141 } - } - }, - { - "type": "text", - "value": " {integer} The offset within ", - "position": { - "start": { "line": 1646, "column": 14, "offset": 47141 }, - "end": { "line": 1646, "column": 43, "offset": 47170 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 1646, "column": 43, "offset": 47170 }, - "end": { "line": 1646, "column": 48, "offset": 47175 } - } - }, - { - "type": "text", - "value": " at which to end comparison\n(not inclusive). ", - "position": { - "start": { "line": 1646, "column": 48, "offset": 47175 }, - "end": { "line": 1647, "column": 20, "offset": 47222 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { - "line": 1647, - "column": 22, - "offset": 47224 - }, - "end": { "line": 1647, "column": 30, "offset": 47232 } - } - } - ], - "position": { - "start": { "line": 1647, "column": 20, "offset": 47222 }, - "end": { "line": 1647, "column": 32, "offset": 47234 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 1647, "column": 32, "offset": 47234 }, - "end": { "line": 1647, "column": 33, "offset": 47235 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "buf.length", - "position": { - "start": { - "line": 1647, - "column": 34, - "offset": 47236 - }, - "end": { "line": 1647, "column": 46, "offset": 47248 } - } - } - ], - "position": { - "start": { "line": 1647, "column": 33, "offset": 47235 }, - "end": { "line": 1647, "column": 49, "offset": 47251 } - }, - "label": "`buf.length`", - "identifier": "`buf.length`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 1647, "column": 49, "offset": 47251 }, - "end": { "line": 1647, "column": 50, "offset": 47252 } - } - } - ], - "position": { - "start": { "line": 1646, "column": 3, "offset": 47130 }, - "end": { "line": 1647, "column": 50, "offset": 47252 } - } - } - ], - "position": { - "start": { "line": 1646, "column": 1, "offset": 47128 }, - "end": { "line": 1647, "column": 50, "offset": 47252 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {integer}", - "position": { - "start": { "line": 1648, "column": 3, "offset": 47255 }, - "end": { "line": 1648, "column": 21, "offset": 47273 } - } - } - ], - "position": { - "start": { "line": 1648, "column": 3, "offset": 47255 }, - "end": { "line": 1648, "column": 21, "offset": 47273 } - } - } - ], - "position": { - "start": { "line": 1648, "column": 1, "offset": 47253 }, - "end": { "line": 1648, "column": 21, "offset": 47273 } - } - } - ], - "position": { - "start": { "line": 1638, "column": 1, "offset": 46709 }, - "end": { "line": 1648, "column": 21, "offset": 47273 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Compares ", - "position": { - "start": { "line": 1650, "column": 1, "offset": 47275 }, - "end": { "line": 1650, "column": 10, "offset": 47284 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 1650, "column": 10, "offset": 47284 }, - "end": { "line": 1650, "column": 15, "offset": 47289 } - } - }, - { - "type": "text", - "value": " with ", - "position": { - "start": { "line": 1650, "column": 15, "offset": 47289 }, - "end": { "line": 1650, "column": 21, "offset": 47295 } - } - }, - { - "type": "inlineCode", - "value": "target", - "position": { - "start": { "line": 1650, "column": 21, "offset": 47295 }, - "end": { "line": 1650, "column": 29, "offset": 47303 } - } - }, - { - "type": "text", - "value": " and returns a number indicating whether ", - "position": { - "start": { "line": 1650, "column": 29, "offset": 47303 }, - "end": { "line": 1650, "column": 70, "offset": 47344 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 1650, "column": 70, "offset": 47344 }, - "end": { "line": 1650, "column": 75, "offset": 47349 } - } - }, - { - "type": "text", - "value": "\ncomes before, after, or is the same as ", - "position": { - "start": { "line": 1650, "column": 75, "offset": 47349 }, - "end": { "line": 1651, "column": 40, "offset": 47389 } - } - }, - { - "type": "inlineCode", - "value": "target", - "position": { - "start": { "line": 1651, "column": 40, "offset": 47389 }, - "end": { "line": 1651, "column": 48, "offset": 47397 } - } - }, - { - "type": "text", - "value": " in sort order.\nComparison is based on the actual sequence of bytes in each ", - "position": { - "start": { "line": 1651, "column": 48, "offset": 47397 }, - "end": { "line": 1652, "column": 61, "offset": 47473 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 1652, "column": 61, "offset": 47473 }, - "end": { "line": 1652, "column": 69, "offset": 47481 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 1652, "column": 69, "offset": 47481 }, - "end": { "line": 1652, "column": 70, "offset": 47482 } - } - } - ], - "position": { - "start": { "line": 1650, "column": 1, "offset": 47275 }, - "end": { "line": 1652, "column": 70, "offset": 47482 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "0", - "position": { - "start": { "line": 1654, "column": 3, "offset": 47486 }, - "end": { "line": 1654, "column": 6, "offset": 47489 } - } - }, - { - "type": "text", - "value": " is returned if ", - "position": { - "start": { "line": 1654, "column": 6, "offset": 47489 }, - "end": { "line": 1654, "column": 22, "offset": 47505 } - } - }, - { - "type": "inlineCode", - "value": "target", - "position": { - "start": { "line": 1654, "column": 22, "offset": 47505 }, - "end": { "line": 1654, "column": 30, "offset": 47513 } - } - }, - { - "type": "text", - "value": " is the same as ", - "position": { - "start": { "line": 1654, "column": 30, "offset": 47513 }, - "end": { "line": 1654, "column": 46, "offset": 47529 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 1654, "column": 46, "offset": 47529 }, - "end": { "line": 1654, "column": 51, "offset": 47534 } - } - } - ], - "position": { - "start": { "line": 1654, "column": 3, "offset": 47486 }, - "end": { "line": 1654, "column": 51, "offset": 47534 } - } - } - ], - "position": { - "start": { "line": 1654, "column": 1, "offset": 47484 }, - "end": { "line": 1654, "column": 51, "offset": 47534 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "1", - "position": { - "start": { "line": 1655, "column": 3, "offset": 47537 }, - "end": { "line": 1655, "column": 6, "offset": 47540 } - } - }, - { - "type": "text", - "value": " is returned if ", - "position": { - "start": { "line": 1655, "column": 6, "offset": 47540 }, - "end": { "line": 1655, "column": 22, "offset": 47556 } - } - }, - { - "type": "inlineCode", - "value": "target", - "position": { - "start": { "line": 1655, "column": 22, "offset": 47556 }, - "end": { "line": 1655, "column": 30, "offset": 47564 } - } - }, - { - "type": "text", - "value": " should come ", - "position": { - "start": { "line": 1655, "column": 30, "offset": 47564 }, - "end": { "line": 1655, "column": 43, "offset": 47577 } - } - }, - { - "type": "emphasis", - "children": [ - { - "type": "text", - "value": "before", - "position": { - "start": { - "line": 1655, - "column": 44, - "offset": 47578 - }, - "end": { "line": 1655, "column": 50, "offset": 47584 } - } - } - ], - "position": { - "start": { "line": 1655, "column": 43, "offset": 47577 }, - "end": { "line": 1655, "column": 51, "offset": 47585 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 1655, "column": 51, "offset": 47585 }, - "end": { "line": 1655, "column": 52, "offset": 47586 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 1655, "column": 52, "offset": 47586 }, - "end": { "line": 1655, "column": 57, "offset": 47591 } - } - }, - { - "type": "text", - "value": " when sorted.", - "position": { - "start": { "line": 1655, "column": 57, "offset": 47591 }, - "end": { "line": 1655, "column": 70, "offset": 47604 } - } - } - ], - "position": { - "start": { "line": 1655, "column": 3, "offset": 47537 }, - "end": { "line": 1655, "column": 70, "offset": 47604 } - } - } - ], - "position": { - "start": { "line": 1655, "column": 1, "offset": 47535 }, - "end": { "line": 1655, "column": 70, "offset": 47604 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "-1", - "position": { - "start": { "line": 1656, "column": 3, "offset": 47607 }, - "end": { "line": 1656, "column": 7, "offset": 47611 } - } - }, - { - "type": "text", - "value": " is returned if ", - "position": { - "start": { "line": 1656, "column": 7, "offset": 47611 }, - "end": { "line": 1656, "column": 23, "offset": 47627 } - } - }, - { - "type": "inlineCode", - "value": "target", - "position": { - "start": { "line": 1656, "column": 23, "offset": 47627 }, - "end": { "line": 1656, "column": 31, "offset": 47635 } - } - }, - { - "type": "text", - "value": " should come ", - "position": { - "start": { "line": 1656, "column": 31, "offset": 47635 }, - "end": { "line": 1656, "column": 44, "offset": 47648 } - } - }, - { - "type": "emphasis", - "children": [ - { - "type": "text", - "value": "after", - "position": { - "start": { - "line": 1656, - "column": 45, - "offset": 47649 - }, - "end": { "line": 1656, "column": 50, "offset": 47654 } - } - } - ], - "position": { - "start": { "line": 1656, "column": 44, "offset": 47648 }, - "end": { "line": 1656, "column": 51, "offset": 47655 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 1656, "column": 51, "offset": 47655 }, - "end": { "line": 1656, "column": 52, "offset": 47656 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 1656, "column": 52, "offset": 47656 }, - "end": { "line": 1656, "column": 57, "offset": 47661 } - } - }, - { - "type": "text", - "value": " when sorted.", - "position": { - "start": { "line": 1656, "column": 57, "offset": 47661 }, - "end": { "line": 1656, "column": 70, "offset": 47674 } - } - } - ], - "position": { - "start": { "line": 1656, "column": 3, "offset": 47607 }, - "end": { "line": 1656, "column": 70, "offset": 47674 } - } - } - ], - "position": { - "start": { "line": 1656, "column": 1, "offset": 47605 }, - "end": { "line": 1656, "column": 70, "offset": 47674 } - } - } - ], - "position": { - "start": { "line": 1654, "column": 1, "offset": 47484 }, - "end": { "line": 1656, "column": 70, "offset": 47674 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf1 = Buffer.from('ABC');\nconst buf2 = Buffer.from('BCD');\nconst buf3 = Buffer.from('ABCD');\n\nconsole.log(buf1.compare(buf1));\n// Prints: 0\nconsole.log(buf1.compare(buf2));\n// Prints: -1\nconsole.log(buf1.compare(buf3));\n// Prints: -1\nconsole.log(buf2.compare(buf1));\n// Prints: 1\nconsole.log(buf2.compare(buf3));\n// Prints: 1\nconsole.log([buf1, buf2, buf3].sort(Buffer.compare));\n// Prints: [ , , ]\n// (This result is equal to: [buf1, buf3, buf2].)", - "position": { - "start": { "line": 1658, "column": 1, "offset": 47676 }, - "end": { "line": 1678, "column": 4, "offset": 48236 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf1 = Buffer.from('ABC');\nconst buf2 = Buffer.from('BCD');\nconst buf3 = Buffer.from('ABCD');\n\nconsole.log(buf1.compare(buf1));\n// Prints: 0\nconsole.log(buf1.compare(buf2));\n// Prints: -1\nconsole.log(buf1.compare(buf3));\n// Prints: -1\nconsole.log(buf2.compare(buf1));\n// Prints: 1\nconsole.log(buf2.compare(buf3));\n// Prints: 1\nconsole.log([buf1, buf2, buf3].sort(Buffer.compare));\n// Prints: [ , , ]\n// (This result is equal to: [buf1, buf3, buf2].)", - "position": { - "start": { "line": 1680, "column": 1, "offset": 48238 }, - "end": { "line": 1700, "column": 4, "offset": 48803 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The optional ", - "position": { - "start": { "line": 1702, "column": 1, "offset": 48805 }, - "end": { "line": 1702, "column": 14, "offset": 48818 } - } - }, - { - "type": "inlineCode", - "value": "targetStart", - "position": { - "start": { "line": 1702, "column": 14, "offset": 48818 }, - "end": { "line": 1702, "column": 27, "offset": 48831 } - } - }, - { - "type": "text", - "value": ", ", - "position": { - "start": { "line": 1702, "column": 27, "offset": 48831 }, - "end": { "line": 1702, "column": 29, "offset": 48833 } - } - }, - { - "type": "inlineCode", - "value": "targetEnd", - "position": { - "start": { "line": 1702, "column": 29, "offset": 48833 }, - "end": { "line": 1702, "column": 40, "offset": 48844 } - } - }, - { - "type": "text", - "value": ", ", - "position": { - "start": { "line": 1702, "column": 40, "offset": 48844 }, - "end": { "line": 1702, "column": 42, "offset": 48846 } - } - }, - { - "type": "inlineCode", - "value": "sourceStart", - "position": { - "start": { "line": 1702, "column": 42, "offset": 48846 }, - "end": { "line": 1702, "column": 55, "offset": 48859 } - } - }, - { - "type": "text", - "value": ", and ", - "position": { - "start": { "line": 1702, "column": 55, "offset": 48859 }, - "end": { "line": 1702, "column": 61, "offset": 48865 } - } - }, - { - "type": "inlineCode", - "value": "sourceEnd", - "position": { - "start": { "line": 1702, "column": 61, "offset": 48865 }, - "end": { "line": 1702, "column": 72, "offset": 48876 } - } - }, - { - "type": "text", - "value": "\narguments can be used to limit the comparison to specific ranges within ", - "position": { - "start": { "line": 1702, "column": 72, "offset": 48876 }, - "end": { "line": 1703, "column": 73, "offset": 48949 } - } - }, - { - "type": "inlineCode", - "value": "target", - "position": { - "start": { "line": 1703, "column": 73, "offset": 48949 }, - "end": { "line": 1703, "column": 81, "offset": 48957 } - } - }, - { - "type": "text", - "value": "\nand ", - "position": { - "start": { "line": 1703, "column": 81, "offset": 48957 }, - "end": { "line": 1704, "column": 5, "offset": 48962 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 1704, "column": 5, "offset": 48962 }, - "end": { "line": 1704, "column": 10, "offset": 48967 } - } - }, - { - "type": "text", - "value": " respectively.", - "position": { - "start": { "line": 1704, "column": 10, "offset": 48967 }, - "end": { "line": 1704, "column": 24, "offset": 48981 } - } - } - ], - "position": { - "start": { "line": 1702, "column": 1, "offset": 48805 }, - "end": { "line": 1704, "column": 24, "offset": 48981 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf1 = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8, 9]);\nconst buf2 = Buffer.from([5, 6, 7, 8, 9, 1, 2, 3, 4]);\n\nconsole.log(buf1.compare(buf2, 5, 9, 0, 4));\n// Prints: 0\nconsole.log(buf1.compare(buf2, 0, 6, 4));\n// Prints: -1\nconsole.log(buf1.compare(buf2, 5, 6, 5));\n// Prints: 1", - "position": { - "start": { "line": 1706, "column": 1, "offset": 48983 }, - "end": { "line": 1718, "column": 4, "offset": 49312 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf1 = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8, 9]);\nconst buf2 = Buffer.from([5, 6, 7, 8, 9, 1, 2, 3, 4]);\n\nconsole.log(buf1.compare(buf2, 5, 9, 0, 4));\n// Prints: 0\nconsole.log(buf1.compare(buf2, 0, 6, 4));\n// Prints: -1\nconsole.log(buf1.compare(buf2, 5, 6, 5));\n// Prints: 1", - "position": { - "start": { "line": 1720, "column": 1, "offset": 49314 }, - "end": { "line": 1732, "column": 4, "offset": 49648 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "ERR_OUT_OF_RANGE", - "position": { - "start": { "line": 1734, "column": 2, "offset": 49651 }, - "end": { "line": 1734, "column": 20, "offset": 49669 } - } - } - ], - "position": { - "start": { "line": 1734, "column": 1, "offset": 49650 }, - "end": { "line": 1734, "column": 23, "offset": 49672 } - }, - "label": "`ERR_OUT_OF_RANGE`", - "identifier": "`err_out_of_range`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": " is thrown if ", - "position": { - "start": { "line": 1734, "column": 23, "offset": 49672 }, - "end": { "line": 1734, "column": 37, "offset": 49686 } - } - }, - { - "type": "inlineCode", - "value": "targetStart < 0", - "position": { - "start": { "line": 1734, "column": 37, "offset": 49686 }, - "end": { "line": 1734, "column": 54, "offset": 49703 } - } - }, - { - "type": "text", - "value": ", ", - "position": { - "start": { "line": 1734, "column": 54, "offset": 49703 }, - "end": { "line": 1734, "column": 56, "offset": 49705 } - } - }, - { - "type": "inlineCode", - "value": "sourceStart < 0", - "position": { - "start": { "line": 1734, "column": 56, "offset": 49705 }, - "end": { "line": 1734, "column": 73, "offset": 49722 } - } - }, - { - "type": "text", - "value": ",\n", - "position": { - "start": { "line": 1734, "column": 73, "offset": 49722 }, - "end": { "line": 1735, "column": 1, "offset": 49724 } - } - }, - { - "type": "inlineCode", - "value": "targetEnd > target.byteLength", - "position": { - "start": { "line": 1735, "column": 1, "offset": 49724 }, - "end": { "line": 1735, "column": 32, "offset": 49755 } - } - }, - { - "type": "text", - "value": ", or ", - "position": { - "start": { "line": 1735, "column": 32, "offset": 49755 }, - "end": { "line": 1735, "column": 37, "offset": 49760 } - } - }, - { - "type": "inlineCode", - "value": "sourceEnd > source.byteLength", - "position": { - "start": { "line": 1735, "column": 37, "offset": 49760 }, - "end": { "line": 1735, "column": 68, "offset": 49791 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 1735, "column": 68, "offset": 49791 }, - "end": { "line": 1735, "column": 69, "offset": 49792 } - } - } - ], - "position": { - "start": { "line": 1734, "column": 1, "offset": 49650 }, - "end": { "line": 1735, "column": 69, "offset": 49792 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.copy(target[, targetStart[, sourceStart[, sourceEnd]]])", - "position": { - "start": { "line": 1737, "column": 5, "offset": 49798 }, - "end": { "line": 1737, "column": 66, "offset": 49859 } - } - } - ], - "position": { - "start": { "line": 1737, "column": 1, "offset": 49794 }, - "end": { "line": 1737, "column": 66, "offset": 49859 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 1739, "column": 1, "offset": 49861 }, - "end": { "line": 1741, "column": 4, "offset": 49889 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "target", - "position": { - "start": { "line": 1743, "column": 3, "offset": 49893 }, - "end": { "line": 1743, "column": 11, "offset": 49901 } - } - }, - { - "type": "text", - "value": " {Buffer|Uint8Array} A ", - "position": { - "start": { "line": 1743, "column": 11, "offset": 49901 }, - "end": { "line": 1743, "column": 34, "offset": 49924 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 1743, "column": 34, "offset": 49924 }, - "end": { "line": 1743, "column": 42, "offset": 49932 } - } - }, - { - "type": "text", - "value": " or {Uint8Array} to copy into.", - "position": { - "start": { "line": 1743, "column": 42, "offset": 49932 }, - "end": { "line": 1743, "column": 72, "offset": 49962 } - } - } - ], - "position": { - "start": { "line": 1743, "column": 3, "offset": 49893 }, - "end": { "line": 1743, "column": 72, "offset": 49962 } - } - } - ], - "position": { - "start": { "line": 1743, "column": 1, "offset": 49891 }, - "end": { "line": 1743, "column": 72, "offset": 49962 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "targetStart", - "position": { - "start": { "line": 1744, "column": 3, "offset": 49965 }, - "end": { "line": 1744, "column": 16, "offset": 49978 } - } - }, - { - "type": "text", - "value": " {integer} The offset within ", - "position": { - "start": { "line": 1744, "column": 16, "offset": 49978 }, - "end": { "line": 1744, "column": 45, "offset": 50007 } - } - }, - { - "type": "inlineCode", - "value": "target", - "position": { - "start": { "line": 1744, "column": 45, "offset": 50007 }, - "end": { "line": 1744, "column": 53, "offset": 50015 } - } - }, - { - "type": "text", - "value": " at which to begin\nwriting. ", - "position": { - "start": { "line": 1744, "column": 53, "offset": 50015 }, - "end": { "line": 1745, "column": 12, "offset": 50045 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { - "line": 1745, - "column": 14, - "offset": 50047 - }, - "end": { "line": 1745, "column": 22, "offset": 50055 } - } - } - ], - "position": { - "start": { "line": 1745, "column": 12, "offset": 50045 }, - "end": { "line": 1745, "column": 24, "offset": 50057 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 1745, "column": 24, "offset": 50057 }, - "end": { "line": 1745, "column": 25, "offset": 50058 } - } - }, - { - "type": "inlineCode", - "value": "0", - "position": { - "start": { "line": 1745, "column": 25, "offset": 50058 }, - "end": { "line": 1745, "column": 28, "offset": 50061 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 1745, "column": 28, "offset": 50061 }, - "end": { "line": 1745, "column": 29, "offset": 50062 } - } - } - ], - "position": { - "start": { "line": 1744, "column": 3, "offset": 49965 }, - "end": { "line": 1745, "column": 29, "offset": 50062 } - } - } - ], - "position": { - "start": { "line": 1744, "column": 1, "offset": 49963 }, - "end": { "line": 1745, "column": 29, "offset": 50062 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "sourceStart", - "position": { - "start": { "line": 1746, "column": 3, "offset": 50065 }, - "end": { "line": 1746, "column": 16, "offset": 50078 } - } - }, - { - "type": "text", - "value": " {integer} The offset within ", - "position": { - "start": { "line": 1746, "column": 16, "offset": 50078 }, - "end": { "line": 1746, "column": 45, "offset": 50107 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 1746, "column": 45, "offset": 50107 }, - "end": { "line": 1746, "column": 50, "offset": 50112 } - } - }, - { - "type": "text", - "value": " from which to begin copying.\n", - "position": { - "start": { "line": 1746, "column": 50, "offset": 50112 }, - "end": { "line": 1747, "column": 1, "offset": 50142 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { "line": 1747, "column": 5, "offset": 50146 }, - "end": { "line": 1747, "column": 13, "offset": 50154 } - } - } - ], - "position": { - "start": { "line": 1747, "column": 3, "offset": 50144 }, - "end": { "line": 1747, "column": 15, "offset": 50156 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 1747, "column": 15, "offset": 50156 }, - "end": { "line": 1747, "column": 16, "offset": 50157 } - } - }, - { - "type": "inlineCode", - "value": "0", - "position": { - "start": { "line": 1747, "column": 16, "offset": 50157 }, - "end": { "line": 1747, "column": 19, "offset": 50160 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 1747, "column": 19, "offset": 50160 }, - "end": { "line": 1747, "column": 20, "offset": 50161 } - } - } - ], - "position": { - "start": { "line": 1746, "column": 3, "offset": 50065 }, - "end": { "line": 1747, "column": 20, "offset": 50161 } - } - } - ], - "position": { - "start": { "line": 1746, "column": 1, "offset": 50063 }, - "end": { "line": 1747, "column": 20, "offset": 50161 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "sourceEnd", - "position": { - "start": { "line": 1748, "column": 3, "offset": 50164 }, - "end": { "line": 1748, "column": 14, "offset": 50175 } - } - }, - { - "type": "text", - "value": " {integer} The offset within ", - "position": { - "start": { "line": 1748, "column": 14, "offset": 50175 }, - "end": { "line": 1748, "column": 43, "offset": 50204 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 1748, "column": 43, "offset": 50204 }, - "end": { "line": 1748, "column": 48, "offset": 50209 } - } - }, - { - "type": "text", - "value": " at which to stop copying (not\ninclusive). ", - "position": { - "start": { "line": 1748, "column": 48, "offset": 50209 }, - "end": { "line": 1749, "column": 15, "offset": 50254 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { - "line": 1749, - "column": 17, - "offset": 50256 - }, - "end": { "line": 1749, "column": 25, "offset": 50264 } - } - } - ], - "position": { - "start": { "line": 1749, "column": 15, "offset": 50254 }, - "end": { "line": 1749, "column": 27, "offset": 50266 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 1749, "column": 27, "offset": 50266 }, - "end": { "line": 1749, "column": 28, "offset": 50267 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "buf.length", - "position": { - "start": { - "line": 1749, - "column": 29, - "offset": 50268 - }, - "end": { "line": 1749, "column": 41, "offset": 50280 } - } - } - ], - "position": { - "start": { "line": 1749, "column": 28, "offset": 50267 }, - "end": { "line": 1749, "column": 44, "offset": 50283 } - }, - "label": "`buf.length`", - "identifier": "`buf.length`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 1749, "column": 44, "offset": 50283 }, - "end": { "line": 1749, "column": 45, "offset": 50284 } - } - } - ], - "position": { - "start": { "line": 1748, "column": 3, "offset": 50164 }, - "end": { "line": 1749, "column": 45, "offset": 50284 } - } - } - ], - "position": { - "start": { "line": 1748, "column": 1, "offset": 50162 }, - "end": { "line": 1749, "column": 45, "offset": 50284 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {integer} The number of bytes copied.", - "position": { - "start": { "line": 1750, "column": 3, "offset": 50287 }, - "end": { "line": 1750, "column": 49, "offset": 50333 } - } - } - ], - "position": { - "start": { "line": 1750, "column": 3, "offset": 50287 }, - "end": { "line": 1750, "column": 49, "offset": 50333 } - } - } - ], - "position": { - "start": { "line": 1750, "column": 1, "offset": 50285 }, - "end": { "line": 1750, "column": 49, "offset": 50333 } - } - } - ], - "position": { - "start": { "line": 1743, "column": 1, "offset": 49891 }, - "end": { "line": 1750, "column": 49, "offset": 50333 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Copies data from a region of ", - "position": { - "start": { "line": 1752, "column": 1, "offset": 50335 }, - "end": { "line": 1752, "column": 30, "offset": 50364 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 1752, "column": 30, "offset": 50364 }, - "end": { "line": 1752, "column": 35, "offset": 50369 } - } - }, - { - "type": "text", - "value": " to a region in ", - "position": { - "start": { "line": 1752, "column": 35, "offset": 50369 }, - "end": { "line": 1752, "column": 51, "offset": 50385 } - } - }, - { - "type": "inlineCode", - "value": "target", - "position": { - "start": { "line": 1752, "column": 51, "offset": 50385 }, - "end": { "line": 1752, "column": 59, "offset": 50393 } - } - }, - { - "type": "text", - "value": ", even if the ", - "position": { - "start": { "line": 1752, "column": 59, "offset": 50393 }, - "end": { "line": 1752, "column": 73, "offset": 50407 } - } - }, - { - "type": "inlineCode", - "value": "target", - "position": { - "start": { "line": 1752, "column": 73, "offset": 50407 }, - "end": { "line": 1752, "column": 81, "offset": 50415 } - } - }, - { - "type": "text", - "value": "\nmemory region overlaps with ", - "position": { - "start": { "line": 1752, "column": 81, "offset": 50415 }, - "end": { "line": 1753, "column": 29, "offset": 50444 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 1753, "column": 29, "offset": 50444 }, - "end": { "line": 1753, "column": 34, "offset": 50449 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 1753, "column": 34, "offset": 50449 }, - "end": { "line": 1753, "column": 35, "offset": 50450 } - } - } - ], - "position": { - "start": { "line": 1752, "column": 1, "offset": 50335 }, - "end": { "line": 1753, "column": 35, "offset": 50450 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "TypedArray.prototype.set()", - "position": { - "start": { "line": 1755, "column": 2, "offset": 50453 }, - "end": { "line": 1755, "column": 30, "offset": 50481 } - } - } - ], - "position": { - "start": { "line": 1755, "column": 1, "offset": 50452 }, - "end": { "line": 1755, "column": 33, "offset": 50484 } - }, - "label": "`TypedArray.prototype.set()`", - "identifier": "`typedarray.prototype.set()`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": " performs the same operation, and is available\nfor all TypedArrays, including Node.js ", - "position": { - "start": { "line": 1755, "column": 33, "offset": 50484 }, - "end": { "line": 1756, "column": 40, "offset": 50570 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 1756, "column": 40, "offset": 50570 }, - "end": { "line": 1756, "column": 48, "offset": 50578 } - } - }, - { - "type": "text", - "value": "s, although it takes\ndifferent function arguments.", - "position": { - "start": { "line": 1756, "column": 48, "offset": 50578 }, - "end": { "line": 1757, "column": 30, "offset": 50628 } - } - } - ], - "position": { - "start": { "line": 1755, "column": 1, "offset": 50452 }, - "end": { "line": 1757, "column": 30, "offset": 50628 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\n// Create two `Buffer` instances.\nconst buf1 = Buffer.allocUnsafe(26);\nconst buf2 = Buffer.allocUnsafe(26).fill('!');\n\nfor (let i = 0; i < 26; i++) {\n // 97 is the decimal ASCII value for 'a'.\n buf1[i] = i + 97;\n}\n\n// Copy `buf1` bytes 16 through 19 into `buf2` starting at byte 8 of `buf2`.\nbuf1.copy(buf2, 8, 16, 20);\n// This is equivalent to:\n// buf2.set(buf1.subarray(16, 20), 8);\n\nconsole.log(buf2.toString('ascii', 0, 25));\n// Prints: !!!!!!!!qrst!!!!!!!!!!!!!", - "position": { - "start": { "line": 1759, "column": 1, "offset": 50630 }, - "end": { "line": 1778, "column": 4, "offset": 51148 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\n// Create two `Buffer` instances.\nconst buf1 = Buffer.allocUnsafe(26);\nconst buf2 = Buffer.allocUnsafe(26).fill('!');\n\nfor (let i = 0; i < 26; i++) {\n // 97 is the decimal ASCII value for 'a'.\n buf1[i] = i + 97;\n}\n\n// Copy `buf1` bytes 16 through 19 into `buf2` starting at byte 8 of `buf2`.\nbuf1.copy(buf2, 8, 16, 20);\n// This is equivalent to:\n// buf2.set(buf1.subarray(16, 20), 8);\n\nconsole.log(buf2.toString('ascii', 0, 25));\n// Prints: !!!!!!!!qrst!!!!!!!!!!!!!", - "position": { - "start": { "line": 1780, "column": 1, "offset": 51150 }, - "end": { "line": 1799, "column": 4, "offset": 51673 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\n// Create a `Buffer` and copy data from one region to an overlapping region\n// within the same `Buffer`.\n\nconst buf = Buffer.allocUnsafe(26);\n\nfor (let i = 0; i < 26; i++) {\n // 97 is the decimal ASCII value for 'a'.\n buf[i] = i + 97;\n}\n\nbuf.copy(buf, 0, 4, 10);\n\nconsole.log(buf.toString());\n// Prints: efghijghijklmnopqrstuvwxyz", - "position": { - "start": { "line": 1801, "column": 1, "offset": 51675 }, - "end": { "line": 1818, "column": 4, "offset": 52057 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\n// Create a `Buffer` and copy data from one region to an overlapping region\n// within the same `Buffer`.\n\nconst buf = Buffer.allocUnsafe(26);\n\nfor (let i = 0; i < 26; i++) {\n // 97 is the decimal ASCII value for 'a'.\n buf[i] = i + 97;\n}\n\nbuf.copy(buf, 0, 4, 10);\n\nconsole.log(buf.toString());\n// Prints: efghijghijklmnopqrstuvwxyz", - "position": { - "start": { "line": 1820, "column": 1, "offset": 52059 }, - "end": { "line": 1837, "column": 4, "offset": 52446 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.entries()", - "position": { - "start": { "line": 1839, "column": 5, "offset": 52452 }, - "end": { "line": 1839, "column": 20, "offset": 52467 } - } - } - ], - "position": { - "start": { "line": 1839, "column": 1, "offset": 52448 }, - "end": { "line": 1839, "column": 20, "offset": 52467 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 1841, "column": 1, "offset": 52469 }, - "end": { "line": 1843, "column": 4, "offset": 52496 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {Iterator}", - "position": { - "start": { "line": 1845, "column": 3, "offset": 52500 }, - "end": { "line": 1845, "column": 22, "offset": 52519 } - } - } - ], - "position": { - "start": { "line": 1845, "column": 3, "offset": 52500 }, - "end": { "line": 1845, "column": 22, "offset": 52519 } - } - } - ], - "position": { - "start": { "line": 1845, "column": 1, "offset": 52498 }, - "end": { "line": 1845, "column": 22, "offset": 52519 } - } - } - ], - "position": { - "start": { "line": 1845, "column": 1, "offset": 52498 }, - "end": { "line": 1845, "column": 22, "offset": 52519 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Creates and returns an ", - "position": { - "start": { "line": 1847, "column": 1, "offset": 52521 }, - "end": { "line": 1847, "column": 24, "offset": 52544 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "text", - "value": "iterator", - "position": { - "start": { "line": 1847, "column": 25, "offset": 52545 }, - "end": { "line": 1847, "column": 33, "offset": 52553 } - } - } - ], - "position": { - "start": { "line": 1847, "column": 24, "offset": 52544 }, - "end": { "line": 1847, "column": 36, "offset": 52556 } - }, - "label": "iterator", - "identifier": "iterator", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": " of ", - "position": { - "start": { "line": 1847, "column": 36, "offset": 52556 }, - "end": { "line": 1847, "column": 40, "offset": 52560 } - } - }, - { - "type": "inlineCode", - "value": "[index, byte]", - "position": { - "start": { "line": 1847, "column": 40, "offset": 52560 }, - "end": { "line": 1847, "column": 55, "offset": 52575 } - } - }, - { - "type": "text", - "value": " pairs from the contents\nof ", - "position": { - "start": { "line": 1847, "column": 55, "offset": 52575 }, - "end": { "line": 1848, "column": 4, "offset": 52603 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 1848, "column": 4, "offset": 52603 }, - "end": { "line": 1848, "column": 9, "offset": 52608 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 1848, "column": 9, "offset": 52608 }, - "end": { "line": 1848, "column": 10, "offset": 52609 } - } - } - ], - "position": { - "start": { "line": 1847, "column": 1, "offset": 52521 }, - "end": { "line": 1848, "column": 10, "offset": 52609 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\n// Log the entire contents of a `Buffer`.\n\nconst buf = Buffer.from('buffer');\n\nfor (const pair of buf.entries()) {\n console.log(pair);\n}\n// Prints:\n// [0, 98]\n// [1, 117]\n// [2, 102]\n// [3, 102]\n// [4, 101]\n// [5, 114]", - "position": { - "start": { "line": 1850, "column": 1, "offset": 52611 }, - "end": { "line": 1867, "column": 4, "offset": 52892 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\n// Log the entire contents of a `Buffer`.\n\nconst buf = Buffer.from('buffer');\n\nfor (const pair of buf.entries()) {\n console.log(pair);\n}\n// Prints:\n// [0, 98]\n// [1, 117]\n// [2, 102]\n// [3, 102]\n// [4, 101]\n// [5, 114]", - "position": { - "start": { "line": 1869, "column": 1, "offset": 52894 }, - "end": { "line": 1886, "column": 4, "offset": 53180 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.equals(otherBuffer)", - "position": { - "start": { "line": 1888, "column": 5, "offset": 53186 }, - "end": { "line": 1888, "column": 30, "offset": 53211 } - } - } - ], - "position": { - "start": { "line": 1888, "column": 1, "offset": 53182 }, - "end": { "line": 1888, "column": 30, "offset": 53211 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 1890, "column": 1, "offset": 53213 }, - "end": { "line": 1896, "column": 4, "offset": 53382 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "otherBuffer", - "position": { - "start": { "line": 1898, "column": 3, "offset": 53386 }, - "end": { "line": 1898, "column": 16, "offset": 53399 } - } - }, - { - "type": "text", - "value": " {Buffer|Uint8Array} A ", - "position": { - "start": { "line": 1898, "column": 16, "offset": 53399 }, - "end": { "line": 1898, "column": 39, "offset": 53422 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 1898, "column": 39, "offset": 53422 }, - "end": { "line": 1898, "column": 47, "offset": 53430 } - } - }, - { - "type": "text", - "value": " or {Uint8Array} with which to\ncompare ", - "position": { - "start": { "line": 1898, "column": 47, "offset": 53430 }, - "end": { "line": 1899, "column": 11, "offset": 53471 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 1899, "column": 11, "offset": 53471 }, - "end": { "line": 1899, "column": 16, "offset": 53476 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 1899, "column": 16, "offset": 53476 }, - "end": { "line": 1899, "column": 17, "offset": 53477 } - } - } - ], - "position": { - "start": { "line": 1898, "column": 3, "offset": 53386 }, - "end": { "line": 1899, "column": 17, "offset": 53477 } - } - } - ], - "position": { - "start": { "line": 1898, "column": 1, "offset": 53384 }, - "end": { "line": 1899, "column": 17, "offset": 53477 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {boolean}", - "position": { - "start": { "line": 1900, "column": 3, "offset": 53480 }, - "end": { "line": 1900, "column": 21, "offset": 53498 } - } - } - ], - "position": { - "start": { "line": 1900, "column": 3, "offset": 53480 }, - "end": { "line": 1900, "column": 21, "offset": 53498 } - } - } - ], - "position": { - "start": { "line": 1900, "column": 1, "offset": 53478 }, - "end": { "line": 1900, "column": 21, "offset": 53498 } - } - } - ], - "position": { - "start": { "line": 1898, "column": 1, "offset": 53384 }, - "end": { "line": 1900, "column": 21, "offset": 53498 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns ", - "position": { - "start": { "line": 1902, "column": 1, "offset": 53500 }, - "end": { "line": 1902, "column": 9, "offset": 53508 } - } - }, - { - "type": "inlineCode", - "value": "true", - "position": { - "start": { "line": 1902, "column": 9, "offset": 53508 }, - "end": { "line": 1902, "column": 15, "offset": 53514 } - } - }, - { - "type": "text", - "value": " if both ", - "position": { - "start": { "line": 1902, "column": 15, "offset": 53514 }, - "end": { "line": 1902, "column": 24, "offset": 53523 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 1902, "column": 24, "offset": 53523 }, - "end": { "line": 1902, "column": 29, "offset": 53528 } - } - }, - { - "type": "text", - "value": " and ", - "position": { - "start": { "line": 1902, "column": 29, "offset": 53528 }, - "end": { "line": 1902, "column": 34, "offset": 53533 } - } - }, - { - "type": "inlineCode", - "value": "otherBuffer", - "position": { - "start": { "line": 1902, "column": 34, "offset": 53533 }, - "end": { "line": 1902, "column": 47, "offset": 53546 } - } - }, - { - "type": "text", - "value": " have exactly the same bytes,\n", - "position": { - "start": { "line": 1902, "column": 47, "offset": 53546 }, - "end": { "line": 1903, "column": 1, "offset": 53576 } - } - }, - { - "type": "inlineCode", - "value": "false", - "position": { - "start": { "line": 1903, "column": 1, "offset": 53576 }, - "end": { "line": 1903, "column": 8, "offset": 53583 } - } - }, - { - "type": "text", - "value": " otherwise. Equivalent to\n", - "position": { - "start": { "line": 1903, "column": 8, "offset": 53583 }, - "end": { "line": 1904, "column": 1, "offset": 53609 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "buf.compare(otherBuffer) === 0", - "position": { - "start": { "line": 1904, "column": 2, "offset": 53610 }, - "end": { "line": 1904, "column": 34, "offset": 53642 } - } - } - ], - "position": { - "start": { "line": 1904, "column": 1, "offset": 53609 }, - "end": { "line": 1904, "column": 52, "offset": 53660 } - }, - "label": "`buf.compare()`", - "identifier": "`buf.compare()`", - "referenceType": "full" - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 1904, "column": 52, "offset": 53660 }, - "end": { "line": 1904, "column": 53, "offset": 53661 } - } - } - ], - "position": { - "start": { "line": 1902, "column": 1, "offset": 53500 }, - "end": { "line": 1904, "column": 53, "offset": 53661 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf1 = Buffer.from('ABC');\nconst buf2 = Buffer.from('414243', 'hex');\nconst buf3 = Buffer.from('ABCD');\n\nconsole.log(buf1.equals(buf2));\n// Prints: true\nconsole.log(buf1.equals(buf3));\n// Prints: false", - "position": { - "start": { "line": 1906, "column": 1, "offset": 53663 }, - "end": { "line": 1917, "column": 4, "offset": 53920 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf1 = Buffer.from('ABC');\nconst buf2 = Buffer.from('414243', 'hex');\nconst buf3 = Buffer.from('ABCD');\n\nconsole.log(buf1.equals(buf2));\n// Prints: true\nconsole.log(buf1.equals(buf3));\n// Prints: false", - "position": { - "start": { "line": 1919, "column": 1, "offset": 53922 }, - "end": { "line": 1930, "column": 4, "offset": 54184 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.fill(value[, offset[, end]][, encoding])", - "position": { - "start": { "line": 1932, "column": 5, "offset": 54190 }, - "end": { "line": 1932, "column": 51, "offset": 54236 } - } - } - ], - "position": { - "start": { "line": 1932, "column": 1, "offset": 54186 }, - "end": { "line": 1932, "column": 51, "offset": 54236 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 1934, "column": 1, "offset": 54238 }, - "end": { "line": 1954, "column": 4, "offset": 55104 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 1956, "column": 3, "offset": 55108 }, - "end": { "line": 1956, "column": 10, "offset": 55115 } - } - }, - { - "type": "text", - "value": " {string|Buffer|Uint8Array|integer} The value with which to fill ", - "position": { - "start": { "line": 1956, "column": 10, "offset": 55115 }, - "end": { "line": 1956, "column": 75, "offset": 55180 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 1956, "column": 75, "offset": 55180 }, - "end": { "line": 1956, "column": 80, "offset": 55185 } - } - }, - { - "type": "text", - "value": ".\nEmpty value (string, Uint8Array, Buffer) is coerced to ", - "position": { - "start": { "line": 1956, "column": 80, "offset": 55185 }, - "end": { "line": 1957, "column": 58, "offset": 55244 } - } - }, - { - "type": "inlineCode", - "value": "0", - "position": { - "start": { "line": 1957, "column": 58, "offset": 55244 }, - "end": { "line": 1957, "column": 61, "offset": 55247 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 1957, "column": 61, "offset": 55247 }, - "end": { "line": 1957, "column": 62, "offset": 55248 } - } - } - ], - "position": { - "start": { "line": 1956, "column": 3, "offset": 55108 }, - "end": { "line": 1957, "column": 62, "offset": 55248 } - } - } - ], - "position": { - "start": { "line": 1956, "column": 1, "offset": 55106 }, - "end": { "line": 1957, "column": 62, "offset": 55248 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 1958, "column": 3, "offset": 55251 }, - "end": { "line": 1958, "column": 11, "offset": 55259 } - } - }, - { - "type": "text", - "value": " {integer} Number of bytes to skip before starting to fill ", - "position": { - "start": { "line": 1958, "column": 11, "offset": 55259 }, - "end": { "line": 1958, "column": 70, "offset": 55318 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 1958, "column": 70, "offset": 55318 }, - "end": { "line": 1958, "column": 75, "offset": 55323 } - } - }, - { - "type": "text", - "value": ".\n", - "position": { - "start": { "line": 1958, "column": 75, "offset": 55323 }, - "end": { "line": 1959, "column": 1, "offset": 55325 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { "line": 1959, "column": 5, "offset": 55329 }, - "end": { "line": 1959, "column": 13, "offset": 55337 } - } - } - ], - "position": { - "start": { "line": 1959, "column": 3, "offset": 55327 }, - "end": { "line": 1959, "column": 15, "offset": 55339 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 1959, "column": 15, "offset": 55339 }, - "end": { "line": 1959, "column": 16, "offset": 55340 } - } - }, - { - "type": "inlineCode", - "value": "0", - "position": { - "start": { "line": 1959, "column": 16, "offset": 55340 }, - "end": { "line": 1959, "column": 19, "offset": 55343 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 1959, "column": 19, "offset": 55343 }, - "end": { "line": 1959, "column": 20, "offset": 55344 } - } - } - ], - "position": { - "start": { "line": 1958, "column": 3, "offset": 55251 }, - "end": { "line": 1959, "column": 20, "offset": 55344 } - } - } - ], - "position": { - "start": { "line": 1958, "column": 1, "offset": 55249 }, - "end": { "line": 1959, "column": 20, "offset": 55344 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "end", - "position": { - "start": { "line": 1960, "column": 3, "offset": 55347 }, - "end": { "line": 1960, "column": 8, "offset": 55352 } - } - }, - { - "type": "text", - "value": " {integer} Where to stop filling ", - "position": { - "start": { "line": 1960, "column": 8, "offset": 55352 }, - "end": { "line": 1960, "column": 41, "offset": 55385 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 1960, "column": 41, "offset": 55385 }, - "end": { "line": 1960, "column": 46, "offset": 55390 } - } - }, - { - "type": "text", - "value": " (not inclusive). ", - "position": { - "start": { "line": 1960, "column": 46, "offset": 55390 }, - "end": { "line": 1960, "column": 64, "offset": 55408 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { - "line": 1960, - "column": 66, - "offset": 55410 - }, - "end": { "line": 1960, "column": 74, "offset": 55418 } - } - } - ], - "position": { - "start": { "line": 1960, "column": 64, "offset": 55408 }, - "end": { "line": 1960, "column": 76, "offset": 55420 } - } - }, - { - "type": "text", - "value": "\n", - "position": { - "start": { "line": 1960, "column": 76, "offset": 55420 }, - "end": { "line": 1961, "column": 1, "offset": 55421 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "buf.length", - "position": { - "start": { "line": 1961, "column": 4, "offset": 55424 }, - "end": { "line": 1961, "column": 16, "offset": 55436 } - } - } - ], - "position": { - "start": { "line": 1961, "column": 3, "offset": 55423 }, - "end": { "line": 1961, "column": 19, "offset": 55439 } - }, - "label": "`buf.length`", - "identifier": "`buf.length`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 1961, "column": 19, "offset": 55439 }, - "end": { "line": 1961, "column": 20, "offset": 55440 } - } - } - ], - "position": { - "start": { "line": 1960, "column": 3, "offset": 55347 }, - "end": { "line": 1961, "column": 20, "offset": 55440 } - } - } - ], - "position": { - "start": { "line": 1960, "column": 1, "offset": 55345 }, - "end": { "line": 1961, "column": 20, "offset": 55440 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "encoding", - "position": { - "start": { "line": 1962, "column": 3, "offset": 55443 }, - "end": { "line": 1962, "column": 13, "offset": 55453 } - } - }, - { - "type": "text", - "value": " {string} The encoding for ", - "position": { - "start": { "line": 1962, "column": 13, "offset": 55453 }, - "end": { "line": 1962, "column": 40, "offset": 55480 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 1962, "column": 40, "offset": 55480 }, - "end": { "line": 1962, "column": 47, "offset": 55487 } - } - }, - { - "type": "text", - "value": " if ", - "position": { - "start": { "line": 1962, "column": 47, "offset": 55487 }, - "end": { "line": 1962, "column": 51, "offset": 55491 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 1962, "column": 51, "offset": 55491 }, - "end": { "line": 1962, "column": 58, "offset": 55498 } - } - }, - { - "type": "text", - "value": " is a string.\n", - "position": { - "start": { "line": 1962, "column": 58, "offset": 55498 }, - "end": { "line": 1963, "column": 1, "offset": 55512 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { "line": 1963, "column": 5, "offset": 55516 }, - "end": { "line": 1963, "column": 13, "offset": 55524 } - } - } - ], - "position": { - "start": { "line": 1963, "column": 3, "offset": 55514 }, - "end": { "line": 1963, "column": 15, "offset": 55526 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 1963, "column": 15, "offset": 55526 }, - "end": { "line": 1963, "column": 16, "offset": 55527 } - } - }, - { - "type": "inlineCode", - "value": "'utf8'", - "position": { - "start": { "line": 1963, "column": 16, "offset": 55527 }, - "end": { "line": 1963, "column": 24, "offset": 55535 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 1963, "column": 24, "offset": 55535 }, - "end": { "line": 1963, "column": 25, "offset": 55536 } - } - } - ], - "position": { - "start": { "line": 1962, "column": 3, "offset": 55443 }, - "end": { "line": 1963, "column": 25, "offset": 55536 } - } - } - ], - "position": { - "start": { "line": 1962, "column": 1, "offset": 55441 }, - "end": { "line": 1963, "column": 25, "offset": 55536 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {Buffer} A reference to ", - "position": { - "start": { "line": 1964, "column": 3, "offset": 55539 }, - "end": { "line": 1964, "column": 36, "offset": 55572 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 1964, "column": 36, "offset": 55572 }, - "end": { "line": 1964, "column": 41, "offset": 55577 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 1964, "column": 41, "offset": 55577 }, - "end": { "line": 1964, "column": 42, "offset": 55578 } - } - } - ], - "position": { - "start": { "line": 1964, "column": 3, "offset": 55539 }, - "end": { "line": 1964, "column": 42, "offset": 55578 } - } - } - ], - "position": { - "start": { "line": 1964, "column": 1, "offset": 55537 }, - "end": { "line": 1964, "column": 42, "offset": 55578 } - } - } - ], - "position": { - "start": { "line": 1956, "column": 1, "offset": 55106 }, - "end": { "line": 1964, "column": 42, "offset": 55578 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Fills ", - "position": { - "start": { "line": 1966, "column": 1, "offset": 55580 }, - "end": { "line": 1966, "column": 7, "offset": 55586 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 1966, "column": 7, "offset": 55586 }, - "end": { "line": 1966, "column": 12, "offset": 55591 } - } - }, - { - "type": "text", - "value": " with the specified ", - "position": { - "start": { "line": 1966, "column": 12, "offset": 55591 }, - "end": { "line": 1966, "column": 32, "offset": 55611 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 1966, "column": 32, "offset": 55611 }, - "end": { "line": 1966, "column": 39, "offset": 55618 } - } - }, - { - "type": "text", - "value": ". If the ", - "position": { - "start": { "line": 1966, "column": 39, "offset": 55618 }, - "end": { "line": 1966, "column": 48, "offset": 55627 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 1966, "column": 48, "offset": 55627 }, - "end": { "line": 1966, "column": 56, "offset": 55635 } - } - }, - { - "type": "text", - "value": " and ", - "position": { - "start": { "line": 1966, "column": 56, "offset": 55635 }, - "end": { "line": 1966, "column": 61, "offset": 55640 } - } - }, - { - "type": "inlineCode", - "value": "end", - "position": { - "start": { "line": 1966, "column": 61, "offset": 55640 }, - "end": { "line": 1966, "column": 66, "offset": 55645 } - } - }, - { - "type": "text", - "value": " are not given,\nthe entire ", - "position": { - "start": { "line": 1966, "column": 66, "offset": 55645 }, - "end": { "line": 1967, "column": 12, "offset": 55672 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 1967, "column": 12, "offset": 55672 }, - "end": { "line": 1967, "column": 17, "offset": 55677 } - } - }, - { - "type": "text", - "value": " will be filled:", - "position": { - "start": { "line": 1967, "column": 17, "offset": 55677 }, - "end": { "line": 1967, "column": 33, "offset": 55693 } - } - } - ], - "position": { - "start": { "line": 1966, "column": 1, "offset": 55580 }, - "end": { "line": 1967, "column": 33, "offset": 55693 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\n// Fill a `Buffer` with the ASCII character 'h'.\n\nconst b = Buffer.allocUnsafe(50).fill('h');\n\nconsole.log(b.toString());\n// Prints: hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh\n\n// Fill a buffer with empty string\nconst c = Buffer.allocUnsafe(5).fill('');\n\nconsole.log(c.fill(''));\n// Prints: ", - "position": { - "start": { "line": 1969, "column": 1, "offset": 55695 }, - "end": { "line": 1984, "column": 4, "offset": 56067 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\n// Fill a `Buffer` with the ASCII character 'h'.\n\nconst b = Buffer.allocUnsafe(50).fill('h');\n\nconsole.log(b.toString());\n// Prints: hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh\n\n// Fill a buffer with empty string\nconst c = Buffer.allocUnsafe(5).fill('');\n\nconsole.log(c.fill(''));\n// Prints: ", - "position": { - "start": { "line": 1986, "column": 1, "offset": 56069 }, - "end": { "line": 2001, "column": 4, "offset": 56446 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 2003, "column": 1, "offset": 56448 }, - "end": { "line": 2003, "column": 8, "offset": 56455 } - } - }, - { - "type": "text", - "value": " is coerced to a ", - "position": { - "start": { "line": 2003, "column": 8, "offset": 56455 }, - "end": { "line": 2003, "column": 25, "offset": 56472 } - } - }, - { - "type": "inlineCode", - "value": "uint32", - "position": { - "start": { "line": 2003, "column": 25, "offset": 56472 }, - "end": { "line": 2003, "column": 33, "offset": 56480 } - } - }, - { - "type": "text", - "value": " value if it is not a string, ", - "position": { - "start": { "line": 2003, "column": 33, "offset": 56480 }, - "end": { "line": 2003, "column": 63, "offset": 56510 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 2003, "column": 63, "offset": 56510 }, - "end": { "line": 2003, "column": 71, "offset": 56518 } - } - }, - { - "type": "text", - "value": ", or\ninteger. If the resulting integer is greater than ", - "position": { - "start": { "line": 2003, "column": 71, "offset": 56518 }, - "end": { "line": 2004, "column": 51, "offset": 56573 } - } - }, - { - "type": "inlineCode", - "value": "255", - "position": { - "start": { "line": 2004, "column": 51, "offset": 56573 }, - "end": { "line": 2004, "column": 56, "offset": 56578 } - } - }, - { - "type": "text", - "value": " (decimal), ", - "position": { - "start": { "line": 2004, "column": 56, "offset": 56578 }, - "end": { "line": 2004, "column": 68, "offset": 56590 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 2004, "column": 68, "offset": 56590 }, - "end": { "line": 2004, "column": 73, "offset": 56595 } - } - }, - { - "type": "text", - "value": " will be\nfilled with ", - "position": { - "start": { "line": 2004, "column": 73, "offset": 56595 }, - "end": { "line": 2005, "column": 13, "offset": 56616 } - } - }, - { - "type": "inlineCode", - "value": "value & 255", - "position": { - "start": { "line": 2005, "column": 13, "offset": 56616 }, - "end": { "line": 2005, "column": 26, "offset": 56629 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 2005, "column": 26, "offset": 56629 }, - "end": { "line": 2005, "column": 27, "offset": 56630 } - } - } - ], - "position": { - "start": { "line": 2003, "column": 1, "offset": 56448 }, - "end": { "line": 2005, "column": 27, "offset": 56630 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "If the final write of a ", - "position": { - "start": { "line": 2007, "column": 1, "offset": 56632 }, - "end": { "line": 2007, "column": 25, "offset": 56656 } - } - }, - { - "type": "inlineCode", - "value": "fill()", - "position": { - "start": { "line": 2007, "column": 25, "offset": 56656 }, - "end": { "line": 2007, "column": 33, "offset": 56664 } - } - }, - { - "type": "text", - "value": " operation falls on a multi-byte character,\nthen only the bytes of that character that fit into ", - "position": { - "start": { "line": 2007, "column": 33, "offset": 56664 }, - "end": { "line": 2008, "column": 53, "offset": 56760 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 2008, "column": 53, "offset": 56760 }, - "end": { "line": 2008, "column": 58, "offset": 56765 } - } - }, - { - "type": "text", - "value": " are written:", - "position": { - "start": { "line": 2008, "column": 58, "offset": 56765 }, - "end": { "line": 2008, "column": 71, "offset": 56778 } - } - } - ], - "position": { - "start": { "line": 2007, "column": 1, "offset": 56632 }, - "end": { "line": 2008, "column": 71, "offset": 56778 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\n// Fill a `Buffer` with character that takes up two bytes in UTF-8.\n\nconsole.log(Buffer.allocUnsafe(5).fill('\\u0222'));\n// Prints: ", - "position": { - "start": { "line": 2010, "column": 1, "offset": 56780 }, - "end": { "line": 2017, "column": 4, "offset": 56984 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\n// Fill a `Buffer` with character that takes up two bytes in UTF-8.\n\nconsole.log(Buffer.allocUnsafe(5).fill('\\u0222'));\n// Prints: ", - "position": { - "start": { "line": 2019, "column": 1, "offset": 56986 }, - "end": { "line": 2026, "column": 4, "offset": 57195 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "If ", - "position": { - "start": { "line": 2028, "column": 1, "offset": 57197 }, - "end": { "line": 2028, "column": 4, "offset": 57200 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 2028, "column": 4, "offset": 57200 }, - "end": { "line": 2028, "column": 11, "offset": 57207 } - } - }, - { - "type": "text", - "value": " contains invalid characters, it is truncated; if no valid\nfill data remains, an exception is thrown:", - "position": { - "start": { "line": 2028, "column": 11, "offset": 57207 }, - "end": { "line": 2029, "column": 43, "offset": 57308 } - } - } - ], - "position": { - "start": { "line": 2028, "column": 1, "offset": 57197 }, - "end": { "line": 2029, "column": 43, "offset": 57308 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.allocUnsafe(5);\n\nconsole.log(buf.fill('a'));\n// Prints: \nconsole.log(buf.fill('aazz', 'hex'));\n// Prints: \nconsole.log(buf.fill('zz', 'hex'));\n// Throws an exception.", - "position": { - "start": { "line": 2031, "column": 1, "offset": 57310 }, - "end": { "line": 2042, "column": 4, "offset": 57591 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.allocUnsafe(5);\n\nconsole.log(buf.fill('a'));\n// Prints: \nconsole.log(buf.fill('aazz', 'hex'));\n// Prints: \nconsole.log(buf.fill('zz', 'hex'));\n// Throws an exception.", - "position": { - "start": { "line": 2044, "column": 1, "offset": 57593 }, - "end": { "line": 2055, "column": 4, "offset": 57879 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.includes(value[, byteOffset][, encoding])", - "position": { - "start": { "line": 2057, "column": 5, "offset": 57885 }, - "end": { "line": 2057, "column": 52, "offset": 57932 } - } - } - ], - "position": { - "start": { "line": 2057, "column": 1, "offset": 57881 }, - "end": { "line": 2057, "column": 52, "offset": 57932 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 2059, "column": 1, "offset": 57934 }, - "end": { "line": 2061, "column": 4, "offset": 57961 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 2063, "column": 3, "offset": 57965 }, - "end": { "line": 2063, "column": 10, "offset": 57972 } - } - }, - { - "type": "text", - "value": " {string|Buffer|Uint8Array|integer} What to search for.", - "position": { - "start": { "line": 2063, "column": 10, "offset": 57972 }, - "end": { "line": 2063, "column": 65, "offset": 58027 } - } - } - ], - "position": { - "start": { "line": 2063, "column": 3, "offset": 57965 }, - "end": { "line": 2063, "column": 65, "offset": 58027 } - } - } - ], - "position": { - "start": { "line": 2063, "column": 1, "offset": 57963 }, - "end": { "line": 2063, "column": 65, "offset": 58027 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "byteOffset", - "position": { - "start": { "line": 2064, "column": 3, "offset": 58030 }, - "end": { "line": 2064, "column": 15, "offset": 58042 } - } - }, - { - "type": "text", - "value": " {integer} Where to begin searching in ", - "position": { - "start": { "line": 2064, "column": 15, "offset": 58042 }, - "end": { "line": 2064, "column": 54, "offset": 58081 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 2064, "column": 54, "offset": 58081 }, - "end": { "line": 2064, "column": 59, "offset": 58086 } - } - }, - { - "type": "text", - "value": ". If negative, then\noffset is calculated from the end of ", - "position": { - "start": { "line": 2064, "column": 59, "offset": 58086 }, - "end": { "line": 2065, "column": 40, "offset": 58145 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 2065, "column": 40, "offset": 58145 }, - "end": { "line": 2065, "column": 45, "offset": 58150 } - } - }, - { - "type": "text", - "value": ". ", - "position": { - "start": { "line": 2065, "column": 45, "offset": 58150 }, - "end": { "line": 2065, "column": 47, "offset": 58152 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { - "line": 2065, - "column": 49, - "offset": 58154 - }, - "end": { "line": 2065, "column": 57, "offset": 58162 } - } - } - ], - "position": { - "start": { "line": 2065, "column": 47, "offset": 58152 }, - "end": { "line": 2065, "column": 59, "offset": 58164 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 2065, "column": 59, "offset": 58164 }, - "end": { "line": 2065, "column": 60, "offset": 58165 } - } - }, - { - "type": "inlineCode", - "value": "0", - "position": { - "start": { "line": 2065, "column": 60, "offset": 58165 }, - "end": { "line": 2065, "column": 63, "offset": 58168 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 2065, "column": 63, "offset": 58168 }, - "end": { "line": 2065, "column": 64, "offset": 58169 } - } - } - ], - "position": { - "start": { "line": 2064, "column": 3, "offset": 58030 }, - "end": { "line": 2065, "column": 64, "offset": 58169 } - } - } - ], - "position": { - "start": { "line": 2064, "column": 1, "offset": 58028 }, - "end": { "line": 2065, "column": 64, "offset": 58169 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "encoding", - "position": { - "start": { "line": 2066, "column": 3, "offset": 58172 }, - "end": { "line": 2066, "column": 13, "offset": 58182 } - } - }, - { - "type": "text", - "value": " {string} If ", - "position": { - "start": { "line": 2066, "column": 13, "offset": 58182 }, - "end": { "line": 2066, "column": 26, "offset": 58195 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 2066, "column": 26, "offset": 58195 }, - "end": { "line": 2066, "column": 33, "offset": 58202 } - } - }, - { - "type": "text", - "value": " is a string, this is its encoding.\n", - "position": { - "start": { "line": 2066, "column": 33, "offset": 58202 }, - "end": { "line": 2067, "column": 1, "offset": 58238 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { "line": 2067, "column": 5, "offset": 58242 }, - "end": { "line": 2067, "column": 13, "offset": 58250 } - } - } - ], - "position": { - "start": { "line": 2067, "column": 3, "offset": 58240 }, - "end": { "line": 2067, "column": 15, "offset": 58252 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 2067, "column": 15, "offset": 58252 }, - "end": { "line": 2067, "column": 16, "offset": 58253 } - } - }, - { - "type": "inlineCode", - "value": "'utf8'", - "position": { - "start": { "line": 2067, "column": 16, "offset": 58253 }, - "end": { "line": 2067, "column": 24, "offset": 58261 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 2067, "column": 24, "offset": 58261 }, - "end": { "line": 2067, "column": 25, "offset": 58262 } - } - } - ], - "position": { - "start": { "line": 2066, "column": 3, "offset": 58172 }, - "end": { "line": 2067, "column": 25, "offset": 58262 } - } - } - ], - "position": { - "start": { "line": 2066, "column": 1, "offset": 58170 }, - "end": { "line": 2067, "column": 25, "offset": 58262 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {boolean} ", - "position": { - "start": { "line": 2068, "column": 3, "offset": 58265 }, - "end": { "line": 2068, "column": 22, "offset": 58284 } - } - }, - { - "type": "inlineCode", - "value": "true", - "position": { - "start": { "line": 2068, "column": 22, "offset": 58284 }, - "end": { "line": 2068, "column": 28, "offset": 58290 } - } - }, - { - "type": "text", - "value": " if ", - "position": { - "start": { "line": 2068, "column": 28, "offset": 58290 }, - "end": { "line": 2068, "column": 32, "offset": 58294 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 2068, "column": 32, "offset": 58294 }, - "end": { "line": 2068, "column": 39, "offset": 58301 } - } - }, - { - "type": "text", - "value": " was found in ", - "position": { - "start": { "line": 2068, "column": 39, "offset": 58301 }, - "end": { "line": 2068, "column": 53, "offset": 58315 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 2068, "column": 53, "offset": 58315 }, - "end": { "line": 2068, "column": 58, "offset": 58320 } - } - }, - { - "type": "text", - "value": ", ", - "position": { - "start": { "line": 2068, "column": 58, "offset": 58320 }, - "end": { "line": 2068, "column": 60, "offset": 58322 } - } - }, - { - "type": "inlineCode", - "value": "false", - "position": { - "start": { "line": 2068, "column": 60, "offset": 58322 }, - "end": { "line": 2068, "column": 67, "offset": 58329 } - } - }, - { - "type": "text", - "value": " otherwise.", - "position": { - "start": { "line": 2068, "column": 67, "offset": 58329 }, - "end": { "line": 2068, "column": 78, "offset": 58340 } - } - } - ], - "position": { - "start": { "line": 2068, "column": 3, "offset": 58265 }, - "end": { "line": 2068, "column": 78, "offset": 58340 } - } - } - ], - "position": { - "start": { "line": 2068, "column": 1, "offset": 58263 }, - "end": { "line": 2068, "column": 78, "offset": 58340 } - } - } - ], - "position": { - "start": { "line": 2063, "column": 1, "offset": 57963 }, - "end": { "line": 2068, "column": 78, "offset": 58340 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Equivalent to ", - "position": { - "start": { "line": 2070, "column": 1, "offset": 58342 }, - "end": { "line": 2070, "column": 15, "offset": 58356 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "buf.indexOf() !== -1", - "position": { - "start": { "line": 2070, "column": 16, "offset": 58357 }, - "end": { "line": 2070, "column": 38, "offset": 58379 } - } - } - ], - "position": { - "start": { "line": 2070, "column": 15, "offset": 58356 }, - "end": { "line": 2070, "column": 56, "offset": 58397 } - }, - "label": "`buf.indexOf()`", - "identifier": "`buf.indexof()`", - "referenceType": "full" - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 2070, "column": 56, "offset": 58397 }, - "end": { "line": 2070, "column": 57, "offset": 58398 } - } - } - ], - "position": { - "start": { "line": 2070, "column": 1, "offset": 58342 }, - "end": { "line": 2070, "column": 57, "offset": 58398 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from('this is a buffer');\n\nconsole.log(buf.includes('this'));\n// Prints: true\nconsole.log(buf.includes('is'));\n// Prints: true\nconsole.log(buf.includes(Buffer.from('a buffer')));\n// Prints: true\nconsole.log(buf.includes(97));\n// Prints: true (97 is the decimal ASCII value for 'a')\nconsole.log(buf.includes(Buffer.from('a buffer example')));\n// Prints: false\nconsole.log(buf.includes(Buffer.from('a buffer example').slice(0, 8)));\n// Prints: true\nconsole.log(buf.includes('this', 4));\n// Prints: false", - "position": { - "start": { "line": 2072, "column": 1, "offset": 58400 }, - "end": { "line": 2091, "column": 4, "offset": 58970 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from('this is a buffer');\n\nconsole.log(buf.includes('this'));\n// Prints: true\nconsole.log(buf.includes('is'));\n// Prints: true\nconsole.log(buf.includes(Buffer.from('a buffer')));\n// Prints: true\nconsole.log(buf.includes(97));\n// Prints: true (97 is the decimal ASCII value for 'a')\nconsole.log(buf.includes(Buffer.from('a buffer example')));\n// Prints: false\nconsole.log(buf.includes(Buffer.from('a buffer example').slice(0, 8)));\n// Prints: true\nconsole.log(buf.includes('this', 4));\n// Prints: false", - "position": { - "start": { "line": 2093, "column": 1, "offset": 58972 }, - "end": { "line": 2112, "column": 4, "offset": 59547 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.indexOf(value[, byteOffset][, encoding])", - "position": { - "start": { "line": 2114, "column": 5, "offset": 59553 }, - "end": { "line": 2114, "column": 51, "offset": 59599 } - } - } - ], - "position": { - "start": { "line": 2114, "column": 1, "offset": 59549 }, - "end": { "line": 2114, "column": 51, "offset": 59599 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 2116, "column": 1, "offset": 59601 }, - "end": { "line": 2128, "column": 4, "offset": 59976 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 2130, "column": 3, "offset": 59980 }, - "end": { "line": 2130, "column": 10, "offset": 59987 } - } - }, - { - "type": "text", - "value": " {string|Buffer|Uint8Array|integer} What to search for.", - "position": { - "start": { "line": 2130, "column": 10, "offset": 59987 }, - "end": { "line": 2130, "column": 65, "offset": 60042 } - } - } - ], - "position": { - "start": { "line": 2130, "column": 3, "offset": 59980 }, - "end": { "line": 2130, "column": 65, "offset": 60042 } - } - } - ], - "position": { - "start": { "line": 2130, "column": 1, "offset": 59978 }, - "end": { "line": 2130, "column": 65, "offset": 60042 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "byteOffset", - "position": { - "start": { "line": 2131, "column": 3, "offset": 60045 }, - "end": { "line": 2131, "column": 15, "offset": 60057 } - } - }, - { - "type": "text", - "value": " {integer} Where to begin searching in ", - "position": { - "start": { "line": 2131, "column": 15, "offset": 60057 }, - "end": { "line": 2131, "column": 54, "offset": 60096 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 2131, "column": 54, "offset": 60096 }, - "end": { "line": 2131, "column": 59, "offset": 60101 } - } - }, - { - "type": "text", - "value": ". If negative, then\noffset is calculated from the end of ", - "position": { - "start": { "line": 2131, "column": 59, "offset": 60101 }, - "end": { "line": 2132, "column": 40, "offset": 60160 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 2132, "column": 40, "offset": 60160 }, - "end": { "line": 2132, "column": 45, "offset": 60165 } - } - }, - { - "type": "text", - "value": ". ", - "position": { - "start": { "line": 2132, "column": 45, "offset": 60165 }, - "end": { "line": 2132, "column": 47, "offset": 60167 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { - "line": 2132, - "column": 49, - "offset": 60169 - }, - "end": { "line": 2132, "column": 57, "offset": 60177 } - } - } - ], - "position": { - "start": { "line": 2132, "column": 47, "offset": 60167 }, - "end": { "line": 2132, "column": 59, "offset": 60179 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 2132, "column": 59, "offset": 60179 }, - "end": { "line": 2132, "column": 60, "offset": 60180 } - } - }, - { - "type": "inlineCode", - "value": "0", - "position": { - "start": { "line": 2132, "column": 60, "offset": 60180 }, - "end": { "line": 2132, "column": 63, "offset": 60183 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 2132, "column": 63, "offset": 60183 }, - "end": { "line": 2132, "column": 64, "offset": 60184 } - } - } - ], - "position": { - "start": { "line": 2131, "column": 3, "offset": 60045 }, - "end": { "line": 2132, "column": 64, "offset": 60184 } - } - } - ], - "position": { - "start": { "line": 2131, "column": 1, "offset": 60043 }, - "end": { "line": 2132, "column": 64, "offset": 60184 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "encoding", - "position": { - "start": { "line": 2133, "column": 3, "offset": 60187 }, - "end": { "line": 2133, "column": 13, "offset": 60197 } - } - }, - { - "type": "text", - "value": " {string} If ", - "position": { - "start": { "line": 2133, "column": 13, "offset": 60197 }, - "end": { "line": 2133, "column": 26, "offset": 60210 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 2133, "column": 26, "offset": 60210 }, - "end": { "line": 2133, "column": 33, "offset": 60217 } - } - }, - { - "type": "text", - "value": " is a string, this is the encoding used to\ndetermine the binary representation of the string that will be searched for in\n", - "position": { - "start": { "line": 2133, "column": 33, "offset": 60217 }, - "end": { "line": 2135, "column": 1, "offset": 60341 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 2135, "column": 3, "offset": 60343 }, - "end": { "line": 2135, "column": 8, "offset": 60348 } - } - }, - { - "type": "text", - "value": ". ", - "position": { - "start": { "line": 2135, "column": 8, "offset": 60348 }, - "end": { "line": 2135, "column": 10, "offset": 60350 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { - "line": 2135, - "column": 12, - "offset": 60352 - }, - "end": { "line": 2135, "column": 20, "offset": 60360 } - } - } - ], - "position": { - "start": { "line": 2135, "column": 10, "offset": 60350 }, - "end": { "line": 2135, "column": 22, "offset": 60362 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 2135, "column": 22, "offset": 60362 }, - "end": { "line": 2135, "column": 23, "offset": 60363 } - } - }, - { - "type": "inlineCode", - "value": "'utf8'", - "position": { - "start": { "line": 2135, "column": 23, "offset": 60363 }, - "end": { "line": 2135, "column": 31, "offset": 60371 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 2135, "column": 31, "offset": 60371 }, - "end": { "line": 2135, "column": 32, "offset": 60372 } - } - } - ], - "position": { - "start": { "line": 2133, "column": 3, "offset": 60187 }, - "end": { "line": 2135, "column": 32, "offset": 60372 } - } - } - ], - "position": { - "start": { "line": 2133, "column": 1, "offset": 60185 }, - "end": { "line": 2135, "column": 32, "offset": 60372 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {integer} The index of the first occurrence of ", - "position": { - "start": { "line": 2136, "column": 3, "offset": 60375 }, - "end": { "line": 2136, "column": 59, "offset": 60431 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 2136, "column": 59, "offset": 60431 }, - "end": { "line": 2136, "column": 66, "offset": 60438 } - } - }, - { - "type": "text", - "value": " in ", - "position": { - "start": { "line": 2136, "column": 66, "offset": 60438 }, - "end": { "line": 2136, "column": 70, "offset": 60442 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 2136, "column": 70, "offset": 60442 }, - "end": { "line": 2136, "column": 75, "offset": 60447 } - } - }, - { - "type": "text", - "value": ", or\n", - "position": { - "start": { "line": 2136, "column": 75, "offset": 60447 }, - "end": { "line": 2137, "column": 1, "offset": 60452 } - } - }, - { - "type": "inlineCode", - "value": "-1", - "position": { - "start": { "line": 2137, "column": 3, "offset": 60454 }, - "end": { "line": 2137, "column": 7, "offset": 60458 } - } - }, - { - "type": "text", - "value": " if ", - "position": { - "start": { "line": 2137, "column": 7, "offset": 60458 }, - "end": { "line": 2137, "column": 11, "offset": 60462 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 2137, "column": 11, "offset": 60462 }, - "end": { "line": 2137, "column": 16, "offset": 60467 } - } - }, - { - "type": "text", - "value": " does not contain ", - "position": { - "start": { "line": 2137, "column": 16, "offset": 60467 }, - "end": { "line": 2137, "column": 34, "offset": 60485 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 2137, "column": 34, "offset": 60485 }, - "end": { "line": 2137, "column": 41, "offset": 60492 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 2137, "column": 41, "offset": 60492 }, - "end": { "line": 2137, "column": 42, "offset": 60493 } - } - } - ], - "position": { - "start": { "line": 2136, "column": 3, "offset": 60375 }, - "end": { "line": 2137, "column": 42, "offset": 60493 } - } - } - ], - "position": { - "start": { "line": 2136, "column": 1, "offset": 60373 }, - "end": { "line": 2137, "column": 42, "offset": 60493 } - } - } - ], - "position": { - "start": { "line": 2130, "column": 1, "offset": 59978 }, - "end": { "line": 2137, "column": 42, "offset": 60493 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "If ", - "position": { - "start": { "line": 2139, "column": 1, "offset": 60495 }, - "end": { "line": 2139, "column": 4, "offset": 60498 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 2139, "column": 4, "offset": 60498 }, - "end": { "line": 2139, "column": 11, "offset": 60505 } - } - }, - { - "type": "text", - "value": " is:", - "position": { - "start": { "line": 2139, "column": 11, "offset": 60505 }, - "end": { "line": 2139, "column": 15, "offset": 60509 } - } - } - ], - "position": { - "start": { "line": 2139, "column": 1, "offset": 60495 }, - "end": { "line": 2139, "column": 15, "offset": 60509 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "a string, ", - "position": { - "start": { "line": 2141, "column": 3, "offset": 60513 }, - "end": { "line": 2141, "column": 13, "offset": 60523 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 2141, "column": 13, "offset": 60523 }, - "end": { "line": 2141, "column": 20, "offset": 60530 } - } - }, - { - "type": "text", - "value": " is interpreted according to the character encoding in\n", - "position": { - "start": { "line": 2141, "column": 20, "offset": 60530 }, - "end": { "line": 2142, "column": 1, "offset": 60585 } - } - }, - { - "type": "inlineCode", - "value": "encoding", - "position": { - "start": { "line": 2142, "column": 3, "offset": 60587 }, - "end": { "line": 2142, "column": 13, "offset": 60597 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 2142, "column": 13, "offset": 60597 }, - "end": { "line": 2142, "column": 14, "offset": 60598 } - } - } - ], - "position": { - "start": { "line": 2141, "column": 3, "offset": 60513 }, - "end": { "line": 2142, "column": 14, "offset": 60598 } - } - } - ], - "position": { - "start": { "line": 2141, "column": 1, "offset": 60511 }, - "end": { "line": 2142, "column": 14, "offset": 60598 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "a ", - "position": { - "start": { "line": 2143, "column": 3, "offset": 60601 }, - "end": { "line": 2143, "column": 5, "offset": 60603 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 2143, "column": 5, "offset": 60603 }, - "end": { "line": 2143, "column": 13, "offset": 60611 } - } - }, - { - "type": "text", - "value": " or {Uint8Array}, ", - "position": { - "start": { "line": 2143, "column": 13, "offset": 60611 }, - "end": { "line": 2143, "column": 31, "offset": 60629 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 2143, "column": 31, "offset": 60629 }, - "end": { "line": 2143, "column": 38, "offset": 60636 } - } - }, - { - "type": "text", - "value": " will be used in its entirety.\nTo compare a partial ", - "position": { - "start": { "line": 2143, "column": 38, "offset": 60636 }, - "end": { "line": 2144, "column": 24, "offset": 60690 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 2144, "column": 24, "offset": 60690 }, - "end": { "line": 2144, "column": 32, "offset": 60698 } - } - }, - { - "type": "text", - "value": ", use ", - "position": { - "start": { "line": 2144, "column": 32, "offset": 60698 }, - "end": { "line": 2144, "column": 38, "offset": 60704 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "buf.subarray", - "position": { - "start": { - "line": 2144, - "column": 39, - "offset": 60705 - }, - "end": { "line": 2144, "column": 53, "offset": 60719 } - } - } - ], - "position": { - "start": { "line": 2144, "column": 38, "offset": 60704 }, - "end": { "line": 2144, "column": 56, "offset": 60722 } - }, - "label": "`buf.subarray`", - "identifier": "`buf.subarray`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 2144, "column": 56, "offset": 60722 }, - "end": { "line": 2144, "column": 57, "offset": 60723 } - } - } - ], - "position": { - "start": { "line": 2143, "column": 3, "offset": 60601 }, - "end": { "line": 2144, "column": 57, "offset": 60723 } - } - } - ], - "position": { - "start": { "line": 2143, "column": 1, "offset": 60599 }, - "end": { "line": 2144, "column": 57, "offset": 60723 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "a number, ", - "position": { - "start": { "line": 2145, "column": 3, "offset": 60726 }, - "end": { "line": 2145, "column": 13, "offset": 60736 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 2145, "column": 13, "offset": 60736 }, - "end": { "line": 2145, "column": 20, "offset": 60743 } - } - }, - { - "type": "text", - "value": " will be interpreted as an unsigned 8-bit integer\nvalue between ", - "position": { - "start": { "line": 2145, "column": 20, "offset": 60743 }, - "end": { "line": 2146, "column": 17, "offset": 60809 } - } - }, - { - "type": "inlineCode", - "value": "0", - "position": { - "start": { "line": 2146, "column": 17, "offset": 60809 }, - "end": { "line": 2146, "column": 20, "offset": 60812 } - } - }, - { - "type": "text", - "value": " and ", - "position": { - "start": { "line": 2146, "column": 20, "offset": 60812 }, - "end": { "line": 2146, "column": 25, "offset": 60817 } - } - }, - { - "type": "inlineCode", - "value": "255", - "position": { - "start": { "line": 2146, "column": 25, "offset": 60817 }, - "end": { "line": 2146, "column": 30, "offset": 60822 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 2146, "column": 30, "offset": 60822 }, - "end": { "line": 2146, "column": 31, "offset": 60823 } - } - } - ], - "position": { - "start": { "line": 2145, "column": 3, "offset": 60726 }, - "end": { "line": 2146, "column": 31, "offset": 60823 } - } - } - ], - "position": { - "start": { "line": 2145, "column": 1, "offset": 60724 }, - "end": { "line": 2146, "column": 31, "offset": 60823 } - } - } - ], - "position": { - "start": { "line": 2141, "column": 1, "offset": 60511 }, - "end": { "line": 2146, "column": 31, "offset": 60823 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from('this is a buffer');\n\nconsole.log(buf.indexOf('this'));\n// Prints: 0\nconsole.log(buf.indexOf('is'));\n// Prints: 2\nconsole.log(buf.indexOf(Buffer.from('a buffer')));\n// Prints: 8\nconsole.log(buf.indexOf(97));\n// Prints: 8 (97 is the decimal ASCII value for 'a')\nconsole.log(buf.indexOf(Buffer.from('a buffer example')));\n// Prints: -1\nconsole.log(buf.indexOf(Buffer.from('a buffer example').slice(0, 8)));\n// Prints: 8\n\nconst utf16Buffer = Buffer.from('\\u039a\\u0391\\u03a3\\u03a3\\u0395', 'utf16le');\n\nconsole.log(utf16Buffer.indexOf('\\u03a3', 0, 'utf16le'));\n// Prints: 4\nconsole.log(utf16Buffer.indexOf('\\u03a3', -4, 'utf16le'));\n// Prints: 6", - "position": { - "start": { "line": 2148, "column": 1, "offset": 60825 }, - "end": { "line": 2172, "column": 4, "offset": 61539 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from('this is a buffer');\n\nconsole.log(buf.indexOf('this'));\n// Prints: 0\nconsole.log(buf.indexOf('is'));\n// Prints: 2\nconsole.log(buf.indexOf(Buffer.from('a buffer')));\n// Prints: 8\nconsole.log(buf.indexOf(97));\n// Prints: 8 (97 is the decimal ASCII value for 'a')\nconsole.log(buf.indexOf(Buffer.from('a buffer example')));\n// Prints: -1\nconsole.log(buf.indexOf(Buffer.from('a buffer example').slice(0, 8)));\n// Prints: 8\n\nconst utf16Buffer = Buffer.from('\\u039a\\u0391\\u03a3\\u03a3\\u0395', 'utf16le');\n\nconsole.log(utf16Buffer.indexOf('\\u03a3', 0, 'utf16le'));\n// Prints: 4\nconsole.log(utf16Buffer.indexOf('\\u03a3', -4, 'utf16le'));\n// Prints: 6", - "position": { - "start": { "line": 2174, "column": 1, "offset": 61541 }, - "end": { "line": 2198, "column": 4, "offset": 62260 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "If ", - "position": { - "start": { "line": 2200, "column": 1, "offset": 62262 }, - "end": { "line": 2200, "column": 4, "offset": 62265 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 2200, "column": 4, "offset": 62265 }, - "end": { "line": 2200, "column": 11, "offset": 62272 } - } - }, - { - "type": "text", - "value": " is not a string, number, or ", - "position": { - "start": { "line": 2200, "column": 11, "offset": 62272 }, - "end": { "line": 2200, "column": 40, "offset": 62301 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 2200, "column": 40, "offset": 62301 }, - "end": { "line": 2200, "column": 48, "offset": 62309 } - } - }, - { - "type": "text", - "value": ", this method will throw a\n", - "position": { - "start": { "line": 2200, "column": 48, "offset": 62309 }, - "end": { "line": 2201, "column": 1, "offset": 62336 } - } - }, - { - "type": "inlineCode", - "value": "TypeError", - "position": { - "start": { "line": 2201, "column": 1, "offset": 62336 }, - "end": { "line": 2201, "column": 12, "offset": 62347 } - } - }, - { - "type": "text", - "value": ". If ", - "position": { - "start": { "line": 2201, "column": 12, "offset": 62347 }, - "end": { "line": 2201, "column": 17, "offset": 62352 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 2201, "column": 17, "offset": 62352 }, - "end": { "line": 2201, "column": 24, "offset": 62359 } - } - }, - { - "type": "text", - "value": " is a number, it will be coerced to a valid byte value,\nan integer between 0 and 255.", - "position": { - "start": { "line": 2201, "column": 24, "offset": 62359 }, - "end": { "line": 2202, "column": 30, "offset": 62444 } - } - } - ], - "position": { - "start": { "line": 2200, "column": 1, "offset": 62262 }, - "end": { "line": 2202, "column": 30, "offset": 62444 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "If ", - "position": { - "start": { "line": 2204, "column": 1, "offset": 62446 }, - "end": { "line": 2204, "column": 4, "offset": 62449 } - } - }, - { - "type": "inlineCode", - "value": "byteOffset", - "position": { - "start": { "line": 2204, "column": 4, "offset": 62449 }, - "end": { "line": 2204, "column": 16, "offset": 62461 } - } - }, - { - "type": "text", - "value": " is not a number, it will be coerced to a number. If the result\nof coercion is ", - "position": { - "start": { "line": 2204, "column": 16, "offset": 62461 }, - "end": { "line": 2205, "column": 16, "offset": 62540 } - } - }, - { - "type": "inlineCode", - "value": "NaN", - "position": { - "start": { "line": 2205, "column": 16, "offset": 62540 }, - "end": { "line": 2205, "column": 21, "offset": 62545 } - } - }, - { - "type": "text", - "value": " or ", - "position": { - "start": { "line": 2205, "column": 21, "offset": 62545 }, - "end": { "line": 2205, "column": 25, "offset": 62549 } - } - }, - { - "type": "inlineCode", - "value": "0", - "position": { - "start": { "line": 2205, "column": 25, "offset": 62549 }, - "end": { "line": 2205, "column": 28, "offset": 62552 } - } - }, - { - "type": "text", - "value": ", then the entire buffer will be searched. This\nbehavior matches ", - "position": { - "start": { "line": 2205, "column": 28, "offset": 62552 }, - "end": { "line": 2206, "column": 18, "offset": 62617 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "String.prototype.indexOf()", - "position": { - "start": { "line": 2206, "column": 19, "offset": 62618 }, - "end": { "line": 2206, "column": 47, "offset": 62646 } - } - } - ], - "position": { - "start": { "line": 2206, "column": 18, "offset": 62617 }, - "end": { "line": 2206, "column": 50, "offset": 62649 } - }, - "label": "`String.prototype.indexOf()`", - "identifier": "`string.prototype.indexof()`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 2206, "column": 50, "offset": 62649 }, - "end": { "line": 2206, "column": 51, "offset": 62650 } - } - } - ], - "position": { - "start": { "line": 2204, "column": 1, "offset": 62446 }, - "end": { "line": 2206, "column": 51, "offset": 62650 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst b = Buffer.from('abcdef');\n\n// Passing a value that's a number, but not a valid byte.\n// Prints: 2, equivalent to searching for 99 or 'c'.\nconsole.log(b.indexOf(99.9));\nconsole.log(b.indexOf(256 + 99));\n\n// Passing a byteOffset that coerces to NaN or 0.\n// Prints: 1, searching the whole buffer.\nconsole.log(b.indexOf('b', undefined));\nconsole.log(b.indexOf('b', {}));\nconsole.log(b.indexOf('b', null));\nconsole.log(b.indexOf('b', []));", - "position": { - "start": { "line": 2208, "column": 1, "offset": 62652 }, - "end": { "line": 2224, "column": 4, "offset": 63144 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst b = Buffer.from('abcdef');\n\n// Passing a value that's a number, but not a valid byte.\n// Prints: 2, equivalent to searching for 99 or 'c'.\nconsole.log(b.indexOf(99.9));\nconsole.log(b.indexOf(256 + 99));\n\n// Passing a byteOffset that coerces to NaN or 0.\n// Prints: 1, searching the whole buffer.\nconsole.log(b.indexOf('b', undefined));\nconsole.log(b.indexOf('b', {}));\nconsole.log(b.indexOf('b', null));\nconsole.log(b.indexOf('b', []));", - "position": { - "start": { "line": 2226, "column": 1, "offset": 63146 }, - "end": { "line": 2242, "column": 4, "offset": 63643 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "If ", - "position": { - "start": { "line": 2244, "column": 1, "offset": 63645 }, - "end": { "line": 2244, "column": 4, "offset": 63648 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 2244, "column": 4, "offset": 63648 }, - "end": { "line": 2244, "column": 11, "offset": 63655 } - } - }, - { - "type": "text", - "value": " is an empty string or empty ", - "position": { - "start": { "line": 2244, "column": 11, "offset": 63655 }, - "end": { "line": 2244, "column": 40, "offset": 63684 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 2244, "column": 40, "offset": 63684 }, - "end": { "line": 2244, "column": 48, "offset": 63692 } - } - }, - { - "type": "text", - "value": " and ", - "position": { - "start": { "line": 2244, "column": 48, "offset": 63692 }, - "end": { "line": 2244, "column": 53, "offset": 63697 } - } - }, - { - "type": "inlineCode", - "value": "byteOffset", - "position": { - "start": { "line": 2244, "column": 53, "offset": 63697 }, - "end": { "line": 2244, "column": 65, "offset": 63709 } - } - }, - { - "type": "text", - "value": " is less\nthan ", - "position": { - "start": { "line": 2244, "column": 65, "offset": 63709 }, - "end": { "line": 2245, "column": 6, "offset": 63723 } - } - }, - { - "type": "inlineCode", - "value": "buf.length", - "position": { - "start": { "line": 2245, "column": 6, "offset": 63723 }, - "end": { "line": 2245, "column": 18, "offset": 63735 } - } - }, - { - "type": "text", - "value": ", ", - "position": { - "start": { "line": 2245, "column": 18, "offset": 63735 }, - "end": { "line": 2245, "column": 20, "offset": 63737 } - } - }, - { - "type": "inlineCode", - "value": "byteOffset", - "position": { - "start": { "line": 2245, "column": 20, "offset": 63737 }, - "end": { "line": 2245, "column": 32, "offset": 63749 } - } - }, - { - "type": "text", - "value": " will be returned. If ", - "position": { - "start": { "line": 2245, "column": 32, "offset": 63749 }, - "end": { "line": 2245, "column": 54, "offset": 63771 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 2245, "column": 54, "offset": 63771 }, - "end": { "line": 2245, "column": 61, "offset": 63778 } - } - }, - { - "type": "text", - "value": " is empty and\n", - "position": { - "start": { "line": 2245, "column": 61, "offset": 63778 }, - "end": { "line": 2246, "column": 1, "offset": 63792 } - } - }, - { - "type": "inlineCode", - "value": "byteOffset", - "position": { - "start": { "line": 2246, "column": 1, "offset": 63792 }, - "end": { "line": 2246, "column": 13, "offset": 63804 } - } - }, - { - "type": "text", - "value": " is at least ", - "position": { - "start": { "line": 2246, "column": 13, "offset": 63804 }, - "end": { "line": 2246, "column": 26, "offset": 63817 } - } - }, - { - "type": "inlineCode", - "value": "buf.length", - "position": { - "start": { "line": 2246, "column": 26, "offset": 63817 }, - "end": { "line": 2246, "column": 38, "offset": 63829 } - } - }, - { - "type": "text", - "value": ", ", - "position": { - "start": { "line": 2246, "column": 38, "offset": 63829 }, - "end": { "line": 2246, "column": 40, "offset": 63831 } - } - }, - { - "type": "inlineCode", - "value": "buf.length", - "position": { - "start": { "line": 2246, "column": 40, "offset": 63831 }, - "end": { "line": 2246, "column": 52, "offset": 63843 } - } - }, - { - "type": "text", - "value": " will be returned.", - "position": { - "start": { "line": 2246, "column": 52, "offset": 63843 }, - "end": { "line": 2246, "column": 70, "offset": 63861 } - } - } - ], - "position": { - "start": { "line": 2244, "column": 1, "offset": 63645 }, - "end": { "line": 2246, "column": 70, "offset": 63861 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.keys()", - "position": { - "start": { "line": 2248, "column": 5, "offset": 63867 }, - "end": { "line": 2248, "column": 17, "offset": 63879 } - } - } - ], - "position": { - "start": { "line": 2248, "column": 1, "offset": 63863 }, - "end": { "line": 2248, "column": 17, "offset": 63879 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 2250, "column": 1, "offset": 63881 }, - "end": { "line": 2252, "column": 4, "offset": 63908 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {Iterator}", - "position": { - "start": { "line": 2254, "column": 3, "offset": 63912 }, - "end": { "line": 2254, "column": 22, "offset": 63931 } - } - } - ], - "position": { - "start": { "line": 2254, "column": 3, "offset": 63912 }, - "end": { "line": 2254, "column": 22, "offset": 63931 } - } - } - ], - "position": { - "start": { "line": 2254, "column": 1, "offset": 63910 }, - "end": { "line": 2254, "column": 22, "offset": 63931 } - } - } - ], - "position": { - "start": { "line": 2254, "column": 1, "offset": 63910 }, - "end": { "line": 2254, "column": 22, "offset": 63931 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Creates and returns an ", - "position": { - "start": { "line": 2256, "column": 1, "offset": 63933 }, - "end": { "line": 2256, "column": 24, "offset": 63956 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "text", - "value": "iterator", - "position": { - "start": { "line": 2256, "column": 25, "offset": 63957 }, - "end": { "line": 2256, "column": 33, "offset": 63965 } - } - } - ], - "position": { - "start": { "line": 2256, "column": 24, "offset": 63956 }, - "end": { "line": 2256, "column": 36, "offset": 63968 } - }, - "label": "iterator", - "identifier": "iterator", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": " of ", - "position": { - "start": { "line": 2256, "column": 36, "offset": 63968 }, - "end": { "line": 2256, "column": 40, "offset": 63972 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 2256, "column": 40, "offset": 63972 }, - "end": { "line": 2256, "column": 45, "offset": 63977 } - } - }, - { - "type": "text", - "value": " keys (indexes).", - "position": { - "start": { "line": 2256, "column": 45, "offset": 63977 }, - "end": { "line": 2256, "column": 61, "offset": 63993 } - } - } - ], - "position": { - "start": { "line": 2256, "column": 1, "offset": 63933 }, - "end": { "line": 2256, "column": 61, "offset": 63993 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from('buffer');\n\nfor (const key of buf.keys()) {\n console.log(key);\n}\n// Prints:\n// 0\n// 1\n// 2\n// 3\n// 4\n// 5", - "position": { - "start": { "line": 2258, "column": 1, "offset": 63995 }, - "end": { "line": 2273, "column": 4, "offset": 64187 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from('buffer');\n\nfor (const key of buf.keys()) {\n console.log(key);\n}\n// Prints:\n// 0\n// 1\n// 2\n// 3\n// 4\n// 5", - "position": { - "start": { "line": 2275, "column": 1, "offset": 64189 }, - "end": { "line": 2290, "column": 4, "offset": 64386 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.lastIndexOf(value[, byteOffset][, encoding])", - "position": { - "start": { "line": 2292, "column": 5, "offset": 64392 }, - "end": { "line": 2292, "column": 55, "offset": 64442 } - } - } - ], - "position": { - "start": { "line": 2292, "column": 1, "offset": 64388 }, - "end": { "line": 2292, "column": 55, "offset": 64442 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 2294, "column": 1, "offset": 64444 }, - "end": { "line": 2300, "column": 4, "offset": 64610 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 2302, "column": 3, "offset": 64614 }, - "end": { "line": 2302, "column": 10, "offset": 64621 } - } - }, - { - "type": "text", - "value": " {string|Buffer|Uint8Array|integer} What to search for.", - "position": { - "start": { "line": 2302, "column": 10, "offset": 64621 }, - "end": { "line": 2302, "column": 65, "offset": 64676 } - } - } - ], - "position": { - "start": { "line": 2302, "column": 3, "offset": 64614 }, - "end": { "line": 2302, "column": 65, "offset": 64676 } - } - } - ], - "position": { - "start": { "line": 2302, "column": 1, "offset": 64612 }, - "end": { "line": 2302, "column": 65, "offset": 64676 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "byteOffset", - "position": { - "start": { "line": 2303, "column": 3, "offset": 64679 }, - "end": { "line": 2303, "column": 15, "offset": 64691 } - } - }, - { - "type": "text", - "value": " {integer} Where to begin searching in ", - "position": { - "start": { "line": 2303, "column": 15, "offset": 64691 }, - "end": { "line": 2303, "column": 54, "offset": 64730 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 2303, "column": 54, "offset": 64730 }, - "end": { "line": 2303, "column": 59, "offset": 64735 } - } - }, - { - "type": "text", - "value": ". If negative, then\noffset is calculated from the end of ", - "position": { - "start": { "line": 2303, "column": 59, "offset": 64735 }, - "end": { "line": 2304, "column": 40, "offset": 64794 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 2304, "column": 40, "offset": 64794 }, - "end": { "line": 2304, "column": 45, "offset": 64799 } - } - }, - { - "type": "text", - "value": ". ", - "position": { - "start": { "line": 2304, "column": 45, "offset": 64799 }, - "end": { "line": 2304, "column": 47, "offset": 64801 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { - "line": 2304, - "column": 49, - "offset": 64803 - }, - "end": { "line": 2304, "column": 57, "offset": 64811 } - } - } - ], - "position": { - "start": { "line": 2304, "column": 47, "offset": 64801 }, - "end": { "line": 2304, "column": 59, "offset": 64813 } - } - }, - { - "type": "text", - "value": "\n", - "position": { - "start": { "line": 2304, "column": 59, "offset": 64813 }, - "end": { "line": 2305, "column": 1, "offset": 64814 } - } - }, - { - "type": "inlineCode", - "value": "buf.length - 1", - "position": { - "start": { "line": 2305, "column": 3, "offset": 64816 }, - "end": { "line": 2305, "column": 19, "offset": 64832 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 2305, "column": 19, "offset": 64832 }, - "end": { "line": 2305, "column": 20, "offset": 64833 } - } - } - ], - "position": { - "start": { "line": 2303, "column": 3, "offset": 64679 }, - "end": { "line": 2305, "column": 20, "offset": 64833 } - } - } - ], - "position": { - "start": { "line": 2303, "column": 1, "offset": 64677 }, - "end": { "line": 2305, "column": 20, "offset": 64833 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "encoding", - "position": { - "start": { "line": 2306, "column": 3, "offset": 64836 }, - "end": { "line": 2306, "column": 13, "offset": 64846 } - } - }, - { - "type": "text", - "value": " {string} If ", - "position": { - "start": { "line": 2306, "column": 13, "offset": 64846 }, - "end": { "line": 2306, "column": 26, "offset": 64859 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 2306, "column": 26, "offset": 64859 }, - "end": { "line": 2306, "column": 33, "offset": 64866 } - } - }, - { - "type": "text", - "value": " is a string, this is the encoding used to\ndetermine the binary representation of the string that will be searched for in\n", - "position": { - "start": { "line": 2306, "column": 33, "offset": 64866 }, - "end": { "line": 2308, "column": 1, "offset": 64990 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 2308, "column": 3, "offset": 64992 }, - "end": { "line": 2308, "column": 8, "offset": 64997 } - } - }, - { - "type": "text", - "value": ". ", - "position": { - "start": { "line": 2308, "column": 8, "offset": 64997 }, - "end": { "line": 2308, "column": 10, "offset": 64999 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { - "line": 2308, - "column": 12, - "offset": 65001 - }, - "end": { "line": 2308, "column": 20, "offset": 65009 } - } - } - ], - "position": { - "start": { "line": 2308, "column": 10, "offset": 64999 }, - "end": { "line": 2308, "column": 22, "offset": 65011 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 2308, "column": 22, "offset": 65011 }, - "end": { "line": 2308, "column": 23, "offset": 65012 } - } - }, - { - "type": "inlineCode", - "value": "'utf8'", - "position": { - "start": { "line": 2308, "column": 23, "offset": 65012 }, - "end": { "line": 2308, "column": 31, "offset": 65020 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 2308, "column": 31, "offset": 65020 }, - "end": { "line": 2308, "column": 32, "offset": 65021 } - } - } - ], - "position": { - "start": { "line": 2306, "column": 3, "offset": 64836 }, - "end": { "line": 2308, "column": 32, "offset": 65021 } - } - } - ], - "position": { - "start": { "line": 2306, "column": 1, "offset": 64834 }, - "end": { "line": 2308, "column": 32, "offset": 65021 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {integer} The index of the last occurrence of ", - "position": { - "start": { "line": 2309, "column": 3, "offset": 65024 }, - "end": { "line": 2309, "column": 58, "offset": 65079 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 2309, "column": 58, "offset": 65079 }, - "end": { "line": 2309, "column": 65, "offset": 65086 } - } - }, - { - "type": "text", - "value": " in ", - "position": { - "start": { "line": 2309, "column": 65, "offset": 65086 }, - "end": { "line": 2309, "column": 69, "offset": 65090 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 2309, "column": 69, "offset": 65090 }, - "end": { "line": 2309, "column": 74, "offset": 65095 } - } - }, - { - "type": "text", - "value": ", or\n", - "position": { - "start": { "line": 2309, "column": 74, "offset": 65095 }, - "end": { "line": 2310, "column": 1, "offset": 65100 } - } - }, - { - "type": "inlineCode", - "value": "-1", - "position": { - "start": { "line": 2310, "column": 3, "offset": 65102 }, - "end": { "line": 2310, "column": 7, "offset": 65106 } - } - }, - { - "type": "text", - "value": " if ", - "position": { - "start": { "line": 2310, "column": 7, "offset": 65106 }, - "end": { "line": 2310, "column": 11, "offset": 65110 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 2310, "column": 11, "offset": 65110 }, - "end": { "line": 2310, "column": 16, "offset": 65115 } - } - }, - { - "type": "text", - "value": " does not contain ", - "position": { - "start": { "line": 2310, "column": 16, "offset": 65115 }, - "end": { "line": 2310, "column": 34, "offset": 65133 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 2310, "column": 34, "offset": 65133 }, - "end": { "line": 2310, "column": 41, "offset": 65140 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 2310, "column": 41, "offset": 65140 }, - "end": { "line": 2310, "column": 42, "offset": 65141 } - } - } - ], - "position": { - "start": { "line": 2309, "column": 3, "offset": 65024 }, - "end": { "line": 2310, "column": 42, "offset": 65141 } - } - } - ], - "position": { - "start": { "line": 2309, "column": 1, "offset": 65022 }, - "end": { "line": 2310, "column": 42, "offset": 65141 } - } - } - ], - "position": { - "start": { "line": 2302, "column": 1, "offset": 64612 }, - "end": { "line": 2310, "column": 42, "offset": 65141 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Identical to ", - "position": { - "start": { "line": 2312, "column": 1, "offset": 65143 }, - "end": { "line": 2312, "column": 14, "offset": 65156 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "buf.indexOf()", - "position": { - "start": { "line": 2312, "column": 15, "offset": 65157 }, - "end": { "line": 2312, "column": 30, "offset": 65172 } - } - } - ], - "position": { - "start": { "line": 2312, "column": 14, "offset": 65156 }, - "end": { "line": 2312, "column": 33, "offset": 65175 } - }, - "label": "`buf.indexOf()`", - "identifier": "`buf.indexof()`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": ", except the last occurrence of ", - "position": { - "start": { "line": 2312, "column": 33, "offset": 65175 }, - "end": { "line": 2312, "column": 65, "offset": 65207 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 2312, "column": 65, "offset": 65207 }, - "end": { "line": 2312, "column": 72, "offset": 65214 } - } - }, - { - "type": "text", - "value": " is found\nrather than the first occurrence.", - "position": { - "start": { "line": 2312, "column": 72, "offset": 65214 }, - "end": { "line": 2313, "column": 34, "offset": 65257 } - } - } - ], - "position": { - "start": { "line": 2312, "column": 1, "offset": 65143 }, - "end": { "line": 2313, "column": 34, "offset": 65257 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from('this buffer is a buffer');\n\nconsole.log(buf.lastIndexOf('this'));\n// Prints: 0\nconsole.log(buf.lastIndexOf('buffer'));\n// Prints: 17\nconsole.log(buf.lastIndexOf(Buffer.from('buffer')));\n// Prints: 17\nconsole.log(buf.lastIndexOf(97));\n// Prints: 15 (97 is the decimal ASCII value for 'a')\nconsole.log(buf.lastIndexOf(Buffer.from('yolo')));\n// Prints: -1\nconsole.log(buf.lastIndexOf('buffer', 5));\n// Prints: 5\nconsole.log(buf.lastIndexOf('buffer', 4));\n// Prints: -1\n\nconst utf16Buffer = Buffer.from('\\u039a\\u0391\\u03a3\\u03a3\\u0395', 'utf16le');\n\nconsole.log(utf16Buffer.lastIndexOf('\\u03a3', undefined, 'utf16le'));\n// Prints: 6\nconsole.log(utf16Buffer.lastIndexOf('\\u03a3', -5, 'utf16le'));\n// Prints: 4", - "position": { - "start": { "line": 2315, "column": 1, "offset": 65259 }, - "end": { "line": 2341, "column": 4, "offset": 66038 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from('this buffer is a buffer');\n\nconsole.log(buf.lastIndexOf('this'));\n// Prints: 0\nconsole.log(buf.lastIndexOf('buffer'));\n// Prints: 17\nconsole.log(buf.lastIndexOf(Buffer.from('buffer')));\n// Prints: 17\nconsole.log(buf.lastIndexOf(97));\n// Prints: 15 (97 is the decimal ASCII value for 'a')\nconsole.log(buf.lastIndexOf(Buffer.from('yolo')));\n// Prints: -1\nconsole.log(buf.lastIndexOf('buffer', 5));\n// Prints: 5\nconsole.log(buf.lastIndexOf('buffer', 4));\n// Prints: -1\n\nconst utf16Buffer = Buffer.from('\\u039a\\u0391\\u03a3\\u03a3\\u0395', 'utf16le');\n\nconsole.log(utf16Buffer.lastIndexOf('\\u03a3', undefined, 'utf16le'));\n// Prints: 6\nconsole.log(utf16Buffer.lastIndexOf('\\u03a3', -5, 'utf16le'));\n// Prints: 4", - "position": { - "start": { "line": 2343, "column": 1, "offset": 66040 }, - "end": { "line": 2369, "column": 4, "offset": 66824 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "If ", - "position": { - "start": { "line": 2371, "column": 1, "offset": 66826 }, - "end": { "line": 2371, "column": 4, "offset": 66829 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 2371, "column": 4, "offset": 66829 }, - "end": { "line": 2371, "column": 11, "offset": 66836 } - } - }, - { - "type": "text", - "value": " is not a string, number, or ", - "position": { - "start": { "line": 2371, "column": 11, "offset": 66836 }, - "end": { "line": 2371, "column": 40, "offset": 66865 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 2371, "column": 40, "offset": 66865 }, - "end": { "line": 2371, "column": 48, "offset": 66873 } - } - }, - { - "type": "text", - "value": ", this method will throw a\n", - "position": { - "start": { "line": 2371, "column": 48, "offset": 66873 }, - "end": { "line": 2372, "column": 1, "offset": 66900 } - } - }, - { - "type": "inlineCode", - "value": "TypeError", - "position": { - "start": { "line": 2372, "column": 1, "offset": 66900 }, - "end": { "line": 2372, "column": 12, "offset": 66911 } - } - }, - { - "type": "text", - "value": ". If ", - "position": { - "start": { "line": 2372, "column": 12, "offset": 66911 }, - "end": { "line": 2372, "column": 17, "offset": 66916 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 2372, "column": 17, "offset": 66916 }, - "end": { "line": 2372, "column": 24, "offset": 66923 } - } - }, - { - "type": "text", - "value": " is a number, it will be coerced to a valid byte value,\nan integer between 0 and 255.", - "position": { - "start": { "line": 2372, "column": 24, "offset": 66923 }, - "end": { "line": 2373, "column": 30, "offset": 67008 } - } - } - ], - "position": { - "start": { "line": 2371, "column": 1, "offset": 66826 }, - "end": { "line": 2373, "column": 30, "offset": 67008 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "If ", - "position": { - "start": { "line": 2375, "column": 1, "offset": 67010 }, - "end": { "line": 2375, "column": 4, "offset": 67013 } - } - }, - { - "type": "inlineCode", - "value": "byteOffset", - "position": { - "start": { "line": 2375, "column": 4, "offset": 67013 }, - "end": { "line": 2375, "column": 16, "offset": 67025 } - } - }, - { - "type": "text", - "value": " is not a number, it will be coerced to a number. Any arguments\nthat coerce to ", - "position": { - "start": { "line": 2375, "column": 16, "offset": 67025 }, - "end": { "line": 2376, "column": 16, "offset": 67104 } - } - }, - { - "type": "inlineCode", - "value": "NaN", - "position": { - "start": { "line": 2376, "column": 16, "offset": 67104 }, - "end": { "line": 2376, "column": 21, "offset": 67109 } - } - }, - { - "type": "text", - "value": ", like ", - "position": { - "start": { "line": 2376, "column": 21, "offset": 67109 }, - "end": { "line": 2376, "column": 28, "offset": 67116 } - } - }, - { - "type": "inlineCode", - "value": "{}", - "position": { - "start": { "line": 2376, "column": 28, "offset": 67116 }, - "end": { "line": 2376, "column": 32, "offset": 67120 } - } - }, - { - "type": "text", - "value": " or ", - "position": { - "start": { "line": 2376, "column": 32, "offset": 67120 }, - "end": { "line": 2376, "column": 36, "offset": 67124 } - } - }, - { - "type": "inlineCode", - "value": "undefined", - "position": { - "start": { "line": 2376, "column": 36, "offset": 67124 }, - "end": { "line": 2376, "column": 47, "offset": 67135 } - } - }, - { - "type": "text", - "value": ", will search the whole buffer.\nThis behavior matches ", - "position": { - "start": { "line": 2376, "column": 47, "offset": 67135 }, - "end": { "line": 2377, "column": 23, "offset": 67189 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "String.prototype.lastIndexOf()", - "position": { - "start": { "line": 2377, "column": 24, "offset": 67190 }, - "end": { "line": 2377, "column": 56, "offset": 67222 } - } - } - ], - "position": { - "start": { "line": 2377, "column": 23, "offset": 67189 }, - "end": { "line": 2377, "column": 59, "offset": 67225 } - }, - "label": "`String.prototype.lastIndexOf()`", - "identifier": "`string.prototype.lastindexof()`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 2377, "column": 59, "offset": 67225 }, - "end": { "line": 2377, "column": 60, "offset": 67226 } - } - } - ], - "position": { - "start": { "line": 2375, "column": 1, "offset": 67010 }, - "end": { "line": 2377, "column": 60, "offset": 67226 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst b = Buffer.from('abcdef');\n\n// Passing a value that's a number, but not a valid byte.\n// Prints: 2, equivalent to searching for 99 or 'c'.\nconsole.log(b.lastIndexOf(99.9));\nconsole.log(b.lastIndexOf(256 + 99));\n\n// Passing a byteOffset that coerces to NaN.\n// Prints: 1, searching the whole buffer.\nconsole.log(b.lastIndexOf('b', undefined));\nconsole.log(b.lastIndexOf('b', {}));\n\n// Passing a byteOffset that coerces to 0.\n// Prints: -1, equivalent to passing 0.\nconsole.log(b.lastIndexOf('b', null));\nconsole.log(b.lastIndexOf('b', []));", - "position": { - "start": { "line": 2379, "column": 1, "offset": 67228 }, - "end": { "line": 2398, "column": 4, "offset": 67823 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst b = Buffer.from('abcdef');\n\n// Passing a value that's a number, but not a valid byte.\n// Prints: 2, equivalent to searching for 99 or 'c'.\nconsole.log(b.lastIndexOf(99.9));\nconsole.log(b.lastIndexOf(256 + 99));\n\n// Passing a byteOffset that coerces to NaN.\n// Prints: 1, searching the whole buffer.\nconsole.log(b.lastIndexOf('b', undefined));\nconsole.log(b.lastIndexOf('b', {}));\n\n// Passing a byteOffset that coerces to 0.\n// Prints: -1, equivalent to passing 0.\nconsole.log(b.lastIndexOf('b', null));\nconsole.log(b.lastIndexOf('b', []));", - "position": { - "start": { "line": 2400, "column": 1, "offset": 67825 }, - "end": { "line": 2419, "column": 4, "offset": 68425 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "If ", - "position": { - "start": { "line": 2421, "column": 1, "offset": 68427 }, - "end": { "line": 2421, "column": 4, "offset": 68430 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 2421, "column": 4, "offset": 68430 }, - "end": { "line": 2421, "column": 11, "offset": 68437 } - } - }, - { - "type": "text", - "value": " is an empty string or empty ", - "position": { - "start": { "line": 2421, "column": 11, "offset": 68437 }, - "end": { "line": 2421, "column": 40, "offset": 68466 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 2421, "column": 40, "offset": 68466 }, - "end": { "line": 2421, "column": 48, "offset": 68474 } - } - }, - { - "type": "text", - "value": ", ", - "position": { - "start": { "line": 2421, "column": 48, "offset": 68474 }, - "end": { "line": 2421, "column": 50, "offset": 68476 } - } - }, - { - "type": "inlineCode", - "value": "byteOffset", - "position": { - "start": { "line": 2421, "column": 50, "offset": 68476 }, - "end": { "line": 2421, "column": 62, "offset": 68488 } - } - }, - { - "type": "text", - "value": " will be returned.", - "position": { - "start": { "line": 2421, "column": 62, "offset": 68488 }, - "end": { "line": 2421, "column": 80, "offset": 68506 } - } - } - ], - "position": { - "start": { "line": 2421, "column": 1, "offset": 68427 }, - "end": { "line": 2421, "column": 80, "offset": 68506 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.length", - "position": { - "start": { "line": 2423, "column": 5, "offset": 68512 }, - "end": { "line": 2423, "column": 17, "offset": 68524 } - } - } - ], - "position": { - "start": { "line": 2423, "column": 1, "offset": 68508 }, - "end": { "line": 2423, "column": 17, "offset": 68524 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 2425, "column": 1, "offset": 68526 }, - "end": { "line": 2427, "column": 4, "offset": 68554 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "{integer}", - "position": { - "start": { "line": 2429, "column": 3, "offset": 68558 }, - "end": { "line": 2429, "column": 12, "offset": 68567 } - } - } - ], - "position": { - "start": { "line": 2429, "column": 3, "offset": 68558 }, - "end": { "line": 2429, "column": 12, "offset": 68567 } - } - } - ], - "position": { - "start": { "line": 2429, "column": 1, "offset": 68556 }, - "end": { "line": 2429, "column": 12, "offset": 68567 } - } - } - ], - "position": { - "start": { "line": 2429, "column": 1, "offset": 68556 }, - "end": { "line": 2429, "column": 12, "offset": 68567 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns the number of bytes in ", - "position": { - "start": { "line": 2431, "column": 1, "offset": 68569 }, - "end": { "line": 2431, "column": 32, "offset": 68600 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 2431, "column": 32, "offset": 68600 }, - "end": { "line": 2431, "column": 37, "offset": 68605 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 2431, "column": 37, "offset": 68605 }, - "end": { "line": 2431, "column": 38, "offset": 68606 } - } - } - ], - "position": { - "start": { "line": 2431, "column": 1, "offset": 68569 }, - "end": { "line": 2431, "column": 38, "offset": 68606 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\n// Create a `Buffer` and write a shorter string to it using UTF-8.\n\nconst buf = Buffer.alloc(1234);\n\nconsole.log(buf.length);\n// Prints: 1234\n\nbuf.write('some string', 0, 'utf8');\n\nconsole.log(buf.length);\n// Prints: 1234", - "position": { - "start": { "line": 2433, "column": 1, "offset": 68608 }, - "end": { "line": 2447, "column": 4, "offset": 68879 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\n// Create a `Buffer` and write a shorter string to it using UTF-8.\n\nconst buf = Buffer.alloc(1234);\n\nconsole.log(buf.length);\n// Prints: 1234\n\nbuf.write('some string', 0, 'utf8');\n\nconsole.log(buf.length);\n// Prints: 1234", - "position": { - "start": { "line": 2449, "column": 1, "offset": 68881 }, - "end": { "line": 2463, "column": 4, "offset": 69157 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.parent", - "position": { - "start": { "line": 2465, "column": 5, "offset": 69163 }, - "end": { "line": 2465, "column": 17, "offset": 69175 } - } - } - ], - "position": { - "start": { "line": 2465, "column": 1, "offset": 69159 }, - "end": { "line": 2465, "column": 17, "offset": 69175 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 2467, "column": 1, "offset": 69177 }, - "end": { "line": 2469, "column": 4, "offset": 69209 } - } - }, - { - "type": "blockquote", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Stability: 0 - Deprecated: Use ", - "position": { - "start": { "line": 2471, "column": 3, "offset": 69213 }, - "end": { "line": 2471, "column": 34, "offset": 69244 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "buf.buffer", - "position": { - "start": { "line": 2471, "column": 35, "offset": 69245 }, - "end": { "line": 2471, "column": 47, "offset": 69257 } - } - } - ], - "position": { - "start": { "line": 2471, "column": 34, "offset": 69244 }, - "end": { "line": 2471, "column": 50, "offset": 69260 } - }, - "label": "`buf.buffer`", - "identifier": "`buf.buffer`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": " instead.", - "position": { - "start": { "line": 2471, "column": 50, "offset": 69260 }, - "end": { "line": 2471, "column": 59, "offset": 69269 } - } - } - ], - "position": { - "start": { "line": 2471, "column": 3, "offset": 69213 }, - "end": { "line": 2471, "column": 59, "offset": 69269 } - } - } - ], - "position": { - "start": { "line": 2471, "column": 1, "offset": 69211 }, - "end": { "line": 2471, "column": 59, "offset": 69269 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The ", - "position": { - "start": { "line": 2473, "column": 1, "offset": 69271 }, - "end": { "line": 2473, "column": 5, "offset": 69275 } - } - }, - { - "type": "inlineCode", - "value": "buf.parent", - "position": { - "start": { "line": 2473, "column": 5, "offset": 69275 }, - "end": { "line": 2473, "column": 17, "offset": 69287 } - } - }, - { - "type": "text", - "value": " property is a deprecated alias for ", - "position": { - "start": { "line": 2473, "column": 17, "offset": 69287 }, - "end": { "line": 2473, "column": 53, "offset": 69323 } - } - }, - { - "type": "inlineCode", - "value": "buf.buffer", - "position": { - "start": { "line": 2473, "column": 53, "offset": 69323 }, - "end": { "line": 2473, "column": 65, "offset": 69335 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 2473, "column": 65, "offset": 69335 }, - "end": { "line": 2473, "column": 66, "offset": 69336 } - } - } - ], - "position": { - "start": { "line": 2473, "column": 1, "offset": 69271 }, - "end": { "line": 2473, "column": 66, "offset": 69336 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.readBigInt64BE([offset])", - "position": { - "start": { "line": 2475, "column": 5, "offset": 69342 }, - "end": { "line": 2475, "column": 35, "offset": 69372 } - } - } - ], - "position": { - "start": { "line": 2475, "column": 1, "offset": 69338 }, - "end": { "line": 2475, "column": 35, "offset": 69372 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 2477, "column": 1, "offset": 69374 }, - "end": { "line": 2481, "column": 4, "offset": 69417 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 2483, "column": 3, "offset": 69421 }, - "end": { "line": 2483, "column": 11, "offset": 69429 } - } - }, - { - "type": "text", - "value": " {integer} Number of bytes to skip before starting to read. Must\nsatisfy: ", - "position": { - "start": { "line": 2483, "column": 11, "offset": 69429 }, - "end": { "line": 2484, "column": 12, "offset": 69505 } - } - }, - { - "type": "inlineCode", - "value": "0 <= offset <= buf.length - 8", - "position": { - "start": { "line": 2484, "column": 12, "offset": 69505 }, - "end": { "line": 2484, "column": 43, "offset": 69536 } - } - }, - { - "type": "text", - "value": ". ", - "position": { - "start": { "line": 2484, "column": 43, "offset": 69536 }, - "end": { "line": 2484, "column": 45, "offset": 69538 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { - "line": 2484, - "column": 47, - "offset": 69540 - }, - "end": { "line": 2484, "column": 55, "offset": 69548 } - } - } - ], - "position": { - "start": { "line": 2484, "column": 45, "offset": 69538 }, - "end": { "line": 2484, "column": 57, "offset": 69550 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 2484, "column": 57, "offset": 69550 }, - "end": { "line": 2484, "column": 58, "offset": 69551 } - } - }, - { - "type": "inlineCode", - "value": "0", - "position": { - "start": { "line": 2484, "column": 58, "offset": 69551 }, - "end": { "line": 2484, "column": 61, "offset": 69554 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 2484, "column": 61, "offset": 69554 }, - "end": { "line": 2484, "column": 62, "offset": 69555 } - } - } - ], - "position": { - "start": { "line": 2483, "column": 3, "offset": 69421 }, - "end": { "line": 2484, "column": 62, "offset": 69555 } - } - } - ], - "position": { - "start": { "line": 2483, "column": 1, "offset": 69419 }, - "end": { "line": 2484, "column": 62, "offset": 69555 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {bigint}", - "position": { - "start": { "line": 2485, "column": 3, "offset": 69558 }, - "end": { "line": 2485, "column": 20, "offset": 69575 } - } - } - ], - "position": { - "start": { "line": 2485, "column": 3, "offset": 69558 }, - "end": { "line": 2485, "column": 20, "offset": 69575 } - } - } - ], - "position": { - "start": { "line": 2485, "column": 1, "offset": 69556 }, - "end": { "line": 2485, "column": 20, "offset": 69575 } - } - } - ], - "position": { - "start": { "line": 2483, "column": 1, "offset": 69419 }, - "end": { "line": 2485, "column": 20, "offset": 69575 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Reads a signed, big-endian 64-bit integer from ", - "position": { - "start": { "line": 2487, "column": 1, "offset": 69577 }, - "end": { "line": 2487, "column": 48, "offset": 69624 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 2487, "column": 48, "offset": 69624 }, - "end": { "line": 2487, "column": 53, "offset": 69629 } - } - }, - { - "type": "text", - "value": " at the specified ", - "position": { - "start": { "line": 2487, "column": 53, "offset": 69629 }, - "end": { "line": 2487, "column": 71, "offset": 69647 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 2487, "column": 71, "offset": 69647 }, - "end": { "line": 2487, "column": 79, "offset": 69655 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 2487, "column": 79, "offset": 69655 }, - "end": { "line": 2487, "column": 80, "offset": 69656 } - } - } - ], - "position": { - "start": { "line": 2487, "column": 1, "offset": 69577 }, - "end": { "line": 2487, "column": 80, "offset": 69656 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Integers read from a ", - "position": { - "start": { "line": 2489, "column": 1, "offset": 69658 }, - "end": { "line": 2489, "column": 22, "offset": 69679 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 2489, "column": 22, "offset": 69679 }, - "end": { "line": 2489, "column": 30, "offset": 69687 } - } - }, - { - "type": "text", - "value": " are interpreted as two's complement signed\nvalues.", - "position": { - "start": { "line": 2489, "column": 30, "offset": 69687 }, - "end": { "line": 2490, "column": 8, "offset": 69738 } - } - } - ], - "position": { - "start": { "line": 2489, "column": 1, "offset": 69658 }, - "end": { "line": 2490, "column": 8, "offset": 69738 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.readBigInt64LE([offset])", - "position": { - "start": { "line": 2492, "column": 5, "offset": 69744 }, - "end": { "line": 2492, "column": 35, "offset": 69774 } - } - } - ], - "position": { - "start": { "line": 2492, "column": 1, "offset": 69740 }, - "end": { "line": 2492, "column": 35, "offset": 69774 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 2494, "column": 1, "offset": 69776 }, - "end": { "line": 2498, "column": 4, "offset": 69819 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 2500, "column": 3, "offset": 69823 }, - "end": { "line": 2500, "column": 11, "offset": 69831 } - } - }, - { - "type": "text", - "value": " {integer} Number of bytes to skip before starting to read. Must\nsatisfy: ", - "position": { - "start": { "line": 2500, "column": 11, "offset": 69831 }, - "end": { "line": 2501, "column": 12, "offset": 69907 } - } - }, - { - "type": "inlineCode", - "value": "0 <= offset <= buf.length - 8", - "position": { - "start": { "line": 2501, "column": 12, "offset": 69907 }, - "end": { "line": 2501, "column": 43, "offset": 69938 } - } - }, - { - "type": "text", - "value": ". ", - "position": { - "start": { "line": 2501, "column": 43, "offset": 69938 }, - "end": { "line": 2501, "column": 45, "offset": 69940 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { - "line": 2501, - "column": 47, - "offset": 69942 - }, - "end": { "line": 2501, "column": 55, "offset": 69950 } - } - } - ], - "position": { - "start": { "line": 2501, "column": 45, "offset": 69940 }, - "end": { "line": 2501, "column": 57, "offset": 69952 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 2501, "column": 57, "offset": 69952 }, - "end": { "line": 2501, "column": 58, "offset": 69953 } - } - }, - { - "type": "inlineCode", - "value": "0", - "position": { - "start": { "line": 2501, "column": 58, "offset": 69953 }, - "end": { "line": 2501, "column": 61, "offset": 69956 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 2501, "column": 61, "offset": 69956 }, - "end": { "line": 2501, "column": 62, "offset": 69957 } - } - } - ], - "position": { - "start": { "line": 2500, "column": 3, "offset": 69823 }, - "end": { "line": 2501, "column": 62, "offset": 69957 } - } - } - ], - "position": { - "start": { "line": 2500, "column": 1, "offset": 69821 }, - "end": { "line": 2501, "column": 62, "offset": 69957 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {bigint}", - "position": { - "start": { "line": 2502, "column": 3, "offset": 69960 }, - "end": { "line": 2502, "column": 20, "offset": 69977 } - } - } - ], - "position": { - "start": { "line": 2502, "column": 3, "offset": 69960 }, - "end": { "line": 2502, "column": 20, "offset": 69977 } - } - } - ], - "position": { - "start": { "line": 2502, "column": 1, "offset": 69958 }, - "end": { "line": 2502, "column": 20, "offset": 69977 } - } - } - ], - "position": { - "start": { "line": 2500, "column": 1, "offset": 69821 }, - "end": { "line": 2502, "column": 20, "offset": 69977 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Reads a signed, little-endian 64-bit integer from ", - "position": { - "start": { "line": 2504, "column": 1, "offset": 69979 }, - "end": { "line": 2504, "column": 51, "offset": 70029 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 2504, "column": 51, "offset": 70029 }, - "end": { "line": 2504, "column": 56, "offset": 70034 } - } - }, - { - "type": "text", - "value": " at the specified\n", - "position": { - "start": { "line": 2504, "column": 56, "offset": 70034 }, - "end": { "line": 2505, "column": 1, "offset": 70052 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 2505, "column": 1, "offset": 70052 }, - "end": { "line": 2505, "column": 9, "offset": 70060 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 2505, "column": 9, "offset": 70060 }, - "end": { "line": 2505, "column": 10, "offset": 70061 } - } - } - ], - "position": { - "start": { "line": 2504, "column": 1, "offset": 69979 }, - "end": { "line": 2505, "column": 10, "offset": 70061 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Integers read from a ", - "position": { - "start": { "line": 2507, "column": 1, "offset": 70063 }, - "end": { "line": 2507, "column": 22, "offset": 70084 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 2507, "column": 22, "offset": 70084 }, - "end": { "line": 2507, "column": 30, "offset": 70092 } - } - }, - { - "type": "text", - "value": " are interpreted as two's complement signed\nvalues.", - "position": { - "start": { "line": 2507, "column": 30, "offset": 70092 }, - "end": { "line": 2508, "column": 8, "offset": 70143 } - } - } - ], - "position": { - "start": { "line": 2507, "column": 1, "offset": 70063 }, - "end": { "line": 2508, "column": 8, "offset": 70143 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.readBigUInt64BE([offset])", - "position": { - "start": { "line": 2510, "column": 5, "offset": 70149 }, - "end": { "line": 2510, "column": 36, "offset": 70180 } - } - } - ], - "position": { - "start": { "line": 2510, "column": 1, "offset": 70145 }, - "end": { "line": 2510, "column": 36, "offset": 70180 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 2512, "column": 1, "offset": 70182 }, - "end": { "line": 2522, "column": 4, "offset": 70408 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 2524, "column": 3, "offset": 70412 }, - "end": { "line": 2524, "column": 11, "offset": 70420 } - } - }, - { - "type": "text", - "value": " {integer} Number of bytes to skip before starting to read. Must\nsatisfy: ", - "position": { - "start": { "line": 2524, "column": 11, "offset": 70420 }, - "end": { "line": 2525, "column": 12, "offset": 70496 } - } - }, - { - "type": "inlineCode", - "value": "0 <= offset <= buf.length - 8", - "position": { - "start": { "line": 2525, "column": 12, "offset": 70496 }, - "end": { "line": 2525, "column": 43, "offset": 70527 } - } - }, - { - "type": "text", - "value": ". ", - "position": { - "start": { "line": 2525, "column": 43, "offset": 70527 }, - "end": { "line": 2525, "column": 45, "offset": 70529 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { - "line": 2525, - "column": 47, - "offset": 70531 - }, - "end": { "line": 2525, "column": 55, "offset": 70539 } - } - } - ], - "position": { - "start": { "line": 2525, "column": 45, "offset": 70529 }, - "end": { "line": 2525, "column": 57, "offset": 70541 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 2525, "column": 57, "offset": 70541 }, - "end": { "line": 2525, "column": 58, "offset": 70542 } - } - }, - { - "type": "inlineCode", - "value": "0", - "position": { - "start": { "line": 2525, "column": 58, "offset": 70542 }, - "end": { "line": 2525, "column": 61, "offset": 70545 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 2525, "column": 61, "offset": 70545 }, - "end": { "line": 2525, "column": 62, "offset": 70546 } - } - } - ], - "position": { - "start": { "line": 2524, "column": 3, "offset": 70412 }, - "end": { "line": 2525, "column": 62, "offset": 70546 } - } - } - ], - "position": { - "start": { "line": 2524, "column": 1, "offset": 70410 }, - "end": { "line": 2525, "column": 62, "offset": 70546 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {bigint}", - "position": { - "start": { "line": 2526, "column": 3, "offset": 70549 }, - "end": { "line": 2526, "column": 20, "offset": 70566 } - } - } - ], - "position": { - "start": { "line": 2526, "column": 3, "offset": 70549 }, - "end": { "line": 2526, "column": 20, "offset": 70566 } - } - } - ], - "position": { - "start": { "line": 2526, "column": 1, "offset": 70547 }, - "end": { "line": 2526, "column": 20, "offset": 70566 } - } - } - ], - "position": { - "start": { "line": 2524, "column": 1, "offset": 70410 }, - "end": { "line": 2526, "column": 20, "offset": 70566 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Reads an unsigned, big-endian 64-bit integer from ", - "position": { - "start": { "line": 2528, "column": 1, "offset": 70568 }, - "end": { "line": 2528, "column": 51, "offset": 70618 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 2528, "column": 51, "offset": 70618 }, - "end": { "line": 2528, "column": 56, "offset": 70623 } - } - }, - { - "type": "text", - "value": " at the specified\n", - "position": { - "start": { "line": 2528, "column": 56, "offset": 70623 }, - "end": { "line": 2529, "column": 1, "offset": 70641 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 2529, "column": 1, "offset": 70641 }, - "end": { "line": 2529, "column": 9, "offset": 70649 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 2529, "column": 9, "offset": 70649 }, - "end": { "line": 2529, "column": 10, "offset": 70650 } - } - } - ], - "position": { - "start": { "line": 2528, "column": 1, "offset": 70568 }, - "end": { "line": 2529, "column": 10, "offset": 70650 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This function is also available under the ", - "position": { - "start": { "line": 2531, "column": 1, "offset": 70652 }, - "end": { "line": 2531, "column": 43, "offset": 70694 } - } - }, - { - "type": "inlineCode", - "value": "readBigUint64BE", - "position": { - "start": { "line": 2531, "column": 43, "offset": 70694 }, - "end": { "line": 2531, "column": 60, "offset": 70711 } - } - }, - { - "type": "text", - "value": " alias.", - "position": { - "start": { "line": 2531, "column": 60, "offset": 70711 }, - "end": { "line": 2531, "column": 67, "offset": 70718 } - } - } - ], - "position": { - "start": { "line": 2531, "column": 1, "offset": 70652 }, - "end": { "line": 2531, "column": 67, "offset": 70718 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from([0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff]);\n\nconsole.log(buf.readBigUInt64BE(0));\n// Prints: 4294967295n", - "position": { - "start": { "line": 2533, "column": 1, "offset": 70720 }, - "end": { "line": 2540, "column": 4, "offset": 70905 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from([0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff]);\n\nconsole.log(buf.readBigUInt64BE(0));\n// Prints: 4294967295n", - "position": { - "start": { "line": 2542, "column": 1, "offset": 70907 }, - "end": { "line": 2549, "column": 4, "offset": 71097 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.readBigUInt64LE([offset])", - "position": { - "start": { "line": 2551, "column": 5, "offset": 71103 }, - "end": { "line": 2551, "column": 36, "offset": 71134 } - } - } - ], - "position": { - "start": { "line": 2551, "column": 1, "offset": 71099 }, - "end": { "line": 2551, "column": 36, "offset": 71134 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 2553, "column": 1, "offset": 71136 }, - "end": { "line": 2563, "column": 4, "offset": 71362 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 2565, "column": 3, "offset": 71366 }, - "end": { "line": 2565, "column": 11, "offset": 71374 } - } - }, - { - "type": "text", - "value": " {integer} Number of bytes to skip before starting to read. Must\nsatisfy: ", - "position": { - "start": { "line": 2565, "column": 11, "offset": 71374 }, - "end": { "line": 2566, "column": 12, "offset": 71450 } - } - }, - { - "type": "inlineCode", - "value": "0 <= offset <= buf.length - 8", - "position": { - "start": { "line": 2566, "column": 12, "offset": 71450 }, - "end": { "line": 2566, "column": 43, "offset": 71481 } - } - }, - { - "type": "text", - "value": ". ", - "position": { - "start": { "line": 2566, "column": 43, "offset": 71481 }, - "end": { "line": 2566, "column": 45, "offset": 71483 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { - "line": 2566, - "column": 47, - "offset": 71485 - }, - "end": { "line": 2566, "column": 55, "offset": 71493 } - } - } - ], - "position": { - "start": { "line": 2566, "column": 45, "offset": 71483 }, - "end": { "line": 2566, "column": 57, "offset": 71495 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 2566, "column": 57, "offset": 71495 }, - "end": { "line": 2566, "column": 58, "offset": 71496 } - } - }, - { - "type": "inlineCode", - "value": "0", - "position": { - "start": { "line": 2566, "column": 58, "offset": 71496 }, - "end": { "line": 2566, "column": 61, "offset": 71499 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 2566, "column": 61, "offset": 71499 }, - "end": { "line": 2566, "column": 62, "offset": 71500 } - } - } - ], - "position": { - "start": { "line": 2565, "column": 3, "offset": 71366 }, - "end": { "line": 2566, "column": 62, "offset": 71500 } - } - } - ], - "position": { - "start": { "line": 2565, "column": 1, "offset": 71364 }, - "end": { "line": 2566, "column": 62, "offset": 71500 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {bigint}", - "position": { - "start": { "line": 2567, "column": 3, "offset": 71503 }, - "end": { "line": 2567, "column": 20, "offset": 71520 } - } - } - ], - "position": { - "start": { "line": 2567, "column": 3, "offset": 71503 }, - "end": { "line": 2567, "column": 20, "offset": 71520 } - } - } - ], - "position": { - "start": { "line": 2567, "column": 1, "offset": 71501 }, - "end": { "line": 2567, "column": 20, "offset": 71520 } - } - } - ], - "position": { - "start": { "line": 2565, "column": 1, "offset": 71364 }, - "end": { "line": 2567, "column": 20, "offset": 71520 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Reads an unsigned, little-endian 64-bit integer from ", - "position": { - "start": { "line": 2569, "column": 1, "offset": 71522 }, - "end": { "line": 2569, "column": 54, "offset": 71575 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 2569, "column": 54, "offset": 71575 }, - "end": { "line": 2569, "column": 59, "offset": 71580 } - } - }, - { - "type": "text", - "value": " at the specified\n", - "position": { - "start": { "line": 2569, "column": 59, "offset": 71580 }, - "end": { "line": 2570, "column": 1, "offset": 71598 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 2570, "column": 1, "offset": 71598 }, - "end": { "line": 2570, "column": 9, "offset": 71606 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 2570, "column": 9, "offset": 71606 }, - "end": { "line": 2570, "column": 10, "offset": 71607 } - } - } - ], - "position": { - "start": { "line": 2569, "column": 1, "offset": 71522 }, - "end": { "line": 2570, "column": 10, "offset": 71607 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This function is also available under the ", - "position": { - "start": { "line": 2572, "column": 1, "offset": 71609 }, - "end": { "line": 2572, "column": 43, "offset": 71651 } - } - }, - { - "type": "inlineCode", - "value": "readBigUint64LE", - "position": { - "start": { "line": 2572, "column": 43, "offset": 71651 }, - "end": { "line": 2572, "column": 60, "offset": 71668 } - } - }, - { - "type": "text", - "value": " alias.", - "position": { - "start": { "line": 2572, "column": 60, "offset": 71668 }, - "end": { "line": 2572, "column": 67, "offset": 71675 } - } - } - ], - "position": { - "start": { "line": 2572, "column": 1, "offset": 71609 }, - "end": { "line": 2572, "column": 67, "offset": 71675 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from([0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff]);\n\nconsole.log(buf.readBigUInt64LE(0));\n// Prints: 18446744069414584320n", - "position": { - "start": { "line": 2574, "column": 1, "offset": 71677 }, - "end": { "line": 2581, "column": 4, "offset": 71872 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from([0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff]);\n\nconsole.log(buf.readBigUInt64LE(0));\n// Prints: 18446744069414584320n", - "position": { - "start": { "line": 2583, "column": 1, "offset": 71874 }, - "end": { "line": 2590, "column": 4, "offset": 72074 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.readDoubleBE([offset])", - "position": { - "start": { "line": 2592, "column": 5, "offset": 72080 }, - "end": { "line": 2592, "column": 33, "offset": 72108 } - } - } - ], - "position": { - "start": { "line": 2592, "column": 1, "offset": 72076 }, - "end": { "line": 2592, "column": 33, "offset": 72108 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 2594, "column": 1, "offset": 72110 }, - "end": { "line": 2601, "column": 4, "offset": 72336 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 2603, "column": 3, "offset": 72340 }, - "end": { "line": 2603, "column": 11, "offset": 72348 } - } - }, - { - "type": "text", - "value": " {integer} Number of bytes to skip before starting to read. Must\nsatisfy ", - "position": { - "start": { "line": 2603, "column": 11, "offset": 72348 }, - "end": { "line": 2604, "column": 11, "offset": 72423 } - } - }, - { - "type": "inlineCode", - "value": "0 <= offset <= buf.length - 8", - "position": { - "start": { "line": 2604, "column": 11, "offset": 72423 }, - "end": { "line": 2604, "column": 42, "offset": 72454 } - } - }, - { - "type": "text", - "value": ". ", - "position": { - "start": { "line": 2604, "column": 42, "offset": 72454 }, - "end": { "line": 2604, "column": 44, "offset": 72456 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { - "line": 2604, - "column": 46, - "offset": 72458 - }, - "end": { "line": 2604, "column": 54, "offset": 72466 } - } - } - ], - "position": { - "start": { "line": 2604, "column": 44, "offset": 72456 }, - "end": { "line": 2604, "column": 56, "offset": 72468 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 2604, "column": 56, "offset": 72468 }, - "end": { "line": 2604, "column": 57, "offset": 72469 } - } - }, - { - "type": "inlineCode", - "value": "0", - "position": { - "start": { "line": 2604, "column": 57, "offset": 72469 }, - "end": { "line": 2604, "column": 60, "offset": 72472 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 2604, "column": 60, "offset": 72472 }, - "end": { "line": 2604, "column": 61, "offset": 72473 } - } - } - ], - "position": { - "start": { "line": 2603, "column": 3, "offset": 72340 }, - "end": { "line": 2604, "column": 61, "offset": 72473 } - } - } - ], - "position": { - "start": { "line": 2603, "column": 1, "offset": 72338 }, - "end": { "line": 2604, "column": 61, "offset": 72473 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {number}", - "position": { - "start": { "line": 2605, "column": 3, "offset": 72476 }, - "end": { "line": 2605, "column": 20, "offset": 72493 } - } - } - ], - "position": { - "start": { "line": 2605, "column": 3, "offset": 72476 }, - "end": { "line": 2605, "column": 20, "offset": 72493 } - } - } - ], - "position": { - "start": { "line": 2605, "column": 1, "offset": 72474 }, - "end": { "line": 2605, "column": 20, "offset": 72493 } - } - } - ], - "position": { - "start": { "line": 2603, "column": 1, "offset": 72338 }, - "end": { "line": 2605, "column": 20, "offset": 72493 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Reads a 64-bit, big-endian double from ", - "position": { - "start": { "line": 2607, "column": 1, "offset": 72495 }, - "end": { "line": 2607, "column": 40, "offset": 72534 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 2607, "column": 40, "offset": 72534 }, - "end": { "line": 2607, "column": 45, "offset": 72539 } - } - }, - { - "type": "text", - "value": " at the specified ", - "position": { - "start": { "line": 2607, "column": 45, "offset": 72539 }, - "end": { "line": 2607, "column": 63, "offset": 72557 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 2607, "column": 63, "offset": 72557 }, - "end": { "line": 2607, "column": 71, "offset": 72565 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 2607, "column": 71, "offset": 72565 }, - "end": { "line": 2607, "column": 72, "offset": 72566 } - } - } - ], - "position": { - "start": { "line": 2607, "column": 1, "offset": 72495 }, - "end": { "line": 2607, "column": 72, "offset": 72566 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8]);\n\nconsole.log(buf.readDoubleBE(0));\n// Prints: 8.20788039913184e-304", - "position": { - "start": { "line": 2609, "column": 1, "offset": 72568 }, - "end": { "line": 2616, "column": 4, "offset": 72736 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8]);\n\nconsole.log(buf.readDoubleBE(0));\n// Prints: 8.20788039913184e-304", - "position": { - "start": { "line": 2618, "column": 1, "offset": 72738 }, - "end": { "line": 2625, "column": 4, "offset": 72911 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.readDoubleLE([offset])", - "position": { - "start": { "line": 2627, "column": 5, "offset": 72917 }, - "end": { "line": 2627, "column": 33, "offset": 72945 } - } - } - ], - "position": { - "start": { "line": 2627, "column": 1, "offset": 72913 }, - "end": { "line": 2627, "column": 33, "offset": 72945 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 2629, "column": 1, "offset": 72947 }, - "end": { "line": 2636, "column": 4, "offset": 73173 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 2638, "column": 3, "offset": 73177 }, - "end": { "line": 2638, "column": 11, "offset": 73185 } - } - }, - { - "type": "text", - "value": " {integer} Number of bytes to skip before starting to read. Must\nsatisfy ", - "position": { - "start": { "line": 2638, "column": 11, "offset": 73185 }, - "end": { "line": 2639, "column": 11, "offset": 73260 } - } - }, - { - "type": "inlineCode", - "value": "0 <= offset <= buf.length - 8", - "position": { - "start": { "line": 2639, "column": 11, "offset": 73260 }, - "end": { "line": 2639, "column": 42, "offset": 73291 } - } - }, - { - "type": "text", - "value": ". ", - "position": { - "start": { "line": 2639, "column": 42, "offset": 73291 }, - "end": { "line": 2639, "column": 44, "offset": 73293 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { - "line": 2639, - "column": 46, - "offset": 73295 - }, - "end": { "line": 2639, "column": 54, "offset": 73303 } - } - } - ], - "position": { - "start": { "line": 2639, "column": 44, "offset": 73293 }, - "end": { "line": 2639, "column": 56, "offset": 73305 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 2639, "column": 56, "offset": 73305 }, - "end": { "line": 2639, "column": 57, "offset": 73306 } - } - }, - { - "type": "inlineCode", - "value": "0", - "position": { - "start": { "line": 2639, "column": 57, "offset": 73306 }, - "end": { "line": 2639, "column": 60, "offset": 73309 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 2639, "column": 60, "offset": 73309 }, - "end": { "line": 2639, "column": 61, "offset": 73310 } - } - } - ], - "position": { - "start": { "line": 2638, "column": 3, "offset": 73177 }, - "end": { "line": 2639, "column": 61, "offset": 73310 } - } - } - ], - "position": { - "start": { "line": 2638, "column": 1, "offset": 73175 }, - "end": { "line": 2639, "column": 61, "offset": 73310 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {number}", - "position": { - "start": { "line": 2640, "column": 3, "offset": 73313 }, - "end": { "line": 2640, "column": 20, "offset": 73330 } - } - } - ], - "position": { - "start": { "line": 2640, "column": 3, "offset": 73313 }, - "end": { "line": 2640, "column": 20, "offset": 73330 } - } - } - ], - "position": { - "start": { "line": 2640, "column": 1, "offset": 73311 }, - "end": { "line": 2640, "column": 20, "offset": 73330 } - } - } - ], - "position": { - "start": { "line": 2638, "column": 1, "offset": 73175 }, - "end": { "line": 2640, "column": 20, "offset": 73330 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Reads a 64-bit, little-endian double from ", - "position": { - "start": { "line": 2642, "column": 1, "offset": 73332 }, - "end": { "line": 2642, "column": 43, "offset": 73374 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 2642, "column": 43, "offset": 73374 }, - "end": { "line": 2642, "column": 48, "offset": 73379 } - } - }, - { - "type": "text", - "value": " at the specified ", - "position": { - "start": { "line": 2642, "column": 48, "offset": 73379 }, - "end": { "line": 2642, "column": 66, "offset": 73397 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 2642, "column": 66, "offset": 73397 }, - "end": { "line": 2642, "column": 74, "offset": 73405 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 2642, "column": 74, "offset": 73405 }, - "end": { "line": 2642, "column": 75, "offset": 73406 } - } - } - ], - "position": { - "start": { "line": 2642, "column": 1, "offset": 73332 }, - "end": { "line": 2642, "column": 75, "offset": 73406 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8]);\n\nconsole.log(buf.readDoubleLE(0));\n// Prints: 5.447603722011605e-270\nconsole.log(buf.readDoubleLE(1));\n// Throws ERR_OUT_OF_RANGE.", - "position": { - "start": { "line": 2644, "column": 1, "offset": 73408 }, - "end": { "line": 2653, "column": 4, "offset": 73639 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8]);\n\nconsole.log(buf.readDoubleLE(0));\n// Prints: 5.447603722011605e-270\nconsole.log(buf.readDoubleLE(1));\n// Throws ERR_OUT_OF_RANGE.", - "position": { - "start": { "line": 2655, "column": 1, "offset": 73641 }, - "end": { "line": 2664, "column": 4, "offset": 73877 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.readFloatBE([offset])", - "position": { - "start": { "line": 2666, "column": 5, "offset": 73883 }, - "end": { "line": 2666, "column": 32, "offset": 73910 } - } - } - ], - "position": { - "start": { "line": 2666, "column": 1, "offset": 73879 }, - "end": { "line": 2666, "column": 32, "offset": 73910 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 2668, "column": 1, "offset": 73912 }, - "end": { "line": 2675, "column": 4, "offset": 74138 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 2677, "column": 3, "offset": 74142 }, - "end": { "line": 2677, "column": 11, "offset": 74150 } - } - }, - { - "type": "text", - "value": " {integer} Number of bytes to skip before starting to read. Must\nsatisfy ", - "position": { - "start": { "line": 2677, "column": 11, "offset": 74150 }, - "end": { "line": 2678, "column": 11, "offset": 74225 } - } - }, - { - "type": "inlineCode", - "value": "0 <= offset <= buf.length - 4", - "position": { - "start": { "line": 2678, "column": 11, "offset": 74225 }, - "end": { "line": 2678, "column": 42, "offset": 74256 } - } - }, - { - "type": "text", - "value": ". ", - "position": { - "start": { "line": 2678, "column": 42, "offset": 74256 }, - "end": { "line": 2678, "column": 44, "offset": 74258 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { - "line": 2678, - "column": 46, - "offset": 74260 - }, - "end": { "line": 2678, "column": 54, "offset": 74268 } - } - } - ], - "position": { - "start": { "line": 2678, "column": 44, "offset": 74258 }, - "end": { "line": 2678, "column": 56, "offset": 74270 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 2678, "column": 56, "offset": 74270 }, - "end": { "line": 2678, "column": 57, "offset": 74271 } - } - }, - { - "type": "inlineCode", - "value": "0", - "position": { - "start": { "line": 2678, "column": 57, "offset": 74271 }, - "end": { "line": 2678, "column": 60, "offset": 74274 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 2678, "column": 60, "offset": 74274 }, - "end": { "line": 2678, "column": 61, "offset": 74275 } - } - } - ], - "position": { - "start": { "line": 2677, "column": 3, "offset": 74142 }, - "end": { "line": 2678, "column": 61, "offset": 74275 } - } - } - ], - "position": { - "start": { "line": 2677, "column": 1, "offset": 74140 }, - "end": { "line": 2678, "column": 61, "offset": 74275 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {number}", - "position": { - "start": { "line": 2679, "column": 3, "offset": 74278 }, - "end": { "line": 2679, "column": 20, "offset": 74295 } - } - } - ], - "position": { - "start": { "line": 2679, "column": 3, "offset": 74278 }, - "end": { "line": 2679, "column": 20, "offset": 74295 } - } - } - ], - "position": { - "start": { "line": 2679, "column": 1, "offset": 74276 }, - "end": { "line": 2679, "column": 20, "offset": 74295 } - } - } - ], - "position": { - "start": { "line": 2677, "column": 1, "offset": 74140 }, - "end": { "line": 2679, "column": 20, "offset": 74295 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Reads a 32-bit, big-endian float from ", - "position": { - "start": { "line": 2681, "column": 1, "offset": 74297 }, - "end": { "line": 2681, "column": 39, "offset": 74335 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 2681, "column": 39, "offset": 74335 }, - "end": { "line": 2681, "column": 44, "offset": 74340 } - } - }, - { - "type": "text", - "value": " at the specified ", - "position": { - "start": { "line": 2681, "column": 44, "offset": 74340 }, - "end": { "line": 2681, "column": 62, "offset": 74358 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 2681, "column": 62, "offset": 74358 }, - "end": { "line": 2681, "column": 70, "offset": 74366 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 2681, "column": 70, "offset": 74366 }, - "end": { "line": 2681, "column": 71, "offset": 74367 } - } - } - ], - "position": { - "start": { "line": 2681, "column": 1, "offset": 74297 }, - "end": { "line": 2681, "column": 71, "offset": 74367 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from([1, 2, 3, 4]);\n\nconsole.log(buf.readFloatBE(0));\n// Prints: 2.387939260590663e-38", - "position": { - "start": { "line": 2683, "column": 1, "offset": 74369 }, - "end": { "line": 2690, "column": 4, "offset": 74524 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from([1, 2, 3, 4]);\n\nconsole.log(buf.readFloatBE(0));\n// Prints: 2.387939260590663e-38", - "position": { - "start": { "line": 2692, "column": 1, "offset": 74526 }, - "end": { "line": 2699, "column": 4, "offset": 74686 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.readFloatLE([offset])", - "position": { - "start": { "line": 2701, "column": 5, "offset": 74692 }, - "end": { "line": 2701, "column": 32, "offset": 74719 } - } - } - ], - "position": { - "start": { "line": 2701, "column": 1, "offset": 74688 }, - "end": { "line": 2701, "column": 32, "offset": 74719 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 2703, "column": 1, "offset": 74721 }, - "end": { "line": 2710, "column": 4, "offset": 74947 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 2712, "column": 3, "offset": 74951 }, - "end": { "line": 2712, "column": 11, "offset": 74959 } - } - }, - { - "type": "text", - "value": " {integer} Number of bytes to skip before starting to read. Must\nsatisfy ", - "position": { - "start": { "line": 2712, "column": 11, "offset": 74959 }, - "end": { "line": 2713, "column": 11, "offset": 75034 } - } - }, - { - "type": "inlineCode", - "value": "0 <= offset <= buf.length - 4", - "position": { - "start": { "line": 2713, "column": 11, "offset": 75034 }, - "end": { "line": 2713, "column": 42, "offset": 75065 } - } - }, - { - "type": "text", - "value": ". ", - "position": { - "start": { "line": 2713, "column": 42, "offset": 75065 }, - "end": { "line": 2713, "column": 44, "offset": 75067 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { - "line": 2713, - "column": 46, - "offset": 75069 - }, - "end": { "line": 2713, "column": 54, "offset": 75077 } - } - } - ], - "position": { - "start": { "line": 2713, "column": 44, "offset": 75067 }, - "end": { "line": 2713, "column": 56, "offset": 75079 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 2713, "column": 56, "offset": 75079 }, - "end": { "line": 2713, "column": 57, "offset": 75080 } - } - }, - { - "type": "inlineCode", - "value": "0", - "position": { - "start": { "line": 2713, "column": 57, "offset": 75080 }, - "end": { "line": 2713, "column": 60, "offset": 75083 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 2713, "column": 60, "offset": 75083 }, - "end": { "line": 2713, "column": 61, "offset": 75084 } - } - } - ], - "position": { - "start": { "line": 2712, "column": 3, "offset": 74951 }, - "end": { "line": 2713, "column": 61, "offset": 75084 } - } - } - ], - "position": { - "start": { "line": 2712, "column": 1, "offset": 74949 }, - "end": { "line": 2713, "column": 61, "offset": 75084 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {number}", - "position": { - "start": { "line": 2714, "column": 3, "offset": 75087 }, - "end": { "line": 2714, "column": 20, "offset": 75104 } - } - } - ], - "position": { - "start": { "line": 2714, "column": 3, "offset": 75087 }, - "end": { "line": 2714, "column": 20, "offset": 75104 } - } - } - ], - "position": { - "start": { "line": 2714, "column": 1, "offset": 75085 }, - "end": { "line": 2714, "column": 20, "offset": 75104 } - } - } - ], - "position": { - "start": { "line": 2712, "column": 1, "offset": 74949 }, - "end": { "line": 2714, "column": 20, "offset": 75104 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Reads a 32-bit, little-endian float from ", - "position": { - "start": { "line": 2716, "column": 1, "offset": 75106 }, - "end": { "line": 2716, "column": 42, "offset": 75147 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 2716, "column": 42, "offset": 75147 }, - "end": { "line": 2716, "column": 47, "offset": 75152 } - } - }, - { - "type": "text", - "value": " at the specified ", - "position": { - "start": { "line": 2716, "column": 47, "offset": 75152 }, - "end": { "line": 2716, "column": 65, "offset": 75170 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 2716, "column": 65, "offset": 75170 }, - "end": { "line": 2716, "column": 73, "offset": 75178 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 2716, "column": 73, "offset": 75178 }, - "end": { "line": 2716, "column": 74, "offset": 75179 } - } - } - ], - "position": { - "start": { "line": 2716, "column": 1, "offset": 75106 }, - "end": { "line": 2716, "column": 74, "offset": 75179 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from([1, 2, 3, 4]);\n\nconsole.log(buf.readFloatLE(0));\n// Prints: 1.539989614439558e-36\nconsole.log(buf.readFloatLE(1));\n// Throws ERR_OUT_OF_RANGE.", - "position": { - "start": { "line": 2718, "column": 1, "offset": 75181 }, - "end": { "line": 2727, "column": 4, "offset": 75397 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from([1, 2, 3, 4]);\n\nconsole.log(buf.readFloatLE(0));\n// Prints: 1.539989614439558e-36\nconsole.log(buf.readFloatLE(1));\n// Throws ERR_OUT_OF_RANGE.", - "position": { - "start": { "line": 2729, "column": 1, "offset": 75399 }, - "end": { "line": 2738, "column": 4, "offset": 75620 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.readInt8([offset])", - "position": { - "start": { "line": 2740, "column": 5, "offset": 75626 }, - "end": { "line": 2740, "column": 29, "offset": 75650 } - } - } - ], - "position": { - "start": { "line": 2740, "column": 1, "offset": 75622 }, - "end": { "line": 2740, "column": 29, "offset": 75650 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 2742, "column": 1, "offset": 75652 }, - "end": { "line": 2749, "column": 4, "offset": 75876 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 2751, "column": 3, "offset": 75880 }, - "end": { "line": 2751, "column": 11, "offset": 75888 } - } - }, - { - "type": "text", - "value": " {integer} Number of bytes to skip before starting to read. Must\nsatisfy ", - "position": { - "start": { "line": 2751, "column": 11, "offset": 75888 }, - "end": { "line": 2752, "column": 11, "offset": 75963 } - } - }, - { - "type": "inlineCode", - "value": "0 <= offset <= buf.length - 1", - "position": { - "start": { "line": 2752, "column": 11, "offset": 75963 }, - "end": { "line": 2752, "column": 42, "offset": 75994 } - } - }, - { - "type": "text", - "value": ". ", - "position": { - "start": { "line": 2752, "column": 42, "offset": 75994 }, - "end": { "line": 2752, "column": 44, "offset": 75996 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { - "line": 2752, - "column": 46, - "offset": 75998 - }, - "end": { "line": 2752, "column": 54, "offset": 76006 } - } - } - ], - "position": { - "start": { "line": 2752, "column": 44, "offset": 75996 }, - "end": { "line": 2752, "column": 56, "offset": 76008 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 2752, "column": 56, "offset": 76008 }, - "end": { "line": 2752, "column": 57, "offset": 76009 } - } - }, - { - "type": "inlineCode", - "value": "0", - "position": { - "start": { "line": 2752, "column": 57, "offset": 76009 }, - "end": { "line": 2752, "column": 60, "offset": 76012 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 2752, "column": 60, "offset": 76012 }, - "end": { "line": 2752, "column": 61, "offset": 76013 } - } - } - ], - "position": { - "start": { "line": 2751, "column": 3, "offset": 75880 }, - "end": { "line": 2752, "column": 61, "offset": 76013 } - } - } - ], - "position": { - "start": { "line": 2751, "column": 1, "offset": 75878 }, - "end": { "line": 2752, "column": 61, "offset": 76013 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {integer}", - "position": { - "start": { "line": 2753, "column": 3, "offset": 76016 }, - "end": { "line": 2753, "column": 21, "offset": 76034 } - } - } - ], - "position": { - "start": { "line": 2753, "column": 3, "offset": 76016 }, - "end": { "line": 2753, "column": 21, "offset": 76034 } - } - } - ], - "position": { - "start": { "line": 2753, "column": 1, "offset": 76014 }, - "end": { "line": 2753, "column": 21, "offset": 76034 } - } - } - ], - "position": { - "start": { "line": 2751, "column": 1, "offset": 75878 }, - "end": { "line": 2753, "column": 21, "offset": 76034 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Reads a signed 8-bit integer from ", - "position": { - "start": { "line": 2755, "column": 1, "offset": 76036 }, - "end": { "line": 2755, "column": 35, "offset": 76070 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 2755, "column": 35, "offset": 76070 }, - "end": { "line": 2755, "column": 40, "offset": 76075 } - } - }, - { - "type": "text", - "value": " at the specified ", - "position": { - "start": { "line": 2755, "column": 40, "offset": 76075 }, - "end": { "line": 2755, "column": 58, "offset": 76093 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 2755, "column": 58, "offset": 76093 }, - "end": { "line": 2755, "column": 66, "offset": 76101 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 2755, "column": 66, "offset": 76101 }, - "end": { "line": 2755, "column": 67, "offset": 76102 } - } - } - ], - "position": { - "start": { "line": 2755, "column": 1, "offset": 76036 }, - "end": { "line": 2755, "column": 67, "offset": 76102 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Integers read from a ", - "position": { - "start": { "line": 2757, "column": 1, "offset": 76104 }, - "end": { "line": 2757, "column": 22, "offset": 76125 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 2757, "column": 22, "offset": 76125 }, - "end": { "line": 2757, "column": 30, "offset": 76133 } - } - }, - { - "type": "text", - "value": " are interpreted as two's complement signed values.", - "position": { - "start": { "line": 2757, "column": 30, "offset": 76133 }, - "end": { "line": 2757, "column": 81, "offset": 76184 } - } - } - ], - "position": { - "start": { "line": 2757, "column": 1, "offset": 76104 }, - "end": { "line": 2757, "column": 81, "offset": 76184 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from([-1, 5]);\n\nconsole.log(buf.readInt8(0));\n// Prints: -1\nconsole.log(buf.readInt8(1));\n// Prints: 5\nconsole.log(buf.readInt8(2));\n// Throws ERR_OUT_OF_RANGE.", - "position": { - "start": { "line": 2759, "column": 1, "offset": 76186 }, - "end": { "line": 2770, "column": 4, "offset": 76415 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from([-1, 5]);\n\nconsole.log(buf.readInt8(0));\n// Prints: -1\nconsole.log(buf.readInt8(1));\n// Prints: 5\nconsole.log(buf.readInt8(2));\n// Throws ERR_OUT_OF_RANGE.", - "position": { - "start": { "line": 2772, "column": 1, "offset": 76417 }, - "end": { "line": 2783, "column": 4, "offset": 76651 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.readInt16BE([offset])", - "position": { - "start": { "line": 2785, "column": 5, "offset": 76657 }, - "end": { "line": 2785, "column": 32, "offset": 76684 } - } - } - ], - "position": { - "start": { "line": 2785, "column": 1, "offset": 76653 }, - "end": { "line": 2785, "column": 32, "offset": 76684 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 2787, "column": 1, "offset": 76686 }, - "end": { "line": 2794, "column": 4, "offset": 76910 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 2796, "column": 3, "offset": 76914 }, - "end": { "line": 2796, "column": 11, "offset": 76922 } - } - }, - { - "type": "text", - "value": " {integer} Number of bytes to skip before starting to read. Must\nsatisfy ", - "position": { - "start": { "line": 2796, "column": 11, "offset": 76922 }, - "end": { "line": 2797, "column": 11, "offset": 76997 } - } - }, - { - "type": "inlineCode", - "value": "0 <= offset <= buf.length - 2", - "position": { - "start": { "line": 2797, "column": 11, "offset": 76997 }, - "end": { "line": 2797, "column": 42, "offset": 77028 } - } - }, - { - "type": "text", - "value": ". ", - "position": { - "start": { "line": 2797, "column": 42, "offset": 77028 }, - "end": { "line": 2797, "column": 44, "offset": 77030 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { - "line": 2797, - "column": 46, - "offset": 77032 - }, - "end": { "line": 2797, "column": 54, "offset": 77040 } - } - } - ], - "position": { - "start": { "line": 2797, "column": 44, "offset": 77030 }, - "end": { "line": 2797, "column": 56, "offset": 77042 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 2797, "column": 56, "offset": 77042 }, - "end": { "line": 2797, "column": 57, "offset": 77043 } - } - }, - { - "type": "inlineCode", - "value": "0", - "position": { - "start": { "line": 2797, "column": 57, "offset": 77043 }, - "end": { "line": 2797, "column": 60, "offset": 77046 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 2797, "column": 60, "offset": 77046 }, - "end": { "line": 2797, "column": 61, "offset": 77047 } - } - } - ], - "position": { - "start": { "line": 2796, "column": 3, "offset": 76914 }, - "end": { "line": 2797, "column": 61, "offset": 77047 } - } - } - ], - "position": { - "start": { "line": 2796, "column": 1, "offset": 76912 }, - "end": { "line": 2797, "column": 61, "offset": 77047 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {integer}", - "position": { - "start": { "line": 2798, "column": 3, "offset": 77050 }, - "end": { "line": 2798, "column": 21, "offset": 77068 } - } - } - ], - "position": { - "start": { "line": 2798, "column": 3, "offset": 77050 }, - "end": { "line": 2798, "column": 21, "offset": 77068 } - } - } - ], - "position": { - "start": { "line": 2798, "column": 1, "offset": 77048 }, - "end": { "line": 2798, "column": 21, "offset": 77068 } - } - } - ], - "position": { - "start": { "line": 2796, "column": 1, "offset": 76912 }, - "end": { "line": 2798, "column": 21, "offset": 77068 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Reads a signed, big-endian 16-bit integer from ", - "position": { - "start": { "line": 2800, "column": 1, "offset": 77070 }, - "end": { "line": 2800, "column": 48, "offset": 77117 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 2800, "column": 48, "offset": 77117 }, - "end": { "line": 2800, "column": 53, "offset": 77122 } - } - }, - { - "type": "text", - "value": " at the specified ", - "position": { - "start": { "line": 2800, "column": 53, "offset": 77122 }, - "end": { "line": 2800, "column": 71, "offset": 77140 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 2800, "column": 71, "offset": 77140 }, - "end": { "line": 2800, "column": 79, "offset": 77148 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 2800, "column": 79, "offset": 77148 }, - "end": { "line": 2800, "column": 80, "offset": 77149 } - } - } - ], - "position": { - "start": { "line": 2800, "column": 1, "offset": 77070 }, - "end": { "line": 2800, "column": 80, "offset": 77149 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Integers read from a ", - "position": { - "start": { "line": 2802, "column": 1, "offset": 77151 }, - "end": { "line": 2802, "column": 22, "offset": 77172 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 2802, "column": 22, "offset": 77172 }, - "end": { "line": 2802, "column": 30, "offset": 77180 } - } - }, - { - "type": "text", - "value": " are interpreted as two's complement signed values.", - "position": { - "start": { "line": 2802, "column": 30, "offset": 77180 }, - "end": { "line": 2802, "column": 81, "offset": 77231 } - } - } - ], - "position": { - "start": { "line": 2802, "column": 1, "offset": 77151 }, - "end": { "line": 2802, "column": 81, "offset": 77231 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from([0, 5]);\n\nconsole.log(buf.readInt16BE(0));\n// Prints: 5", - "position": { - "start": { "line": 2804, "column": 1, "offset": 77233 }, - "end": { "line": 2811, "column": 4, "offset": 77362 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from([0, 5]);\n\nconsole.log(buf.readInt16BE(0));\n// Prints: 5", - "position": { - "start": { "line": 2813, "column": 1, "offset": 77364 }, - "end": { "line": 2820, "column": 4, "offset": 77498 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.readInt16LE([offset])", - "position": { - "start": { "line": 2822, "column": 5, "offset": 77504 }, - "end": { "line": 2822, "column": 32, "offset": 77531 } - } - } - ], - "position": { - "start": { "line": 2822, "column": 1, "offset": 77500 }, - "end": { "line": 2822, "column": 32, "offset": 77531 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 2824, "column": 1, "offset": 77533 }, - "end": { "line": 2831, "column": 4, "offset": 77757 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 2833, "column": 3, "offset": 77761 }, - "end": { "line": 2833, "column": 11, "offset": 77769 } - } - }, - { - "type": "text", - "value": " {integer} Number of bytes to skip before starting to read. Must\nsatisfy ", - "position": { - "start": { "line": 2833, "column": 11, "offset": 77769 }, - "end": { "line": 2834, "column": 11, "offset": 77844 } - } - }, - { - "type": "inlineCode", - "value": "0 <= offset <= buf.length - 2", - "position": { - "start": { "line": 2834, "column": 11, "offset": 77844 }, - "end": { "line": 2834, "column": 42, "offset": 77875 } - } - }, - { - "type": "text", - "value": ". ", - "position": { - "start": { "line": 2834, "column": 42, "offset": 77875 }, - "end": { "line": 2834, "column": 44, "offset": 77877 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { - "line": 2834, - "column": 46, - "offset": 77879 - }, - "end": { "line": 2834, "column": 54, "offset": 77887 } - } - } - ], - "position": { - "start": { "line": 2834, "column": 44, "offset": 77877 }, - "end": { "line": 2834, "column": 56, "offset": 77889 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 2834, "column": 56, "offset": 77889 }, - "end": { "line": 2834, "column": 57, "offset": 77890 } - } - }, - { - "type": "inlineCode", - "value": "0", - "position": { - "start": { "line": 2834, "column": 57, "offset": 77890 }, - "end": { "line": 2834, "column": 60, "offset": 77893 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 2834, "column": 60, "offset": 77893 }, - "end": { "line": 2834, "column": 61, "offset": 77894 } - } - } - ], - "position": { - "start": { "line": 2833, "column": 3, "offset": 77761 }, - "end": { "line": 2834, "column": 61, "offset": 77894 } - } - } - ], - "position": { - "start": { "line": 2833, "column": 1, "offset": 77759 }, - "end": { "line": 2834, "column": 61, "offset": 77894 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {integer}", - "position": { - "start": { "line": 2835, "column": 3, "offset": 77897 }, - "end": { "line": 2835, "column": 21, "offset": 77915 } - } - } - ], - "position": { - "start": { "line": 2835, "column": 3, "offset": 77897 }, - "end": { "line": 2835, "column": 21, "offset": 77915 } - } - } - ], - "position": { - "start": { "line": 2835, "column": 1, "offset": 77895 }, - "end": { "line": 2835, "column": 21, "offset": 77915 } - } - } - ], - "position": { - "start": { "line": 2833, "column": 1, "offset": 77759 }, - "end": { "line": 2835, "column": 21, "offset": 77915 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Reads a signed, little-endian 16-bit integer from ", - "position": { - "start": { "line": 2837, "column": 1, "offset": 77917 }, - "end": { "line": 2837, "column": 51, "offset": 77967 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 2837, "column": 51, "offset": 77967 }, - "end": { "line": 2837, "column": 56, "offset": 77972 } - } - }, - { - "type": "text", - "value": " at the specified\n", - "position": { - "start": { "line": 2837, "column": 56, "offset": 77972 }, - "end": { "line": 2838, "column": 1, "offset": 77990 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 2838, "column": 1, "offset": 77990 }, - "end": { "line": 2838, "column": 9, "offset": 77998 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 2838, "column": 9, "offset": 77998 }, - "end": { "line": 2838, "column": 10, "offset": 77999 } - } - } - ], - "position": { - "start": { "line": 2837, "column": 1, "offset": 77917 }, - "end": { "line": 2838, "column": 10, "offset": 77999 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Integers read from a ", - "position": { - "start": { "line": 2840, "column": 1, "offset": 78001 }, - "end": { "line": 2840, "column": 22, "offset": 78022 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 2840, "column": 22, "offset": 78022 }, - "end": { "line": 2840, "column": 30, "offset": 78030 } - } - }, - { - "type": "text", - "value": " are interpreted as two's complement signed values.", - "position": { - "start": { "line": 2840, "column": 30, "offset": 78030 }, - "end": { "line": 2840, "column": 81, "offset": 78081 } - } - } - ], - "position": { - "start": { "line": 2840, "column": 1, "offset": 78001 }, - "end": { "line": 2840, "column": 81, "offset": 78081 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from([0, 5]);\n\nconsole.log(buf.readInt16LE(0));\n// Prints: 1280\nconsole.log(buf.readInt16LE(1));\n// Throws ERR_OUT_OF_RANGE.", - "position": { - "start": { "line": 2842, "column": 1, "offset": 78083 }, - "end": { "line": 2851, "column": 4, "offset": 78276 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from([0, 5]);\n\nconsole.log(buf.readInt16LE(0));\n// Prints: 1280\nconsole.log(buf.readInt16LE(1));\n// Throws ERR_OUT_OF_RANGE.", - "position": { - "start": { "line": 2853, "column": 1, "offset": 78278 }, - "end": { "line": 2862, "column": 4, "offset": 78476 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.readInt32BE([offset])", - "position": { - "start": { "line": 2864, "column": 5, "offset": 78482 }, - "end": { "line": 2864, "column": 32, "offset": 78509 } - } - } - ], - "position": { - "start": { "line": 2864, "column": 1, "offset": 78478 }, - "end": { "line": 2864, "column": 32, "offset": 78509 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 2866, "column": 1, "offset": 78511 }, - "end": { "line": 2873, "column": 4, "offset": 78735 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 2875, "column": 3, "offset": 78739 }, - "end": { "line": 2875, "column": 11, "offset": 78747 } - } - }, - { - "type": "text", - "value": " {integer} Number of bytes to skip before starting to read. Must\nsatisfy ", - "position": { - "start": { "line": 2875, "column": 11, "offset": 78747 }, - "end": { "line": 2876, "column": 11, "offset": 78822 } - } - }, - { - "type": "inlineCode", - "value": "0 <= offset <= buf.length - 4", - "position": { - "start": { "line": 2876, "column": 11, "offset": 78822 }, - "end": { "line": 2876, "column": 42, "offset": 78853 } - } - }, - { - "type": "text", - "value": ". ", - "position": { - "start": { "line": 2876, "column": 42, "offset": 78853 }, - "end": { "line": 2876, "column": 44, "offset": 78855 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { - "line": 2876, - "column": 46, - "offset": 78857 - }, - "end": { "line": 2876, "column": 54, "offset": 78865 } - } - } - ], - "position": { - "start": { "line": 2876, "column": 44, "offset": 78855 }, - "end": { "line": 2876, "column": 56, "offset": 78867 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 2876, "column": 56, "offset": 78867 }, - "end": { "line": 2876, "column": 57, "offset": 78868 } - } - }, - { - "type": "inlineCode", - "value": "0", - "position": { - "start": { "line": 2876, "column": 57, "offset": 78868 }, - "end": { "line": 2876, "column": 60, "offset": 78871 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 2876, "column": 60, "offset": 78871 }, - "end": { "line": 2876, "column": 61, "offset": 78872 } - } - } - ], - "position": { - "start": { "line": 2875, "column": 3, "offset": 78739 }, - "end": { "line": 2876, "column": 61, "offset": 78872 } - } - } - ], - "position": { - "start": { "line": 2875, "column": 1, "offset": 78737 }, - "end": { "line": 2876, "column": 61, "offset": 78872 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {integer}", - "position": { - "start": { "line": 2877, "column": 3, "offset": 78875 }, - "end": { "line": 2877, "column": 21, "offset": 78893 } - } - } - ], - "position": { - "start": { "line": 2877, "column": 3, "offset": 78875 }, - "end": { "line": 2877, "column": 21, "offset": 78893 } - } - } - ], - "position": { - "start": { "line": 2877, "column": 1, "offset": 78873 }, - "end": { "line": 2877, "column": 21, "offset": 78893 } - } - } - ], - "position": { - "start": { "line": 2875, "column": 1, "offset": 78737 }, - "end": { "line": 2877, "column": 21, "offset": 78893 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Reads a signed, big-endian 32-bit integer from ", - "position": { - "start": { "line": 2879, "column": 1, "offset": 78895 }, - "end": { "line": 2879, "column": 48, "offset": 78942 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 2879, "column": 48, "offset": 78942 }, - "end": { "line": 2879, "column": 53, "offset": 78947 } - } - }, - { - "type": "text", - "value": " at the specified ", - "position": { - "start": { "line": 2879, "column": 53, "offset": 78947 }, - "end": { "line": 2879, "column": 71, "offset": 78965 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 2879, "column": 71, "offset": 78965 }, - "end": { "line": 2879, "column": 79, "offset": 78973 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 2879, "column": 79, "offset": 78973 }, - "end": { "line": 2879, "column": 80, "offset": 78974 } - } - } - ], - "position": { - "start": { "line": 2879, "column": 1, "offset": 78895 }, - "end": { "line": 2879, "column": 80, "offset": 78974 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Integers read from a ", - "position": { - "start": { "line": 2881, "column": 1, "offset": 78976 }, - "end": { "line": 2881, "column": 22, "offset": 78997 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 2881, "column": 22, "offset": 78997 }, - "end": { "line": 2881, "column": 30, "offset": 79005 } - } - }, - { - "type": "text", - "value": " are interpreted as two's complement signed values.", - "position": { - "start": { "line": 2881, "column": 30, "offset": 79005 }, - "end": { "line": 2881, "column": 81, "offset": 79056 } - } - } - ], - "position": { - "start": { "line": 2881, "column": 1, "offset": 78976 }, - "end": { "line": 2881, "column": 81, "offset": 79056 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from([0, 0, 0, 5]);\n\nconsole.log(buf.readInt32BE(0));\n// Prints: 5", - "position": { - "start": { "line": 2883, "column": 1, "offset": 79058 }, - "end": { "line": 2890, "column": 4, "offset": 79193 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from([0, 0, 0, 5]);\n\nconsole.log(buf.readInt32BE(0));\n// Prints: 5", - "position": { - "start": { "line": 2892, "column": 1, "offset": 79195 }, - "end": { "line": 2899, "column": 4, "offset": 79335 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.readInt32LE([offset])", - "position": { - "start": { "line": 2901, "column": 5, "offset": 79341 }, - "end": { "line": 2901, "column": 32, "offset": 79368 } - } - } - ], - "position": { - "start": { "line": 2901, "column": 1, "offset": 79337 }, - "end": { "line": 2901, "column": 32, "offset": 79368 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 2903, "column": 1, "offset": 79370 }, - "end": { "line": 2910, "column": 4, "offset": 79594 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 2912, "column": 3, "offset": 79598 }, - "end": { "line": 2912, "column": 11, "offset": 79606 } - } - }, - { - "type": "text", - "value": " {integer} Number of bytes to skip before starting to read. Must\nsatisfy ", - "position": { - "start": { "line": 2912, "column": 11, "offset": 79606 }, - "end": { "line": 2913, "column": 11, "offset": 79681 } - } - }, - { - "type": "inlineCode", - "value": "0 <= offset <= buf.length - 4", - "position": { - "start": { "line": 2913, "column": 11, "offset": 79681 }, - "end": { "line": 2913, "column": 42, "offset": 79712 } - } - }, - { - "type": "text", - "value": ". ", - "position": { - "start": { "line": 2913, "column": 42, "offset": 79712 }, - "end": { "line": 2913, "column": 44, "offset": 79714 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { - "line": 2913, - "column": 46, - "offset": 79716 - }, - "end": { "line": 2913, "column": 54, "offset": 79724 } - } - } - ], - "position": { - "start": { "line": 2913, "column": 44, "offset": 79714 }, - "end": { "line": 2913, "column": 56, "offset": 79726 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 2913, "column": 56, "offset": 79726 }, - "end": { "line": 2913, "column": 57, "offset": 79727 } - } - }, - { - "type": "inlineCode", - "value": "0", - "position": { - "start": { "line": 2913, "column": 57, "offset": 79727 }, - "end": { "line": 2913, "column": 60, "offset": 79730 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 2913, "column": 60, "offset": 79730 }, - "end": { "line": 2913, "column": 61, "offset": 79731 } - } - } - ], - "position": { - "start": { "line": 2912, "column": 3, "offset": 79598 }, - "end": { "line": 2913, "column": 61, "offset": 79731 } - } - } - ], - "position": { - "start": { "line": 2912, "column": 1, "offset": 79596 }, - "end": { "line": 2913, "column": 61, "offset": 79731 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {integer}", - "position": { - "start": { "line": 2914, "column": 3, "offset": 79734 }, - "end": { "line": 2914, "column": 21, "offset": 79752 } - } - } - ], - "position": { - "start": { "line": 2914, "column": 3, "offset": 79734 }, - "end": { "line": 2914, "column": 21, "offset": 79752 } - } - } - ], - "position": { - "start": { "line": 2914, "column": 1, "offset": 79732 }, - "end": { "line": 2914, "column": 21, "offset": 79752 } - } - } - ], - "position": { - "start": { "line": 2912, "column": 1, "offset": 79596 }, - "end": { "line": 2914, "column": 21, "offset": 79752 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Reads a signed, little-endian 32-bit integer from ", - "position": { - "start": { "line": 2916, "column": 1, "offset": 79754 }, - "end": { "line": 2916, "column": 51, "offset": 79804 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 2916, "column": 51, "offset": 79804 }, - "end": { "line": 2916, "column": 56, "offset": 79809 } - } - }, - { - "type": "text", - "value": " at the specified\n", - "position": { - "start": { "line": 2916, "column": 56, "offset": 79809 }, - "end": { "line": 2917, "column": 1, "offset": 79827 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 2917, "column": 1, "offset": 79827 }, - "end": { "line": 2917, "column": 9, "offset": 79835 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 2917, "column": 9, "offset": 79835 }, - "end": { "line": 2917, "column": 10, "offset": 79836 } - } - } - ], - "position": { - "start": { "line": 2916, "column": 1, "offset": 79754 }, - "end": { "line": 2917, "column": 10, "offset": 79836 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Integers read from a ", - "position": { - "start": { "line": 2919, "column": 1, "offset": 79838 }, - "end": { "line": 2919, "column": 22, "offset": 79859 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 2919, "column": 22, "offset": 79859 }, - "end": { "line": 2919, "column": 30, "offset": 79867 } - } - }, - { - "type": "text", - "value": " are interpreted as two's complement signed values.", - "position": { - "start": { "line": 2919, "column": 30, "offset": 79867 }, - "end": { "line": 2919, "column": 81, "offset": 79918 } - } - } - ], - "position": { - "start": { "line": 2919, "column": 1, "offset": 79838 }, - "end": { "line": 2919, "column": 81, "offset": 79918 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from([0, 0, 0, 5]);\n\nconsole.log(buf.readInt32LE(0));\n// Prints: 83886080\nconsole.log(buf.readInt32LE(1));\n// Throws ERR_OUT_OF_RANGE.", - "position": { - "start": { "line": 2921, "column": 1, "offset": 79920 }, - "end": { "line": 2930, "column": 4, "offset": 80123 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from([0, 0, 0, 5]);\n\nconsole.log(buf.readInt32LE(0));\n// Prints: 83886080\nconsole.log(buf.readInt32LE(1));\n// Throws ERR_OUT_OF_RANGE.", - "position": { - "start": { "line": 2932, "column": 1, "offset": 80125 }, - "end": { "line": 2941, "column": 4, "offset": 80333 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.readIntBE(offset, byteLength)", - "position": { - "start": { "line": 2943, "column": 5, "offset": 80339 }, - "end": { "line": 2943, "column": 40, "offset": 80374 } - } - } - ], - "position": { - "start": { "line": 2943, "column": 1, "offset": 80335 }, - "end": { "line": 2943, "column": 40, "offset": 80374 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 2945, "column": 1, "offset": 80376 }, - "end": { "line": 2952, "column": 4, "offset": 80619 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 2954, "column": 3, "offset": 80623 }, - "end": { "line": 2954, "column": 11, "offset": 80631 } - } - }, - { - "type": "text", - "value": " {integer} Number of bytes to skip before starting to read. Must\nsatisfy ", - "position": { - "start": { "line": 2954, "column": 11, "offset": 80631 }, - "end": { "line": 2955, "column": 11, "offset": 80706 } - } - }, - { - "type": "inlineCode", - "value": "0 <= offset <= buf.length - byteLength", - "position": { - "start": { "line": 2955, "column": 11, "offset": 80706 }, - "end": { "line": 2955, "column": 51, "offset": 80746 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 2955, "column": 51, "offset": 80746 }, - "end": { "line": 2955, "column": 52, "offset": 80747 } - } - } - ], - "position": { - "start": { "line": 2954, "column": 3, "offset": 80623 }, - "end": { "line": 2955, "column": 52, "offset": 80747 } - } - } - ], - "position": { - "start": { "line": 2954, "column": 1, "offset": 80621 }, - "end": { "line": 2955, "column": 52, "offset": 80747 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "byteLength", - "position": { - "start": { "line": 2956, "column": 3, "offset": 80750 }, - "end": { "line": 2956, "column": 15, "offset": 80762 } - } - }, - { - "type": "text", - "value": " {integer} Number of bytes to read. Must satisfy\n", - "position": { - "start": { "line": 2956, "column": 15, "offset": 80762 }, - "end": { "line": 2957, "column": 1, "offset": 80811 } - } - }, - { - "type": "inlineCode", - "value": "0 < byteLength <= 6", - "position": { - "start": { "line": 2957, "column": 3, "offset": 80813 }, - "end": { "line": 2957, "column": 24, "offset": 80834 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 2957, "column": 24, "offset": 80834 }, - "end": { "line": 2957, "column": 25, "offset": 80835 } - } - } - ], - "position": { - "start": { "line": 2956, "column": 3, "offset": 80750 }, - "end": { "line": 2957, "column": 25, "offset": 80835 } - } - } - ], - "position": { - "start": { "line": 2956, "column": 1, "offset": 80748 }, - "end": { "line": 2957, "column": 25, "offset": 80835 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {integer}", - "position": { - "start": { "line": 2958, "column": 3, "offset": 80838 }, - "end": { "line": 2958, "column": 21, "offset": 80856 } - } - } - ], - "position": { - "start": { "line": 2958, "column": 3, "offset": 80838 }, - "end": { "line": 2958, "column": 21, "offset": 80856 } - } - } - ], - "position": { - "start": { "line": 2958, "column": 1, "offset": 80836 }, - "end": { "line": 2958, "column": 21, "offset": 80856 } - } - } - ], - "position": { - "start": { "line": 2954, "column": 1, "offset": 80621 }, - "end": { "line": 2958, "column": 21, "offset": 80856 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Reads ", - "position": { - "start": { "line": 2960, "column": 1, "offset": 80858 }, - "end": { "line": 2960, "column": 7, "offset": 80864 } - } - }, - { - "type": "inlineCode", - "value": "byteLength", - "position": { - "start": { "line": 2960, "column": 7, "offset": 80864 }, - "end": { "line": 2960, "column": 19, "offset": 80876 } - } - }, - { - "type": "text", - "value": " number of bytes from ", - "position": { - "start": { "line": 2960, "column": 19, "offset": 80876 }, - "end": { "line": 2960, "column": 41, "offset": 80898 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 2960, "column": 41, "offset": 80898 }, - "end": { "line": 2960, "column": 46, "offset": 80903 } - } - }, - { - "type": "text", - "value": " at the specified ", - "position": { - "start": { "line": 2960, "column": 46, "offset": 80903 }, - "end": { "line": 2960, "column": 64, "offset": 80921 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 2960, "column": 64, "offset": 80921 }, - "end": { "line": 2960, "column": 72, "offset": 80929 } - } - }, - { - "type": "text", - "value": "\nand interprets the result as a big-endian, two's complement signed value\nsupporting up to 48 bits of accuracy.", - "position": { - "start": { "line": 2960, "column": 72, "offset": 80929 }, - "end": { "line": 2962, "column": 38, "offset": 81040 } - } - } - ], - "position": { - "start": { "line": 2960, "column": 1, "offset": 80858 }, - "end": { "line": 2962, "column": 38, "offset": 81040 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]);\n\nconsole.log(buf.readIntBE(0, 6).toString(16));\n// Prints: 1234567890ab\nconsole.log(buf.readIntBE(1, 6).toString(16));\n// Throws ERR_OUT_OF_RANGE.\nconsole.log(buf.readIntBE(1, 0).toString(16));\n// Throws ERR_OUT_OF_RANGE.", - "position": { - "start": { "line": 2964, "column": 1, "offset": 81042 }, - "end": { "line": 2975, "column": 4, "offset": 81376 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]);\n\nconsole.log(buf.readIntBE(0, 6).toString(16));\n// Prints: 1234567890ab\nconsole.log(buf.readIntBE(1, 6).toString(16));\n// Throws ERR_OUT_OF_RANGE.\nconsole.log(buf.readIntBE(1, 0).toString(16));\n// Throws ERR_OUT_OF_RANGE.", - "position": { - "start": { "line": 2977, "column": 1, "offset": 81378 }, - "end": { "line": 2988, "column": 4, "offset": 81717 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.readIntLE(offset, byteLength)", - "position": { - "start": { "line": 2990, "column": 5, "offset": 81723 }, - "end": { "line": 2990, "column": 40, "offset": 81758 } - } - } - ], - "position": { - "start": { "line": 2990, "column": 1, "offset": 81719 }, - "end": { "line": 2990, "column": 40, "offset": 81758 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 2992, "column": 1, "offset": 81760 }, - "end": { "line": 2999, "column": 4, "offset": 82003 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 3001, "column": 3, "offset": 82007 }, - "end": { "line": 3001, "column": 11, "offset": 82015 } - } - }, - { - "type": "text", - "value": " {integer} Number of bytes to skip before starting to read. Must\nsatisfy ", - "position": { - "start": { "line": 3001, "column": 11, "offset": 82015 }, - "end": { "line": 3002, "column": 11, "offset": 82090 } - } - }, - { - "type": "inlineCode", - "value": "0 <= offset <= buf.length - byteLength", - "position": { - "start": { "line": 3002, "column": 11, "offset": 82090 }, - "end": { "line": 3002, "column": 51, "offset": 82130 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 3002, "column": 51, "offset": 82130 }, - "end": { "line": 3002, "column": 52, "offset": 82131 } - } - } - ], - "position": { - "start": { "line": 3001, "column": 3, "offset": 82007 }, - "end": { "line": 3002, "column": 52, "offset": 82131 } - } - } - ], - "position": { - "start": { "line": 3001, "column": 1, "offset": 82005 }, - "end": { "line": 3002, "column": 52, "offset": 82131 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "byteLength", - "position": { - "start": { "line": 3003, "column": 3, "offset": 82134 }, - "end": { "line": 3003, "column": 15, "offset": 82146 } - } - }, - { - "type": "text", - "value": " {integer} Number of bytes to read. Must satisfy\n", - "position": { - "start": { "line": 3003, "column": 15, "offset": 82146 }, - "end": { "line": 3004, "column": 1, "offset": 82195 } - } - }, - { - "type": "inlineCode", - "value": "0 < byteLength <= 6", - "position": { - "start": { "line": 3004, "column": 3, "offset": 82197 }, - "end": { "line": 3004, "column": 24, "offset": 82218 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 3004, "column": 24, "offset": 82218 }, - "end": { "line": 3004, "column": 25, "offset": 82219 } - } - } - ], - "position": { - "start": { "line": 3003, "column": 3, "offset": 82134 }, - "end": { "line": 3004, "column": 25, "offset": 82219 } - } - } - ], - "position": { - "start": { "line": 3003, "column": 1, "offset": 82132 }, - "end": { "line": 3004, "column": 25, "offset": 82219 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {integer}", - "position": { - "start": { "line": 3005, "column": 3, "offset": 82222 }, - "end": { "line": 3005, "column": 21, "offset": 82240 } - } - } - ], - "position": { - "start": { "line": 3005, "column": 3, "offset": 82222 }, - "end": { "line": 3005, "column": 21, "offset": 82240 } - } - } - ], - "position": { - "start": { "line": 3005, "column": 1, "offset": 82220 }, - "end": { "line": 3005, "column": 21, "offset": 82240 } - } - } - ], - "position": { - "start": { "line": 3001, "column": 1, "offset": 82005 }, - "end": { "line": 3005, "column": 21, "offset": 82240 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Reads ", - "position": { - "start": { "line": 3007, "column": 1, "offset": 82242 }, - "end": { "line": 3007, "column": 7, "offset": 82248 } - } - }, - { - "type": "inlineCode", - "value": "byteLength", - "position": { - "start": { "line": 3007, "column": 7, "offset": 82248 }, - "end": { "line": 3007, "column": 19, "offset": 82260 } - } - }, - { - "type": "text", - "value": " number of bytes from ", - "position": { - "start": { "line": 3007, "column": 19, "offset": 82260 }, - "end": { "line": 3007, "column": 41, "offset": 82282 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 3007, "column": 41, "offset": 82282 }, - "end": { "line": 3007, "column": 46, "offset": 82287 } - } - }, - { - "type": "text", - "value": " at the specified ", - "position": { - "start": { "line": 3007, "column": 46, "offset": 82287 }, - "end": { "line": 3007, "column": 64, "offset": 82305 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 3007, "column": 64, "offset": 82305 }, - "end": { "line": 3007, "column": 72, "offset": 82313 } - } - }, - { - "type": "text", - "value": "\nand interprets the result as a little-endian, two's complement signed value\nsupporting up to 48 bits of accuracy.", - "position": { - "start": { "line": 3007, "column": 72, "offset": 82313 }, - "end": { "line": 3009, "column": 38, "offset": 82427 } - } - } - ], - "position": { - "start": { "line": 3007, "column": 1, "offset": 82242 }, - "end": { "line": 3009, "column": 38, "offset": 82427 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]);\n\nconsole.log(buf.readIntLE(0, 6).toString(16));\n// Prints: -546f87a9cbee", - "position": { - "start": { "line": 3011, "column": 1, "offset": 82429 }, - "end": { "line": 3018, "column": 4, "offset": 82614 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]);\n\nconsole.log(buf.readIntLE(0, 6).toString(16));\n// Prints: -546f87a9cbee", - "position": { - "start": { "line": 3020, "column": 1, "offset": 82616 }, - "end": { "line": 3027, "column": 4, "offset": 82806 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.readUInt8([offset])", - "position": { - "start": { "line": 3029, "column": 5, "offset": 82812 }, - "end": { "line": 3029, "column": 30, "offset": 82837 } - } - } - ], - "position": { - "start": { "line": 3029, "column": 1, "offset": 82808 }, - "end": { "line": 3029, "column": 30, "offset": 82837 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 3031, "column": 1, "offset": 82839 }, - "end": { "line": 3043, "column": 4, "offset": 83230 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 3045, "column": 3, "offset": 83234 }, - "end": { "line": 3045, "column": 11, "offset": 83242 } - } - }, - { - "type": "text", - "value": " {integer} Number of bytes to skip before starting to read. Must\nsatisfy ", - "position": { - "start": { "line": 3045, "column": 11, "offset": 83242 }, - "end": { "line": 3046, "column": 11, "offset": 83317 } - } - }, - { - "type": "inlineCode", - "value": "0 <= offset <= buf.length - 1", - "position": { - "start": { "line": 3046, "column": 11, "offset": 83317 }, - "end": { "line": 3046, "column": 42, "offset": 83348 } - } - }, - { - "type": "text", - "value": ". ", - "position": { - "start": { "line": 3046, "column": 42, "offset": 83348 }, - "end": { "line": 3046, "column": 44, "offset": 83350 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { - "line": 3046, - "column": 46, - "offset": 83352 - }, - "end": { "line": 3046, "column": 54, "offset": 83360 } - } - } - ], - "position": { - "start": { "line": 3046, "column": 44, "offset": 83350 }, - "end": { "line": 3046, "column": 56, "offset": 83362 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 3046, "column": 56, "offset": 83362 }, - "end": { "line": 3046, "column": 57, "offset": 83363 } - } - }, - { - "type": "inlineCode", - "value": "0", - "position": { - "start": { "line": 3046, "column": 57, "offset": 83363 }, - "end": { "line": 3046, "column": 60, "offset": 83366 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 3046, "column": 60, "offset": 83366 }, - "end": { "line": 3046, "column": 61, "offset": 83367 } - } - } - ], - "position": { - "start": { "line": 3045, "column": 3, "offset": 83234 }, - "end": { "line": 3046, "column": 61, "offset": 83367 } - } - } - ], - "position": { - "start": { "line": 3045, "column": 1, "offset": 83232 }, - "end": { "line": 3046, "column": 61, "offset": 83367 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {integer}", - "position": { - "start": { "line": 3047, "column": 3, "offset": 83370 }, - "end": { "line": 3047, "column": 21, "offset": 83388 } - } - } - ], - "position": { - "start": { "line": 3047, "column": 3, "offset": 83370 }, - "end": { "line": 3047, "column": 21, "offset": 83388 } - } - } - ], - "position": { - "start": { "line": 3047, "column": 1, "offset": 83368 }, - "end": { "line": 3047, "column": 21, "offset": 83388 } - } - } - ], - "position": { - "start": { "line": 3045, "column": 1, "offset": 83232 }, - "end": { "line": 3047, "column": 21, "offset": 83388 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Reads an unsigned 8-bit integer from ", - "position": { - "start": { "line": 3049, "column": 1, "offset": 83390 }, - "end": { "line": 3049, "column": 38, "offset": 83427 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 3049, "column": 38, "offset": 83427 }, - "end": { "line": 3049, "column": 43, "offset": 83432 } - } - }, - { - "type": "text", - "value": " at the specified ", - "position": { - "start": { "line": 3049, "column": 43, "offset": 83432 }, - "end": { "line": 3049, "column": 61, "offset": 83450 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 3049, "column": 61, "offset": 83450 }, - "end": { "line": 3049, "column": 69, "offset": 83458 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 3049, "column": 69, "offset": 83458 }, - "end": { "line": 3049, "column": 70, "offset": 83459 } - } - } - ], - "position": { - "start": { "line": 3049, "column": 1, "offset": 83390 }, - "end": { "line": 3049, "column": 70, "offset": 83459 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This function is also available under the ", - "position": { - "start": { "line": 3051, "column": 1, "offset": 83461 }, - "end": { "line": 3051, "column": 43, "offset": 83503 } - } - }, - { - "type": "inlineCode", - "value": "readUint8", - "position": { - "start": { "line": 3051, "column": 43, "offset": 83503 }, - "end": { "line": 3051, "column": 54, "offset": 83514 } - } - }, - { - "type": "text", - "value": " alias.", - "position": { - "start": { "line": 3051, "column": 54, "offset": 83514 }, - "end": { "line": 3051, "column": 61, "offset": 83521 } - } - } - ], - "position": { - "start": { "line": 3051, "column": 1, "offset": 83461 }, - "end": { "line": 3051, "column": 61, "offset": 83521 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from([1, -2]);\n\nconsole.log(buf.readUInt8(0));\n// Prints: 1\nconsole.log(buf.readUInt8(1));\n// Prints: 254\nconsole.log(buf.readUInt8(2));\n// Throws ERR_OUT_OF_RANGE.", - "position": { - "start": { "line": 3053, "column": 1, "offset": 83523 }, - "end": { "line": 3064, "column": 4, "offset": 83756 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from([1, -2]);\n\nconsole.log(buf.readUInt8(0));\n// Prints: 1\nconsole.log(buf.readUInt8(1));\n// Prints: 254\nconsole.log(buf.readUInt8(2));\n// Throws ERR_OUT_OF_RANGE.", - "position": { - "start": { "line": 3066, "column": 1, "offset": 83758 }, - "end": { "line": 3077, "column": 4, "offset": 83996 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.readUInt16BE([offset])", - "position": { - "start": { "line": 3079, "column": 5, "offset": 84002 }, - "end": { "line": 3079, "column": 33, "offset": 84030 } - } - } - ], - "position": { - "start": { "line": 3079, "column": 1, "offset": 83998 }, - "end": { "line": 3079, "column": 33, "offset": 84030 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 3081, "column": 1, "offset": 84032 }, - "end": { "line": 3093, "column": 4, "offset": 84426 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 3095, "column": 3, "offset": 84430 }, - "end": { "line": 3095, "column": 11, "offset": 84438 } - } - }, - { - "type": "text", - "value": " {integer} Number of bytes to skip before starting to read. Must\nsatisfy ", - "position": { - "start": { "line": 3095, "column": 11, "offset": 84438 }, - "end": { "line": 3096, "column": 11, "offset": 84513 } - } - }, - { - "type": "inlineCode", - "value": "0 <= offset <= buf.length - 2", - "position": { - "start": { "line": 3096, "column": 11, "offset": 84513 }, - "end": { "line": 3096, "column": 42, "offset": 84544 } - } - }, - { - "type": "text", - "value": ". ", - "position": { - "start": { "line": 3096, "column": 42, "offset": 84544 }, - "end": { "line": 3096, "column": 44, "offset": 84546 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { - "line": 3096, - "column": 46, - "offset": 84548 - }, - "end": { "line": 3096, "column": 54, "offset": 84556 } - } - } - ], - "position": { - "start": { "line": 3096, "column": 44, "offset": 84546 }, - "end": { "line": 3096, "column": 56, "offset": 84558 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 3096, "column": 56, "offset": 84558 }, - "end": { "line": 3096, "column": 57, "offset": 84559 } - } - }, - { - "type": "inlineCode", - "value": "0", - "position": { - "start": { "line": 3096, "column": 57, "offset": 84559 }, - "end": { "line": 3096, "column": 60, "offset": 84562 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 3096, "column": 60, "offset": 84562 }, - "end": { "line": 3096, "column": 61, "offset": 84563 } - } - } - ], - "position": { - "start": { "line": 3095, "column": 3, "offset": 84430 }, - "end": { "line": 3096, "column": 61, "offset": 84563 } - } - } - ], - "position": { - "start": { "line": 3095, "column": 1, "offset": 84428 }, - "end": { "line": 3096, "column": 61, "offset": 84563 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {integer}", - "position": { - "start": { "line": 3097, "column": 3, "offset": 84566 }, - "end": { "line": 3097, "column": 21, "offset": 84584 } - } - } - ], - "position": { - "start": { "line": 3097, "column": 3, "offset": 84566 }, - "end": { "line": 3097, "column": 21, "offset": 84584 } - } - } - ], - "position": { - "start": { "line": 3097, "column": 1, "offset": 84564 }, - "end": { "line": 3097, "column": 21, "offset": 84584 } - } - } - ], - "position": { - "start": { "line": 3095, "column": 1, "offset": 84428 }, - "end": { "line": 3097, "column": 21, "offset": 84584 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Reads an unsigned, big-endian 16-bit integer from ", - "position": { - "start": { "line": 3099, "column": 1, "offset": 84586 }, - "end": { "line": 3099, "column": 51, "offset": 84636 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 3099, "column": 51, "offset": 84636 }, - "end": { "line": 3099, "column": 56, "offset": 84641 } - } - }, - { - "type": "text", - "value": " at the specified\n", - "position": { - "start": { "line": 3099, "column": 56, "offset": 84641 }, - "end": { "line": 3100, "column": 1, "offset": 84659 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 3100, "column": 1, "offset": 84659 }, - "end": { "line": 3100, "column": 9, "offset": 84667 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 3100, "column": 9, "offset": 84667 }, - "end": { "line": 3100, "column": 10, "offset": 84668 } - } - } - ], - "position": { - "start": { "line": 3099, "column": 1, "offset": 84586 }, - "end": { "line": 3100, "column": 10, "offset": 84668 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This function is also available under the ", - "position": { - "start": { "line": 3102, "column": 1, "offset": 84670 }, - "end": { "line": 3102, "column": 43, "offset": 84712 } - } - }, - { - "type": "inlineCode", - "value": "readUint16BE", - "position": { - "start": { "line": 3102, "column": 43, "offset": 84712 }, - "end": { "line": 3102, "column": 57, "offset": 84726 } - } - }, - { - "type": "text", - "value": " alias.", - "position": { - "start": { "line": 3102, "column": 57, "offset": 84726 }, - "end": { "line": 3102, "column": 64, "offset": 84733 } - } - } - ], - "position": { - "start": { "line": 3102, "column": 1, "offset": 84670 }, - "end": { "line": 3102, "column": 64, "offset": 84733 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from([0x12, 0x34, 0x56]);\n\nconsole.log(buf.readUInt16BE(0).toString(16));\n// Prints: 1234\nconsole.log(buf.readUInt16BE(1).toString(16));\n// Prints: 3456", - "position": { - "start": { "line": 3104, "column": 1, "offset": 84735 }, - "end": { "line": 3113, "column": 4, "offset": 84956 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from([0x12, 0x34, 0x56]);\n\nconsole.log(buf.readUInt16BE(0).toString(16));\n// Prints: 1234\nconsole.log(buf.readUInt16BE(1).toString(16));\n// Prints: 3456", - "position": { - "start": { "line": 3115, "column": 1, "offset": 84958 }, - "end": { "line": 3124, "column": 4, "offset": 85184 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.readUInt16LE([offset])", - "position": { - "start": { "line": 3126, "column": 5, "offset": 85190 }, - "end": { "line": 3126, "column": 33, "offset": 85218 } - } - } - ], - "position": { - "start": { "line": 3126, "column": 1, "offset": 85186 }, - "end": { "line": 3126, "column": 33, "offset": 85218 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 3128, "column": 1, "offset": 85220 }, - "end": { "line": 3140, "column": 4, "offset": 85614 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 3142, "column": 3, "offset": 85618 }, - "end": { "line": 3142, "column": 11, "offset": 85626 } - } - }, - { - "type": "text", - "value": " {integer} Number of bytes to skip before starting to read. Must\nsatisfy ", - "position": { - "start": { "line": 3142, "column": 11, "offset": 85626 }, - "end": { "line": 3143, "column": 11, "offset": 85701 } - } - }, - { - "type": "inlineCode", - "value": "0 <= offset <= buf.length - 2", - "position": { - "start": { "line": 3143, "column": 11, "offset": 85701 }, - "end": { "line": 3143, "column": 42, "offset": 85732 } - } - }, - { - "type": "text", - "value": ". ", - "position": { - "start": { "line": 3143, "column": 42, "offset": 85732 }, - "end": { "line": 3143, "column": 44, "offset": 85734 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { - "line": 3143, - "column": 46, - "offset": 85736 - }, - "end": { "line": 3143, "column": 54, "offset": 85744 } - } - } - ], - "position": { - "start": { "line": 3143, "column": 44, "offset": 85734 }, - "end": { "line": 3143, "column": 56, "offset": 85746 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 3143, "column": 56, "offset": 85746 }, - "end": { "line": 3143, "column": 57, "offset": 85747 } - } - }, - { - "type": "inlineCode", - "value": "0", - "position": { - "start": { "line": 3143, "column": 57, "offset": 85747 }, - "end": { "line": 3143, "column": 60, "offset": 85750 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 3143, "column": 60, "offset": 85750 }, - "end": { "line": 3143, "column": 61, "offset": 85751 } - } - } - ], - "position": { - "start": { "line": 3142, "column": 3, "offset": 85618 }, - "end": { "line": 3143, "column": 61, "offset": 85751 } - } - } - ], - "position": { - "start": { "line": 3142, "column": 1, "offset": 85616 }, - "end": { "line": 3143, "column": 61, "offset": 85751 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {integer}", - "position": { - "start": { "line": 3144, "column": 3, "offset": 85754 }, - "end": { "line": 3144, "column": 21, "offset": 85772 } - } - } - ], - "position": { - "start": { "line": 3144, "column": 3, "offset": 85754 }, - "end": { "line": 3144, "column": 21, "offset": 85772 } - } - } - ], - "position": { - "start": { "line": 3144, "column": 1, "offset": 85752 }, - "end": { "line": 3144, "column": 21, "offset": 85772 } - } - } - ], - "position": { - "start": { "line": 3142, "column": 1, "offset": 85616 }, - "end": { "line": 3144, "column": 21, "offset": 85772 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Reads an unsigned, little-endian 16-bit integer from ", - "position": { - "start": { "line": 3146, "column": 1, "offset": 85774 }, - "end": { "line": 3146, "column": 54, "offset": 85827 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 3146, "column": 54, "offset": 85827 }, - "end": { "line": 3146, "column": 59, "offset": 85832 } - } - }, - { - "type": "text", - "value": " at the specified\n", - "position": { - "start": { "line": 3146, "column": 59, "offset": 85832 }, - "end": { "line": 3147, "column": 1, "offset": 85850 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 3147, "column": 1, "offset": 85850 }, - "end": { "line": 3147, "column": 9, "offset": 85858 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 3147, "column": 9, "offset": 85858 }, - "end": { "line": 3147, "column": 10, "offset": 85859 } - } - } - ], - "position": { - "start": { "line": 3146, "column": 1, "offset": 85774 }, - "end": { "line": 3147, "column": 10, "offset": 85859 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This function is also available under the ", - "position": { - "start": { "line": 3149, "column": 1, "offset": 85861 }, - "end": { "line": 3149, "column": 43, "offset": 85903 } - } - }, - { - "type": "inlineCode", - "value": "readUint16LE", - "position": { - "start": { "line": 3149, "column": 43, "offset": 85903 }, - "end": { "line": 3149, "column": 57, "offset": 85917 } - } - }, - { - "type": "text", - "value": " alias.", - "position": { - "start": { "line": 3149, "column": 57, "offset": 85917 }, - "end": { "line": 3149, "column": 64, "offset": 85924 } - } - } - ], - "position": { - "start": { "line": 3149, "column": 1, "offset": 85861 }, - "end": { "line": 3149, "column": 64, "offset": 85924 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from([0x12, 0x34, 0x56]);\n\nconsole.log(buf.readUInt16LE(0).toString(16));\n// Prints: 3412\nconsole.log(buf.readUInt16LE(1).toString(16));\n// Prints: 5634\nconsole.log(buf.readUInt16LE(2).toString(16));\n// Throws ERR_OUT_OF_RANGE.", - "position": { - "start": { "line": 3151, "column": 1, "offset": 85926 }, - "end": { "line": 3162, "column": 4, "offset": 86222 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from([0x12, 0x34, 0x56]);\n\nconsole.log(buf.readUInt16LE(0).toString(16));\n// Prints: 3412\nconsole.log(buf.readUInt16LE(1).toString(16));\n// Prints: 5634\nconsole.log(buf.readUInt16LE(2).toString(16));\n// Throws ERR_OUT_OF_RANGE.", - "position": { - "start": { "line": 3164, "column": 1, "offset": 86224 }, - "end": { "line": 3175, "column": 4, "offset": 86525 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.readUInt32BE([offset])", - "position": { - "start": { "line": 3177, "column": 5, "offset": 86531 }, - "end": { "line": 3177, "column": 33, "offset": 86559 } - } - } - ], - "position": { - "start": { "line": 3177, "column": 1, "offset": 86527 }, - "end": { "line": 3177, "column": 33, "offset": 86559 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 3179, "column": 1, "offset": 86561 }, - "end": { "line": 3191, "column": 4, "offset": 86955 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 3193, "column": 3, "offset": 86959 }, - "end": { "line": 3193, "column": 11, "offset": 86967 } - } - }, - { - "type": "text", - "value": " {integer} Number of bytes to skip before starting to read. Must\nsatisfy ", - "position": { - "start": { "line": 3193, "column": 11, "offset": 86967 }, - "end": { "line": 3194, "column": 11, "offset": 87042 } - } - }, - { - "type": "inlineCode", - "value": "0 <= offset <= buf.length - 4", - "position": { - "start": { "line": 3194, "column": 11, "offset": 87042 }, - "end": { "line": 3194, "column": 42, "offset": 87073 } - } - }, - { - "type": "text", - "value": ". ", - "position": { - "start": { "line": 3194, "column": 42, "offset": 87073 }, - "end": { "line": 3194, "column": 44, "offset": 87075 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { - "line": 3194, - "column": 46, - "offset": 87077 - }, - "end": { "line": 3194, "column": 54, "offset": 87085 } - } - } - ], - "position": { - "start": { "line": 3194, "column": 44, "offset": 87075 }, - "end": { "line": 3194, "column": 56, "offset": 87087 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 3194, "column": 56, "offset": 87087 }, - "end": { "line": 3194, "column": 57, "offset": 87088 } - } - }, - { - "type": "inlineCode", - "value": "0", - "position": { - "start": { "line": 3194, "column": 57, "offset": 87088 }, - "end": { "line": 3194, "column": 60, "offset": 87091 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 3194, "column": 60, "offset": 87091 }, - "end": { "line": 3194, "column": 61, "offset": 87092 } - } - } - ], - "position": { - "start": { "line": 3193, "column": 3, "offset": 86959 }, - "end": { "line": 3194, "column": 61, "offset": 87092 } - } - } - ], - "position": { - "start": { "line": 3193, "column": 1, "offset": 86957 }, - "end": { "line": 3194, "column": 61, "offset": 87092 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {integer}", - "position": { - "start": { "line": 3195, "column": 3, "offset": 87095 }, - "end": { "line": 3195, "column": 21, "offset": 87113 } - } - } - ], - "position": { - "start": { "line": 3195, "column": 3, "offset": 87095 }, - "end": { "line": 3195, "column": 21, "offset": 87113 } - } - } - ], - "position": { - "start": { "line": 3195, "column": 1, "offset": 87093 }, - "end": { "line": 3195, "column": 21, "offset": 87113 } - } - } - ], - "position": { - "start": { "line": 3193, "column": 1, "offset": 86957 }, - "end": { "line": 3195, "column": 21, "offset": 87113 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Reads an unsigned, big-endian 32-bit integer from ", - "position": { - "start": { "line": 3197, "column": 1, "offset": 87115 }, - "end": { "line": 3197, "column": 51, "offset": 87165 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 3197, "column": 51, "offset": 87165 }, - "end": { "line": 3197, "column": 56, "offset": 87170 } - } - }, - { - "type": "text", - "value": " at the specified\n", - "position": { - "start": { "line": 3197, "column": 56, "offset": 87170 }, - "end": { "line": 3198, "column": 1, "offset": 87188 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 3198, "column": 1, "offset": 87188 }, - "end": { "line": 3198, "column": 9, "offset": 87196 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 3198, "column": 9, "offset": 87196 }, - "end": { "line": 3198, "column": 10, "offset": 87197 } - } - } - ], - "position": { - "start": { "line": 3197, "column": 1, "offset": 87115 }, - "end": { "line": 3198, "column": 10, "offset": 87197 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This function is also available under the ", - "position": { - "start": { "line": 3200, "column": 1, "offset": 87199 }, - "end": { "line": 3200, "column": 43, "offset": 87241 } - } - }, - { - "type": "inlineCode", - "value": "readUint32BE", - "position": { - "start": { "line": 3200, "column": 43, "offset": 87241 }, - "end": { "line": 3200, "column": 57, "offset": 87255 } - } - }, - { - "type": "text", - "value": " alias.", - "position": { - "start": { "line": 3200, "column": 57, "offset": 87255 }, - "end": { "line": 3200, "column": 64, "offset": 87262 } - } - } - ], - "position": { - "start": { "line": 3200, "column": 1, "offset": 87199 }, - "end": { "line": 3200, "column": 64, "offset": 87262 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from([0x12, 0x34, 0x56, 0x78]);\n\nconsole.log(buf.readUInt32BE(0).toString(16));\n// Prints: 12345678", - "position": { - "start": { "line": 3202, "column": 1, "offset": 87264 }, - "end": { "line": 3209, "column": 4, "offset": 87432 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from([0x12, 0x34, 0x56, 0x78]);\n\nconsole.log(buf.readUInt32BE(0).toString(16));\n// Prints: 12345678", - "position": { - "start": { "line": 3211, "column": 1, "offset": 87434 }, - "end": { "line": 3218, "column": 4, "offset": 87607 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.readUInt32LE([offset])", - "position": { - "start": { "line": 3220, "column": 5, "offset": 87613 }, - "end": { "line": 3220, "column": 33, "offset": 87641 } - } - } - ], - "position": { - "start": { "line": 3220, "column": 1, "offset": 87609 }, - "end": { "line": 3220, "column": 33, "offset": 87641 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 3222, "column": 1, "offset": 87643 }, - "end": { "line": 3234, "column": 4, "offset": 88037 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 3236, "column": 3, "offset": 88041 }, - "end": { "line": 3236, "column": 11, "offset": 88049 } - } - }, - { - "type": "text", - "value": " {integer} Number of bytes to skip before starting to read. Must\nsatisfy ", - "position": { - "start": { "line": 3236, "column": 11, "offset": 88049 }, - "end": { "line": 3237, "column": 11, "offset": 88124 } - } - }, - { - "type": "inlineCode", - "value": "0 <= offset <= buf.length - 4", - "position": { - "start": { "line": 3237, "column": 11, "offset": 88124 }, - "end": { "line": 3237, "column": 42, "offset": 88155 } - } - }, - { - "type": "text", - "value": ". ", - "position": { - "start": { "line": 3237, "column": 42, "offset": 88155 }, - "end": { "line": 3237, "column": 44, "offset": 88157 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { - "line": 3237, - "column": 46, - "offset": 88159 - }, - "end": { "line": 3237, "column": 54, "offset": 88167 } - } - } - ], - "position": { - "start": { "line": 3237, "column": 44, "offset": 88157 }, - "end": { "line": 3237, "column": 56, "offset": 88169 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 3237, "column": 56, "offset": 88169 }, - "end": { "line": 3237, "column": 57, "offset": 88170 } - } - }, - { - "type": "inlineCode", - "value": "0", - "position": { - "start": { "line": 3237, "column": 57, "offset": 88170 }, - "end": { "line": 3237, "column": 60, "offset": 88173 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 3237, "column": 60, "offset": 88173 }, - "end": { "line": 3237, "column": 61, "offset": 88174 } - } - } - ], - "position": { - "start": { "line": 3236, "column": 3, "offset": 88041 }, - "end": { "line": 3237, "column": 61, "offset": 88174 } - } - } - ], - "position": { - "start": { "line": 3236, "column": 1, "offset": 88039 }, - "end": { "line": 3237, "column": 61, "offset": 88174 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {integer}", - "position": { - "start": { "line": 3238, "column": 3, "offset": 88177 }, - "end": { "line": 3238, "column": 21, "offset": 88195 } - } - } - ], - "position": { - "start": { "line": 3238, "column": 3, "offset": 88177 }, - "end": { "line": 3238, "column": 21, "offset": 88195 } - } - } - ], - "position": { - "start": { "line": 3238, "column": 1, "offset": 88175 }, - "end": { "line": 3238, "column": 21, "offset": 88195 } - } - } - ], - "position": { - "start": { "line": 3236, "column": 1, "offset": 88039 }, - "end": { "line": 3238, "column": 21, "offset": 88195 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Reads an unsigned, little-endian 32-bit integer from ", - "position": { - "start": { "line": 3240, "column": 1, "offset": 88197 }, - "end": { "line": 3240, "column": 54, "offset": 88250 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 3240, "column": 54, "offset": 88250 }, - "end": { "line": 3240, "column": 59, "offset": 88255 } - } - }, - { - "type": "text", - "value": " at the specified\n", - "position": { - "start": { "line": 3240, "column": 59, "offset": 88255 }, - "end": { "line": 3241, "column": 1, "offset": 88273 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 3241, "column": 1, "offset": 88273 }, - "end": { "line": 3241, "column": 9, "offset": 88281 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 3241, "column": 9, "offset": 88281 }, - "end": { "line": 3241, "column": 10, "offset": 88282 } - } - } - ], - "position": { - "start": { "line": 3240, "column": 1, "offset": 88197 }, - "end": { "line": 3241, "column": 10, "offset": 88282 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This function is also available under the ", - "position": { - "start": { "line": 3243, "column": 1, "offset": 88284 }, - "end": { "line": 3243, "column": 43, "offset": 88326 } - } - }, - { - "type": "inlineCode", - "value": "readUint32LE", - "position": { - "start": { "line": 3243, "column": 43, "offset": 88326 }, - "end": { "line": 3243, "column": 57, "offset": 88340 } - } - }, - { - "type": "text", - "value": " alias.", - "position": { - "start": { "line": 3243, "column": 57, "offset": 88340 }, - "end": { "line": 3243, "column": 64, "offset": 88347 } - } - } - ], - "position": { - "start": { "line": 3243, "column": 1, "offset": 88284 }, - "end": { "line": 3243, "column": 64, "offset": 88347 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from([0x12, 0x34, 0x56, 0x78]);\n\nconsole.log(buf.readUInt32LE(0).toString(16));\n// Prints: 78563412\nconsole.log(buf.readUInt32LE(1).toString(16));\n// Throws ERR_OUT_OF_RANGE.", - "position": { - "start": { "line": 3245, "column": 1, "offset": 88349 }, - "end": { "line": 3254, "column": 4, "offset": 88592 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from([0x12, 0x34, 0x56, 0x78]);\n\nconsole.log(buf.readUInt32LE(0).toString(16));\n// Prints: 78563412\nconsole.log(buf.readUInt32LE(1).toString(16));\n// Throws ERR_OUT_OF_RANGE.", - "position": { - "start": { "line": 3256, "column": 1, "offset": 88594 }, - "end": { "line": 3265, "column": 4, "offset": 88842 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.readUIntBE(offset, byteLength)", - "position": { - "start": { "line": 3267, "column": 5, "offset": 88848 }, - "end": { "line": 3267, "column": 41, "offset": 88884 } - } - } - ], - "position": { - "start": { "line": 3267, "column": 1, "offset": 88844 }, - "end": { "line": 3267, "column": 41, "offset": 88884 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 3269, "column": 1, "offset": 88886 }, - "end": { "line": 3281, "column": 4, "offset": 89297 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 3283, "column": 3, "offset": 89301 }, - "end": { "line": 3283, "column": 11, "offset": 89309 } - } - }, - { - "type": "text", - "value": " {integer} Number of bytes to skip before starting to read. Must\nsatisfy ", - "position": { - "start": { "line": 3283, "column": 11, "offset": 89309 }, - "end": { "line": 3284, "column": 11, "offset": 89384 } - } - }, - { - "type": "inlineCode", - "value": "0 <= offset <= buf.length - byteLength", - "position": { - "start": { "line": 3284, "column": 11, "offset": 89384 }, - "end": { "line": 3284, "column": 51, "offset": 89424 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 3284, "column": 51, "offset": 89424 }, - "end": { "line": 3284, "column": 52, "offset": 89425 } - } - } - ], - "position": { - "start": { "line": 3283, "column": 3, "offset": 89301 }, - "end": { "line": 3284, "column": 52, "offset": 89425 } - } - } - ], - "position": { - "start": { "line": 3283, "column": 1, "offset": 89299 }, - "end": { "line": 3284, "column": 52, "offset": 89425 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "byteLength", - "position": { - "start": { "line": 3285, "column": 3, "offset": 89428 }, - "end": { "line": 3285, "column": 15, "offset": 89440 } - } - }, - { - "type": "text", - "value": " {integer} Number of bytes to read. Must satisfy\n", - "position": { - "start": { "line": 3285, "column": 15, "offset": 89440 }, - "end": { "line": 3286, "column": 1, "offset": 89489 } - } - }, - { - "type": "inlineCode", - "value": "0 < byteLength <= 6", - "position": { - "start": { "line": 3286, "column": 3, "offset": 89491 }, - "end": { "line": 3286, "column": 24, "offset": 89512 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 3286, "column": 24, "offset": 89512 }, - "end": { "line": 3286, "column": 25, "offset": 89513 } - } - } - ], - "position": { - "start": { "line": 3285, "column": 3, "offset": 89428 }, - "end": { "line": 3286, "column": 25, "offset": 89513 } - } - } - ], - "position": { - "start": { "line": 3285, "column": 1, "offset": 89426 }, - "end": { "line": 3286, "column": 25, "offset": 89513 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {integer}", - "position": { - "start": { "line": 3287, "column": 3, "offset": 89516 }, - "end": { "line": 3287, "column": 21, "offset": 89534 } - } - } - ], - "position": { - "start": { "line": 3287, "column": 3, "offset": 89516 }, - "end": { "line": 3287, "column": 21, "offset": 89534 } - } - } - ], - "position": { - "start": { "line": 3287, "column": 1, "offset": 89514 }, - "end": { "line": 3287, "column": 21, "offset": 89534 } - } - } - ], - "position": { - "start": { "line": 3283, "column": 1, "offset": 89299 }, - "end": { "line": 3287, "column": 21, "offset": 89534 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Reads ", - "position": { - "start": { "line": 3289, "column": 1, "offset": 89536 }, - "end": { "line": 3289, "column": 7, "offset": 89542 } - } - }, - { - "type": "inlineCode", - "value": "byteLength", - "position": { - "start": { "line": 3289, "column": 7, "offset": 89542 }, - "end": { "line": 3289, "column": 19, "offset": 89554 } - } - }, - { - "type": "text", - "value": " number of bytes from ", - "position": { - "start": { "line": 3289, "column": 19, "offset": 89554 }, - "end": { "line": 3289, "column": 41, "offset": 89576 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 3289, "column": 41, "offset": 89576 }, - "end": { "line": 3289, "column": 46, "offset": 89581 } - } - }, - { - "type": "text", - "value": " at the specified ", - "position": { - "start": { "line": 3289, "column": 46, "offset": 89581 }, - "end": { "line": 3289, "column": 64, "offset": 89599 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 3289, "column": 64, "offset": 89599 }, - "end": { "line": 3289, "column": 72, "offset": 89607 } - } - }, - { - "type": "text", - "value": "\nand interprets the result as an unsigned big-endian integer supporting\nup to 48 bits of accuracy.", - "position": { - "start": { "line": 3289, "column": 72, "offset": 89607 }, - "end": { "line": 3291, "column": 27, "offset": 89705 } - } - } - ], - "position": { - "start": { "line": 3289, "column": 1, "offset": 89536 }, - "end": { "line": 3291, "column": 27, "offset": 89705 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This function is also available under the ", - "position": { - "start": { "line": 3293, "column": 1, "offset": 89707 }, - "end": { "line": 3293, "column": 43, "offset": 89749 } - } - }, - { - "type": "inlineCode", - "value": "readUintBE", - "position": { - "start": { "line": 3293, "column": 43, "offset": 89749 }, - "end": { "line": 3293, "column": 55, "offset": 89761 } - } - }, - { - "type": "text", - "value": " alias.", - "position": { - "start": { "line": 3293, "column": 55, "offset": 89761 }, - "end": { "line": 3293, "column": 62, "offset": 89768 } - } - } - ], - "position": { - "start": { "line": 3293, "column": 1, "offset": 89707 }, - "end": { "line": 3293, "column": 62, "offset": 89768 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]);\n\nconsole.log(buf.readUIntBE(0, 6).toString(16));\n// Prints: 1234567890ab\nconsole.log(buf.readUIntBE(1, 6).toString(16));\n// Throws ERR_OUT_OF_RANGE.", - "position": { - "start": { "line": 3295, "column": 1, "offset": 89770 }, - "end": { "line": 3304, "column": 4, "offset": 90031 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]);\n\nconsole.log(buf.readUIntBE(0, 6).toString(16));\n// Prints: 1234567890ab\nconsole.log(buf.readUIntBE(1, 6).toString(16));\n// Throws ERR_OUT_OF_RANGE.", - "position": { - "start": { "line": 3306, "column": 1, "offset": 90033 }, - "end": { "line": 3315, "column": 4, "offset": 90299 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.readUIntLE(offset, byteLength)", - "position": { - "start": { "line": 3317, "column": 5, "offset": 90305 }, - "end": { "line": 3317, "column": 41, "offset": 90341 } - } - } - ], - "position": { - "start": { "line": 3317, "column": 1, "offset": 90301 }, - "end": { "line": 3317, "column": 41, "offset": 90341 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 3319, "column": 1, "offset": 90343 }, - "end": { "line": 3331, "column": 4, "offset": 90754 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 3333, "column": 3, "offset": 90758 }, - "end": { "line": 3333, "column": 11, "offset": 90766 } - } - }, - { - "type": "text", - "value": " {integer} Number of bytes to skip before starting to read. Must\nsatisfy ", - "position": { - "start": { "line": 3333, "column": 11, "offset": 90766 }, - "end": { "line": 3334, "column": 11, "offset": 90841 } - } - }, - { - "type": "inlineCode", - "value": "0 <= offset <= buf.length - byteLength", - "position": { - "start": { "line": 3334, "column": 11, "offset": 90841 }, - "end": { "line": 3334, "column": 51, "offset": 90881 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 3334, "column": 51, "offset": 90881 }, - "end": { "line": 3334, "column": 52, "offset": 90882 } - } - } - ], - "position": { - "start": { "line": 3333, "column": 3, "offset": 90758 }, - "end": { "line": 3334, "column": 52, "offset": 90882 } - } - } - ], - "position": { - "start": { "line": 3333, "column": 1, "offset": 90756 }, - "end": { "line": 3334, "column": 52, "offset": 90882 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "byteLength", - "position": { - "start": { "line": 3335, "column": 3, "offset": 90885 }, - "end": { "line": 3335, "column": 15, "offset": 90897 } - } - }, - { - "type": "text", - "value": " {integer} Number of bytes to read. Must satisfy\n", - "position": { - "start": { "line": 3335, "column": 15, "offset": 90897 }, - "end": { "line": 3336, "column": 1, "offset": 90946 } - } - }, - { - "type": "inlineCode", - "value": "0 < byteLength <= 6", - "position": { - "start": { "line": 3336, "column": 3, "offset": 90948 }, - "end": { "line": 3336, "column": 24, "offset": 90969 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 3336, "column": 24, "offset": 90969 }, - "end": { "line": 3336, "column": 25, "offset": 90970 } - } - } - ], - "position": { - "start": { "line": 3335, "column": 3, "offset": 90885 }, - "end": { "line": 3336, "column": 25, "offset": 90970 } - } - } - ], - "position": { - "start": { "line": 3335, "column": 1, "offset": 90883 }, - "end": { "line": 3336, "column": 25, "offset": 90970 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {integer}", - "position": { - "start": { "line": 3337, "column": 3, "offset": 90973 }, - "end": { "line": 3337, "column": 21, "offset": 90991 } - } - } - ], - "position": { - "start": { "line": 3337, "column": 3, "offset": 90973 }, - "end": { "line": 3337, "column": 21, "offset": 90991 } - } - } - ], - "position": { - "start": { "line": 3337, "column": 1, "offset": 90971 }, - "end": { "line": 3337, "column": 21, "offset": 90991 } - } - } - ], - "position": { - "start": { "line": 3333, "column": 1, "offset": 90756 }, - "end": { "line": 3337, "column": 21, "offset": 90991 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Reads ", - "position": { - "start": { "line": 3339, "column": 1, "offset": 90993 }, - "end": { "line": 3339, "column": 7, "offset": 90999 } - } - }, - { - "type": "inlineCode", - "value": "byteLength", - "position": { - "start": { "line": 3339, "column": 7, "offset": 90999 }, - "end": { "line": 3339, "column": 19, "offset": 91011 } - } - }, - { - "type": "text", - "value": " number of bytes from ", - "position": { - "start": { "line": 3339, "column": 19, "offset": 91011 }, - "end": { "line": 3339, "column": 41, "offset": 91033 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 3339, "column": 41, "offset": 91033 }, - "end": { "line": 3339, "column": 46, "offset": 91038 } - } - }, - { - "type": "text", - "value": " at the specified ", - "position": { - "start": { "line": 3339, "column": 46, "offset": 91038 }, - "end": { "line": 3339, "column": 64, "offset": 91056 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 3339, "column": 64, "offset": 91056 }, - "end": { "line": 3339, "column": 72, "offset": 91064 } - } - }, - { - "type": "text", - "value": "\nand interprets the result as an unsigned, little-endian integer supporting\nup to 48 bits of accuracy.", - "position": { - "start": { "line": 3339, "column": 72, "offset": 91064 }, - "end": { "line": 3341, "column": 27, "offset": 91166 } - } - } - ], - "position": { - "start": { "line": 3339, "column": 1, "offset": 90993 }, - "end": { "line": 3341, "column": 27, "offset": 91166 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This function is also available under the ", - "position": { - "start": { "line": 3343, "column": 1, "offset": 91168 }, - "end": { "line": 3343, "column": 43, "offset": 91210 } - } - }, - { - "type": "inlineCode", - "value": "readUintLE", - "position": { - "start": { "line": 3343, "column": 43, "offset": 91210 }, - "end": { "line": 3343, "column": 55, "offset": 91222 } - } - }, - { - "type": "text", - "value": " alias.", - "position": { - "start": { "line": 3343, "column": 55, "offset": 91222 }, - "end": { "line": 3343, "column": 62, "offset": 91229 } - } - } - ], - "position": { - "start": { "line": 3343, "column": 1, "offset": 91168 }, - "end": { "line": 3343, "column": 62, "offset": 91229 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]);\n\nconsole.log(buf.readUIntLE(0, 6).toString(16));\n// Prints: ab9078563412", - "position": { - "start": { "line": 3345, "column": 1, "offset": 91231 }, - "end": { "line": 3352, "column": 4, "offset": 91416 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]);\n\nconsole.log(buf.readUIntLE(0, 6).toString(16));\n// Prints: ab9078563412", - "position": { - "start": { "line": 3354, "column": 1, "offset": 91418 }, - "end": { "line": 3361, "column": 4, "offset": 91608 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.subarray([start[, end]])", - "position": { - "start": { "line": 3363, "column": 5, "offset": 91614 }, - "end": { "line": 3363, "column": 35, "offset": 91644 } - } - } - ], - "position": { - "start": { "line": 3363, "column": 1, "offset": 91610 }, - "end": { "line": 3363, "column": 35, "offset": 91644 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 3365, "column": 1, "offset": 91646 }, - "end": { "line": 3367, "column": 4, "offset": 91673 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "start", - "position": { - "start": { "line": 3369, "column": 3, "offset": 91677 }, - "end": { "line": 3369, "column": 10, "offset": 91684 } - } - }, - { - "type": "text", - "value": " {integer} Where the new ", - "position": { - "start": { "line": 3369, "column": 10, "offset": 91684 }, - "end": { "line": 3369, "column": 35, "offset": 91709 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 3369, "column": 35, "offset": 91709 }, - "end": { "line": 3369, "column": 43, "offset": 91717 } - } - }, - { - "type": "text", - "value": " will start. ", - "position": { - "start": { "line": 3369, "column": 43, "offset": 91717 }, - "end": { "line": 3369, "column": 56, "offset": 91730 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { - "line": 3369, - "column": 58, - "offset": 91732 - }, - "end": { "line": 3369, "column": 66, "offset": 91740 } - } - } - ], - "position": { - "start": { "line": 3369, "column": 56, "offset": 91730 }, - "end": { "line": 3369, "column": 68, "offset": 91742 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 3369, "column": 68, "offset": 91742 }, - "end": { "line": 3369, "column": 69, "offset": 91743 } - } - }, - { - "type": "inlineCode", - "value": "0", - "position": { - "start": { "line": 3369, "column": 69, "offset": 91743 }, - "end": { "line": 3369, "column": 72, "offset": 91746 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 3369, "column": 72, "offset": 91746 }, - "end": { "line": 3369, "column": 73, "offset": 91747 } - } - } - ], - "position": { - "start": { "line": 3369, "column": 3, "offset": 91677 }, - "end": { "line": 3369, "column": 73, "offset": 91747 } - } - } - ], - "position": { - "start": { "line": 3369, "column": 1, "offset": 91675 }, - "end": { "line": 3369, "column": 73, "offset": 91747 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "end", - "position": { - "start": { "line": 3370, "column": 3, "offset": 91750 }, - "end": { "line": 3370, "column": 8, "offset": 91755 } - } - }, - { - "type": "text", - "value": " {integer} Where the new ", - "position": { - "start": { "line": 3370, "column": 8, "offset": 91755 }, - "end": { "line": 3370, "column": 33, "offset": 91780 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 3370, "column": 33, "offset": 91780 }, - "end": { "line": 3370, "column": 41, "offset": 91788 } - } - }, - { - "type": "text", - "value": " will end (not inclusive).\n", - "position": { - "start": { "line": 3370, "column": 41, "offset": 91788 }, - "end": { "line": 3371, "column": 1, "offset": 91815 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { "line": 3371, "column": 5, "offset": 91819 }, - "end": { "line": 3371, "column": 13, "offset": 91827 } - } - } - ], - "position": { - "start": { "line": 3371, "column": 3, "offset": 91817 }, - "end": { "line": 3371, "column": 15, "offset": 91829 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 3371, "column": 15, "offset": 91829 }, - "end": { "line": 3371, "column": 16, "offset": 91830 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "buf.length", - "position": { - "start": { - "line": 3371, - "column": 17, - "offset": 91831 - }, - "end": { "line": 3371, "column": 29, "offset": 91843 } - } - } - ], - "position": { - "start": { "line": 3371, "column": 16, "offset": 91830 }, - "end": { "line": 3371, "column": 32, "offset": 91846 } - }, - "label": "`buf.length`", - "identifier": "`buf.length`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 3371, "column": 32, "offset": 91846 }, - "end": { "line": 3371, "column": 33, "offset": 91847 } - } - } - ], - "position": { - "start": { "line": 3370, "column": 3, "offset": 91750 }, - "end": { "line": 3371, "column": 33, "offset": 91847 } - } - } - ], - "position": { - "start": { "line": 3370, "column": 1, "offset": 91748 }, - "end": { "line": 3371, "column": 33, "offset": 91847 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {Buffer}", - "position": { - "start": { "line": 3372, "column": 3, "offset": 91850 }, - "end": { "line": 3372, "column": 20, "offset": 91867 } - } - } - ], - "position": { - "start": { "line": 3372, "column": 3, "offset": 91850 }, - "end": { "line": 3372, "column": 20, "offset": 91867 } - } - } - ], - "position": { - "start": { "line": 3372, "column": 1, "offset": 91848 }, - "end": { "line": 3372, "column": 20, "offset": 91867 } - } - } - ], - "position": { - "start": { "line": 3369, "column": 1, "offset": 91675 }, - "end": { "line": 3372, "column": 20, "offset": 91867 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns a new ", - "position": { - "start": { "line": 3374, "column": 1, "offset": 91869 }, - "end": { "line": 3374, "column": 15, "offset": 91883 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 3374, "column": 15, "offset": 91883 }, - "end": { "line": 3374, "column": 23, "offset": 91891 } - } - }, - { - "type": "text", - "value": " that references the same memory as the original, but\noffset and cropped by the ", - "position": { - "start": { "line": 3374, "column": 23, "offset": 91891 }, - "end": { "line": 3375, "column": 27, "offset": 91971 } - } - }, - { - "type": "inlineCode", - "value": "start", - "position": { - "start": { "line": 3375, "column": 27, "offset": 91971 }, - "end": { "line": 3375, "column": 34, "offset": 91978 } - } - }, - { - "type": "text", - "value": " and ", - "position": { - "start": { "line": 3375, "column": 34, "offset": 91978 }, - "end": { "line": 3375, "column": 39, "offset": 91983 } - } - }, - { - "type": "inlineCode", - "value": "end", - "position": { - "start": { "line": 3375, "column": 39, "offset": 91983 }, - "end": { "line": 3375, "column": 44, "offset": 91988 } - } - }, - { - "type": "text", - "value": " indexes.", - "position": { - "start": { "line": 3375, "column": 44, "offset": 91988 }, - "end": { "line": 3375, "column": 53, "offset": 91997 } - } - } - ], - "position": { - "start": { "line": 3374, "column": 1, "offset": 91869 }, - "end": { "line": 3375, "column": 53, "offset": 91997 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Specifying ", - "position": { - "start": { "line": 3377, "column": 1, "offset": 91999 }, - "end": { "line": 3377, "column": 12, "offset": 92010 } - } - }, - { - "type": "inlineCode", - "value": "end", - "position": { - "start": { "line": 3377, "column": 12, "offset": 92010 }, - "end": { "line": 3377, "column": 17, "offset": 92015 } - } - }, - { - "type": "text", - "value": " greater than ", - "position": { - "start": { "line": 3377, "column": 17, "offset": 92015 }, - "end": { "line": 3377, "column": 31, "offset": 92029 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "buf.length", - "position": { - "start": { "line": 3377, "column": 32, "offset": 92030 }, - "end": { "line": 3377, "column": 44, "offset": 92042 } - } - } - ], - "position": { - "start": { "line": 3377, "column": 31, "offset": 92029 }, - "end": { "line": 3377, "column": 47, "offset": 92045 } - }, - "label": "`buf.length`", - "identifier": "`buf.length`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": " will return the same result as\nthat of ", - "position": { - "start": { "line": 3377, "column": 47, "offset": 92045 }, - "end": { "line": 3378, "column": 9, "offset": 92085 } - } - }, - { - "type": "inlineCode", - "value": "end", - "position": { - "start": { "line": 3378, "column": 9, "offset": 92085 }, - "end": { "line": 3378, "column": 14, "offset": 92090 } - } - }, - { - "type": "text", - "value": " equal to ", - "position": { - "start": { "line": 3378, "column": 14, "offset": 92090 }, - "end": { "line": 3378, "column": 24, "offset": 92100 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "buf.length", - "position": { - "start": { "line": 3378, "column": 25, "offset": 92101 }, - "end": { "line": 3378, "column": 37, "offset": 92113 } - } - } - ], - "position": { - "start": { "line": 3378, "column": 24, "offset": 92100 }, - "end": { "line": 3378, "column": 40, "offset": 92116 } - }, - "label": "`buf.length`", - "identifier": "`buf.length`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 3378, "column": 40, "offset": 92116 }, - "end": { "line": 3378, "column": 41, "offset": 92117 } - } - } - ], - "position": { - "start": { "line": 3377, "column": 1, "offset": 91999 }, - "end": { "line": 3378, "column": 41, "offset": 92117 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This method is inherited from ", - "position": { - "start": { "line": 3380, "column": 1, "offset": 92119 }, - "end": { "line": 3380, "column": 31, "offset": 92149 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "TypedArray.prototype.subarray()", - "position": { - "start": { "line": 3380, "column": 32, "offset": 92150 }, - "end": { "line": 3380, "column": 65, "offset": 92183 } - } - } - ], - "position": { - "start": { "line": 3380, "column": 31, "offset": 92149 }, - "end": { "line": 3380, "column": 68, "offset": 92186 } - }, - "label": "`TypedArray.prototype.subarray()`", - "identifier": "`typedarray.prototype.subarray()`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 3380, "column": 68, "offset": 92186 }, - "end": { "line": 3380, "column": 69, "offset": 92187 } - } - } - ], - "position": { - "start": { "line": 3380, "column": 1, "offset": 92119 }, - "end": { "line": 3380, "column": 69, "offset": 92187 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Modifying the new ", - "position": { - "start": { "line": 3382, "column": 1, "offset": 92189 }, - "end": { "line": 3382, "column": 19, "offset": 92207 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 3382, "column": 19, "offset": 92207 }, - "end": { "line": 3382, "column": 27, "offset": 92215 } - } - }, - { - "type": "text", - "value": " slice will modify the memory in the original ", - "position": { - "start": { "line": 3382, "column": 27, "offset": 92215 }, - "end": { "line": 3382, "column": 73, "offset": 92261 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 3382, "column": 73, "offset": 92261 }, - "end": { "line": 3382, "column": 81, "offset": 92269 } - } - }, - { - "type": "text", - "value": "\nbecause the allocated memory of the two objects overlap.", - "position": { - "start": { "line": 3382, "column": 81, "offset": 92269 }, - "end": { "line": 3383, "column": 57, "offset": 92326 } - } - } - ], - "position": { - "start": { "line": 3382, "column": 1, "offset": 92189 }, - "end": { "line": 3383, "column": 57, "offset": 92326 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\n// Create a `Buffer` with the ASCII alphabet, take a slice, and modify one byte\n// from the original `Buffer`.\n\nconst buf1 = Buffer.allocUnsafe(26);\n\nfor (let i = 0; i < 26; i++) {\n // 97 is the decimal ASCII value for 'a'.\n buf1[i] = i + 97;\n}\n\nconst buf2 = buf1.subarray(0, 3);\n\nconsole.log(buf2.toString('ascii', 0, buf2.length));\n// Prints: abc\n\nbuf1[0] = 33;\n\nconsole.log(buf2.toString('ascii', 0, buf2.length));\n// Prints: !bc", - "position": { - "start": { "line": 3385, "column": 1, "offset": 92328 }, - "end": { "line": 3407, "column": 4, "offset": 92812 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\n// Create a `Buffer` with the ASCII alphabet, take a slice, and modify one byte\n// from the original `Buffer`.\n\nconst buf1 = Buffer.allocUnsafe(26);\n\nfor (let i = 0; i < 26; i++) {\n // 97 is the decimal ASCII value for 'a'.\n buf1[i] = i + 97;\n}\n\nconst buf2 = buf1.subarray(0, 3);\n\nconsole.log(buf2.toString('ascii', 0, buf2.length));\n// Prints: abc\n\nbuf1[0] = 33;\n\nconsole.log(buf2.toString('ascii', 0, buf2.length));\n// Prints: !bc", - "position": { - "start": { "line": 3409, "column": 1, "offset": 92814 }, - "end": { "line": 3431, "column": 4, "offset": 93303 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Specifying negative indexes causes the slice to be generated relative to the\nend of ", - "position": { - "start": { "line": 3433, "column": 1, "offset": 93305 }, - "end": { "line": 3434, "column": 8, "offset": 93389 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 3434, "column": 8, "offset": 93389 }, - "end": { "line": 3434, "column": 13, "offset": 93394 } - } - }, - { - "type": "text", - "value": " rather than the beginning.", - "position": { - "start": { "line": 3434, "column": 13, "offset": 93394 }, - "end": { "line": 3434, "column": 40, "offset": 93421 } - } - } - ], - "position": { - "start": { "line": 3433, "column": 1, "offset": 93305 }, - "end": { "line": 3434, "column": 40, "offset": 93421 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from('buffer');\n\nconsole.log(buf.subarray(-6, -1).toString());\n// Prints: buffe\n// (Equivalent to buf.subarray(0, 5).)\n\nconsole.log(buf.subarray(-6, -2).toString());\n// Prints: buff\n// (Equivalent to buf.subarray(0, 4).)\n\nconsole.log(buf.subarray(-5, -2).toString());\n// Prints: uff\n// (Equivalent to buf.subarray(1, 4).)", - "position": { - "start": { "line": 3436, "column": 1, "offset": 93423 }, - "end": { "line": 3452, "column": 4, "offset": 93813 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from('buffer');\n\nconsole.log(buf.subarray(-6, -1).toString());\n// Prints: buffe\n// (Equivalent to buf.subarray(0, 5).)\n\nconsole.log(buf.subarray(-6, -2).toString());\n// Prints: buff\n// (Equivalent to buf.subarray(0, 4).)\n\nconsole.log(buf.subarray(-5, -2).toString());\n// Prints: uff\n// (Equivalent to buf.subarray(1, 4).)", - "position": { - "start": { "line": 3454, "column": 1, "offset": 93815 }, - "end": { "line": 3470, "column": 4, "offset": 94210 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.slice([start[, end]])", - "position": { - "start": { "line": 3472, "column": 5, "offset": 94216 }, - "end": { "line": 3472, "column": 32, "offset": 94243 } - } - } - ], - "position": { - "start": { "line": 3472, "column": 1, "offset": 94212 }, - "end": { "line": 3472, "column": 32, "offset": 94243 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 3474, "column": 1, "offset": 94245 }, - "end": { "line": 3492, "column": 4, "offset": 94847 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "start", - "position": { - "start": { "line": 3494, "column": 3, "offset": 94851 }, - "end": { "line": 3494, "column": 10, "offset": 94858 } - } - }, - { - "type": "text", - "value": " {integer} Where the new ", - "position": { - "start": { "line": 3494, "column": 10, "offset": 94858 }, - "end": { "line": 3494, "column": 35, "offset": 94883 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 3494, "column": 35, "offset": 94883 }, - "end": { "line": 3494, "column": 43, "offset": 94891 } - } - }, - { - "type": "text", - "value": " will start. ", - "position": { - "start": { "line": 3494, "column": 43, "offset": 94891 }, - "end": { "line": 3494, "column": 56, "offset": 94904 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { - "line": 3494, - "column": 58, - "offset": 94906 - }, - "end": { "line": 3494, "column": 66, "offset": 94914 } - } - } - ], - "position": { - "start": { "line": 3494, "column": 56, "offset": 94904 }, - "end": { "line": 3494, "column": 68, "offset": 94916 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 3494, "column": 68, "offset": 94916 }, - "end": { "line": 3494, "column": 69, "offset": 94917 } - } - }, - { - "type": "inlineCode", - "value": "0", - "position": { - "start": { "line": 3494, "column": 69, "offset": 94917 }, - "end": { "line": 3494, "column": 72, "offset": 94920 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 3494, "column": 72, "offset": 94920 }, - "end": { "line": 3494, "column": 73, "offset": 94921 } - } - } - ], - "position": { - "start": { "line": 3494, "column": 3, "offset": 94851 }, - "end": { "line": 3494, "column": 73, "offset": 94921 } - } - } - ], - "position": { - "start": { "line": 3494, "column": 1, "offset": 94849 }, - "end": { "line": 3494, "column": 73, "offset": 94921 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "end", - "position": { - "start": { "line": 3495, "column": 3, "offset": 94924 }, - "end": { "line": 3495, "column": 8, "offset": 94929 } - } - }, - { - "type": "text", - "value": " {integer} Where the new ", - "position": { - "start": { "line": 3495, "column": 8, "offset": 94929 }, - "end": { "line": 3495, "column": 33, "offset": 94954 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 3495, "column": 33, "offset": 94954 }, - "end": { "line": 3495, "column": 41, "offset": 94962 } - } - }, - { - "type": "text", - "value": " will end (not inclusive).\n", - "position": { - "start": { "line": 3495, "column": 41, "offset": 94962 }, - "end": { "line": 3496, "column": 1, "offset": 94989 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { "line": 3496, "column": 5, "offset": 94993 }, - "end": { "line": 3496, "column": 13, "offset": 95001 } - } - } - ], - "position": { - "start": { "line": 3496, "column": 3, "offset": 94991 }, - "end": { "line": 3496, "column": 15, "offset": 95003 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 3496, "column": 15, "offset": 95003 }, - "end": { "line": 3496, "column": 16, "offset": 95004 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "buf.length", - "position": { - "start": { - "line": 3496, - "column": 17, - "offset": 95005 - }, - "end": { "line": 3496, "column": 29, "offset": 95017 } - } - } - ], - "position": { - "start": { "line": 3496, "column": 16, "offset": 95004 }, - "end": { "line": 3496, "column": 32, "offset": 95020 } - }, - "label": "`buf.length`", - "identifier": "`buf.length`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 3496, "column": 32, "offset": 95020 }, - "end": { "line": 3496, "column": 33, "offset": 95021 } - } - } - ], - "position": { - "start": { "line": 3495, "column": 3, "offset": 94924 }, - "end": { "line": 3496, "column": 33, "offset": 95021 } - } - } - ], - "position": { - "start": { "line": 3495, "column": 1, "offset": 94922 }, - "end": { "line": 3496, "column": 33, "offset": 95021 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {Buffer}", - "position": { - "start": { "line": 3497, "column": 3, "offset": 95024 }, - "end": { "line": 3497, "column": 20, "offset": 95041 } - } - } - ], - "position": { - "start": { "line": 3497, "column": 3, "offset": 95024 }, - "end": { "line": 3497, "column": 20, "offset": 95041 } - } - } - ], - "position": { - "start": { "line": 3497, "column": 1, "offset": 95022 }, - "end": { "line": 3497, "column": 20, "offset": 95041 } - } - } - ], - "position": { - "start": { "line": 3494, "column": 1, "offset": 94849 }, - "end": { "line": 3497, "column": 20, "offset": 95041 } - } - }, - { - "type": "blockquote", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Stability: 0 - Deprecated: Use ", - "position": { - "start": { "line": 3499, "column": 3, "offset": 95045 }, - "end": { "line": 3499, "column": 34, "offset": 95076 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "buf.subarray", - "position": { - "start": { "line": 3499, "column": 35, "offset": 95077 }, - "end": { "line": 3499, "column": 49, "offset": 95091 } - } - } - ], - "position": { - "start": { "line": 3499, "column": 34, "offset": 95076 }, - "end": { "line": 3499, "column": 52, "offset": 95094 } - }, - "label": "`buf.subarray`", - "identifier": "`buf.subarray`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": " instead.", - "position": { - "start": { "line": 3499, "column": 52, "offset": 95094 }, - "end": { "line": 3499, "column": 61, "offset": 95103 } - } - } - ], - "position": { - "start": { "line": 3499, "column": 3, "offset": 95045 }, - "end": { "line": 3499, "column": 61, "offset": 95103 } - } - } - ], - "position": { - "start": { "line": 3499, "column": 1, "offset": 95043 }, - "end": { "line": 3499, "column": 61, "offset": 95103 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns a new ", - "position": { - "start": { "line": 3501, "column": 1, "offset": 95105 }, - "end": { "line": 3501, "column": 15, "offset": 95119 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 3501, "column": 15, "offset": 95119 }, - "end": { "line": 3501, "column": 23, "offset": 95127 } - } - }, - { - "type": "text", - "value": " that references the same memory as the original, but\noffset and cropped by the ", - "position": { - "start": { "line": 3501, "column": 23, "offset": 95127 }, - "end": { "line": 3502, "column": 27, "offset": 95207 } - } - }, - { - "type": "inlineCode", - "value": "start", - "position": { - "start": { "line": 3502, "column": 27, "offset": 95207 }, - "end": { "line": 3502, "column": 34, "offset": 95214 } - } - }, - { - "type": "text", - "value": " and ", - "position": { - "start": { "line": 3502, "column": 34, "offset": 95214 }, - "end": { "line": 3502, "column": 39, "offset": 95219 } - } - }, - { - "type": "inlineCode", - "value": "end", - "position": { - "start": { "line": 3502, "column": 39, "offset": 95219 }, - "end": { "line": 3502, "column": 44, "offset": 95224 } - } - }, - { - "type": "text", - "value": " indexes.", - "position": { - "start": { "line": 3502, "column": 44, "offset": 95224 }, - "end": { "line": 3502, "column": 53, "offset": 95233 } - } - } - ], - "position": { - "start": { "line": 3501, "column": 1, "offset": 95105 }, - "end": { "line": 3502, "column": 53, "offset": 95233 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This method is not compatible with the ", - "position": { - "start": { "line": 3504, "column": 1, "offset": 95235 }, - "end": { "line": 3504, "column": 40, "offset": 95274 } - } - }, - { - "type": "inlineCode", - "value": "Uint8Array.prototype.slice()", - "position": { - "start": { "line": 3504, "column": 40, "offset": 95274 }, - "end": { "line": 3504, "column": 70, "offset": 95304 } - } - }, - { - "type": "text", - "value": ",\nwhich is a superclass of ", - "position": { - "start": { "line": 3504, "column": 70, "offset": 95304 }, - "end": { "line": 3505, "column": 26, "offset": 95331 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 3505, "column": 26, "offset": 95331 }, - "end": { "line": 3505, "column": 34, "offset": 95339 } - } - }, - { - "type": "text", - "value": ". To copy the slice, use\n", - "position": { - "start": { "line": 3505, "column": 34, "offset": 95339 }, - "end": { "line": 3506, "column": 1, "offset": 95364 } - } - }, - { - "type": "inlineCode", - "value": "Uint8Array.prototype.slice()", - "position": { - "start": { "line": 3506, "column": 1, "offset": 95364 }, - "end": { "line": 3506, "column": 31, "offset": 95394 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 3506, "column": 31, "offset": 95394 }, - "end": { "line": 3506, "column": 32, "offset": 95395 } - } - } - ], - "position": { - "start": { "line": 3504, "column": 1, "offset": 95235 }, - "end": { "line": 3506, "column": 32, "offset": 95395 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from('buffer');\n\nconst copiedBuf = Uint8Array.prototype.slice.call(buf);\ncopiedBuf[0]++;\nconsole.log(copiedBuf.toString());\n// Prints: cuffer\n\nconsole.log(buf.toString());\n// Prints: buffer\n\n// With buf.slice(), the original buffer is modified.\nconst notReallyCopiedBuf = buf.slice();\nnotReallyCopiedBuf[0]++;\nconsole.log(notReallyCopiedBuf.toString());\n// Prints: cuffer\nconsole.log(buf.toString());\n// Also prints: cuffer (!)", - "position": { - "start": { "line": 3508, "column": 1, "offset": 95397 }, - "end": { "line": 3528, "column": 4, "offset": 95893 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from('buffer');\n\nconst copiedBuf = Uint8Array.prototype.slice.call(buf);\ncopiedBuf[0]++;\nconsole.log(copiedBuf.toString());\n// Prints: cuffer\n\nconsole.log(buf.toString());\n// Prints: buffer\n\n// With buf.slice(), the original buffer is modified.\nconst notReallyCopiedBuf = buf.slice();\nnotReallyCopiedBuf[0]++;\nconsole.log(notReallyCopiedBuf.toString());\n// Prints: cuffer\nconsole.log(buf.toString());\n// Also prints: cuffer (!)", - "position": { - "start": { "line": 3530, "column": 1, "offset": 95895 }, - "end": { "line": 3550, "column": 4, "offset": 96396 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.swap16()", - "position": { - "start": { "line": 3552, "column": 5, "offset": 96402 }, - "end": { "line": 3552, "column": 19, "offset": 96416 } - } - } - ], - "position": { - "start": { "line": 3552, "column": 1, "offset": 96398 }, - "end": { "line": 3552, "column": 19, "offset": 96416 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 3554, "column": 1, "offset": 96418 }, - "end": { "line": 3556, "column": 4, "offset": 96446 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {Buffer} A reference to ", - "position": { - "start": { "line": 3558, "column": 3, "offset": 96450 }, - "end": { "line": 3558, "column": 36, "offset": 96483 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 3558, "column": 36, "offset": 96483 }, - "end": { "line": 3558, "column": 41, "offset": 96488 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 3558, "column": 41, "offset": 96488 }, - "end": { "line": 3558, "column": 42, "offset": 96489 } - } - } - ], - "position": { - "start": { "line": 3558, "column": 3, "offset": 96450 }, - "end": { "line": 3558, "column": 42, "offset": 96489 } - } - } - ], - "position": { - "start": { "line": 3558, "column": 1, "offset": 96448 }, - "end": { "line": 3558, "column": 42, "offset": 96489 } - } - } - ], - "position": { - "start": { "line": 3558, "column": 1, "offset": 96448 }, - "end": { "line": 3558, "column": 42, "offset": 96489 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Interprets ", - "position": { - "start": { "line": 3560, "column": 1, "offset": 96491 }, - "end": { "line": 3560, "column": 12, "offset": 96502 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 3560, "column": 12, "offset": 96502 }, - "end": { "line": 3560, "column": 17, "offset": 96507 } - } - }, - { - "type": "text", - "value": " as an array of unsigned 16-bit integers and swaps the\nbyte order ", - "position": { - "start": { "line": 3560, "column": 17, "offset": 96507 }, - "end": { "line": 3561, "column": 12, "offset": 96573 } - } - }, - { - "type": "emphasis", - "children": [ - { - "type": "text", - "value": "in-place", - "position": { - "start": { "line": 3561, "column": 13, "offset": 96574 }, - "end": { "line": 3561, "column": 21, "offset": 96582 } - } - } - ], - "position": { - "start": { "line": 3561, "column": 12, "offset": 96573 }, - "end": { "line": 3561, "column": 22, "offset": 96583 } - } - }, - { - "type": "text", - "value": ". Throws ", - "position": { - "start": { "line": 3561, "column": 22, "offset": 96583 }, - "end": { "line": 3561, "column": 31, "offset": 96592 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "ERR_INVALID_BUFFER_SIZE", - "position": { - "start": { "line": 3561, "column": 32, "offset": 96593 }, - "end": { "line": 3561, "column": 57, "offset": 96618 } - } - } - ], - "position": { - "start": { "line": 3561, "column": 31, "offset": 96592 }, - "end": { "line": 3561, "column": 60, "offset": 96621 } - }, - "label": "`ERR_INVALID_BUFFER_SIZE`", - "identifier": "`err_invalid_buffer_size`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": " if ", - "position": { - "start": { "line": 3561, "column": 60, "offset": 96621 }, - "end": { "line": 3561, "column": 64, "offset": 96625 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "buf.length", - "position": { - "start": { "line": 3561, "column": 65, "offset": 96626 }, - "end": { "line": 3561, "column": 77, "offset": 96638 } - } - } - ], - "position": { - "start": { "line": 3561, "column": 64, "offset": 96625 }, - "end": { "line": 3561, "column": 80, "offset": 96641 } - }, - "label": "`buf.length`", - "identifier": "`buf.length`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": "\nis not a multiple of 2.", - "position": { - "start": { "line": 3561, "column": 80, "offset": 96641 }, - "end": { "line": 3562, "column": 24, "offset": 96665 } - } - } - ], - "position": { - "start": { "line": 3560, "column": 1, "offset": 96491 }, - "end": { "line": 3562, "column": 24, "offset": 96665 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf1 = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8]);\n\nconsole.log(buf1);\n// Prints: \n\nbuf1.swap16();\n\nconsole.log(buf1);\n// Prints: \n\nconst buf2 = Buffer.from([0x1, 0x2, 0x3]);\n\nbuf2.swap16();\n// Throws ERR_INVALID_BUFFER_SIZE.", - "position": { - "start": { "line": 3564, "column": 1, "offset": 96667 }, - "end": { "line": 3581, "column": 4, "offset": 97023 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf1 = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8]);\n\nconsole.log(buf1);\n// Prints: \n\nbuf1.swap16();\n\nconsole.log(buf1);\n// Prints: \n\nconst buf2 = Buffer.from([0x1, 0x2, 0x3]);\n\nbuf2.swap16();\n// Throws ERR_INVALID_BUFFER_SIZE.", - "position": { - "start": { "line": 3583, "column": 1, "offset": 97025 }, - "end": { "line": 3600, "column": 4, "offset": 97386 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "One convenient use of ", - "position": { - "start": { "line": 3602, "column": 1, "offset": 97388 }, - "end": { "line": 3602, "column": 23, "offset": 97410 } - } - }, - { - "type": "inlineCode", - "value": "buf.swap16()", - "position": { - "start": { "line": 3602, "column": 23, "offset": 97410 }, - "end": { "line": 3602, "column": 37, "offset": 97424 } - } - }, - { - "type": "text", - "value": " is to perform a fast in-place conversion\nbetween UTF-16 little-endian and UTF-16 big-endian:", - "position": { - "start": { "line": 3602, "column": 37, "offset": 97424 }, - "end": { "line": 3603, "column": 52, "offset": 97517 } - } - } - ], - "position": { - "start": { "line": 3602, "column": 1, "offset": 97388 }, - "end": { "line": 3603, "column": 52, "offset": 97517 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from('This is little-endian UTF-16', 'utf16le');\nbuf.swap16(); // Convert to big-endian UTF-16 text.", - "position": { - "start": { "line": 3605, "column": 1, "offset": 97519 }, - "end": { "line": 3610, "column": 4, "offset": 97688 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from('This is little-endian UTF-16', 'utf16le');\nbuf.swap16(); // Convert to big-endian UTF-16 text.", - "position": { - "start": { "line": 3612, "column": 1, "offset": 97690 }, - "end": { "line": 3617, "column": 4, "offset": 97864 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.swap32()", - "position": { - "start": { "line": 3619, "column": 5, "offset": 97870 }, - "end": { "line": 3619, "column": 19, "offset": 97884 } - } - } - ], - "position": { - "start": { "line": 3619, "column": 1, "offset": 97866 }, - "end": { "line": 3619, "column": 19, "offset": 97884 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 3621, "column": 1, "offset": 97886 }, - "end": { "line": 3623, "column": 4, "offset": 97914 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {Buffer} A reference to ", - "position": { - "start": { "line": 3625, "column": 3, "offset": 97918 }, - "end": { "line": 3625, "column": 36, "offset": 97951 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 3625, "column": 36, "offset": 97951 }, - "end": { "line": 3625, "column": 41, "offset": 97956 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 3625, "column": 41, "offset": 97956 }, - "end": { "line": 3625, "column": 42, "offset": 97957 } - } - } - ], - "position": { - "start": { "line": 3625, "column": 3, "offset": 97918 }, - "end": { "line": 3625, "column": 42, "offset": 97957 } - } - } - ], - "position": { - "start": { "line": 3625, "column": 1, "offset": 97916 }, - "end": { "line": 3625, "column": 42, "offset": 97957 } - } - } - ], - "position": { - "start": { "line": 3625, "column": 1, "offset": 97916 }, - "end": { "line": 3625, "column": 42, "offset": 97957 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Interprets ", - "position": { - "start": { "line": 3627, "column": 1, "offset": 97959 }, - "end": { "line": 3627, "column": 12, "offset": 97970 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 3627, "column": 12, "offset": 97970 }, - "end": { "line": 3627, "column": 17, "offset": 97975 } - } - }, - { - "type": "text", - "value": " as an array of unsigned 32-bit integers and swaps the\nbyte order ", - "position": { - "start": { "line": 3627, "column": 17, "offset": 97975 }, - "end": { "line": 3628, "column": 12, "offset": 98041 } - } - }, - { - "type": "emphasis", - "children": [ - { - "type": "text", - "value": "in-place", - "position": { - "start": { "line": 3628, "column": 13, "offset": 98042 }, - "end": { "line": 3628, "column": 21, "offset": 98050 } - } - } - ], - "position": { - "start": { "line": 3628, "column": 12, "offset": 98041 }, - "end": { "line": 3628, "column": 22, "offset": 98051 } - } - }, - { - "type": "text", - "value": ". Throws ", - "position": { - "start": { "line": 3628, "column": 22, "offset": 98051 }, - "end": { "line": 3628, "column": 31, "offset": 98060 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "ERR_INVALID_BUFFER_SIZE", - "position": { - "start": { "line": 3628, "column": 32, "offset": 98061 }, - "end": { "line": 3628, "column": 57, "offset": 98086 } - } - } - ], - "position": { - "start": { "line": 3628, "column": 31, "offset": 98060 }, - "end": { "line": 3628, "column": 60, "offset": 98089 } - }, - "label": "`ERR_INVALID_BUFFER_SIZE`", - "identifier": "`err_invalid_buffer_size`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": " if ", - "position": { - "start": { "line": 3628, "column": 60, "offset": 98089 }, - "end": { "line": 3628, "column": 64, "offset": 98093 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "buf.length", - "position": { - "start": { "line": 3628, "column": 65, "offset": 98094 }, - "end": { "line": 3628, "column": 77, "offset": 98106 } - } - } - ], - "position": { - "start": { "line": 3628, "column": 64, "offset": 98093 }, - "end": { "line": 3628, "column": 80, "offset": 98109 } - }, - "label": "`buf.length`", - "identifier": "`buf.length`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": "\nis not a multiple of 4.", - "position": { - "start": { "line": 3628, "column": 80, "offset": 98109 }, - "end": { "line": 3629, "column": 24, "offset": 98133 } - } - } - ], - "position": { - "start": { "line": 3627, "column": 1, "offset": 97959 }, - "end": { "line": 3629, "column": 24, "offset": 98133 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf1 = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8]);\n\nconsole.log(buf1);\n// Prints: \n\nbuf1.swap32();\n\nconsole.log(buf1);\n// Prints: \n\nconst buf2 = Buffer.from([0x1, 0x2, 0x3]);\n\nbuf2.swap32();\n// Throws ERR_INVALID_BUFFER_SIZE.", - "position": { - "start": { "line": 3631, "column": 1, "offset": 98135 }, - "end": { "line": 3648, "column": 4, "offset": 98491 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf1 = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8]);\n\nconsole.log(buf1);\n// Prints: \n\nbuf1.swap32();\n\nconsole.log(buf1);\n// Prints: \n\nconst buf2 = Buffer.from([0x1, 0x2, 0x3]);\n\nbuf2.swap32();\n// Throws ERR_INVALID_BUFFER_SIZE.", - "position": { - "start": { "line": 3650, "column": 1, "offset": 98493 }, - "end": { "line": 3667, "column": 4, "offset": 98854 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.swap64()", - "position": { - "start": { "line": 3669, "column": 5, "offset": 98860 }, - "end": { "line": 3669, "column": 19, "offset": 98874 } - } - } - ], - "position": { - "start": { "line": 3669, "column": 1, "offset": 98856 }, - "end": { "line": 3669, "column": 19, "offset": 98874 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 3671, "column": 1, "offset": 98876 }, - "end": { "line": 3673, "column": 4, "offset": 98903 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {Buffer} A reference to ", - "position": { - "start": { "line": 3675, "column": 3, "offset": 98907 }, - "end": { "line": 3675, "column": 36, "offset": 98940 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 3675, "column": 36, "offset": 98940 }, - "end": { "line": 3675, "column": 41, "offset": 98945 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 3675, "column": 41, "offset": 98945 }, - "end": { "line": 3675, "column": 42, "offset": 98946 } - } - } - ], - "position": { - "start": { "line": 3675, "column": 3, "offset": 98907 }, - "end": { "line": 3675, "column": 42, "offset": 98946 } - } - } - ], - "position": { - "start": { "line": 3675, "column": 1, "offset": 98905 }, - "end": { "line": 3675, "column": 42, "offset": 98946 } - } - } - ], - "position": { - "start": { "line": 3675, "column": 1, "offset": 98905 }, - "end": { "line": 3675, "column": 42, "offset": 98946 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Interprets ", - "position": { - "start": { "line": 3677, "column": 1, "offset": 98948 }, - "end": { "line": 3677, "column": 12, "offset": 98959 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 3677, "column": 12, "offset": 98959 }, - "end": { "line": 3677, "column": 17, "offset": 98964 } - } - }, - { - "type": "text", - "value": " as an array of 64-bit numbers and swaps byte order ", - "position": { - "start": { "line": 3677, "column": 17, "offset": 98964 }, - "end": { "line": 3677, "column": 69, "offset": 99016 } - } - }, - { - "type": "emphasis", - "children": [ - { - "type": "text", - "value": "in-place", - "position": { - "start": { "line": 3677, "column": 70, "offset": 99017 }, - "end": { "line": 3677, "column": 78, "offset": 99025 } - } - } - ], - "position": { - "start": { "line": 3677, "column": 69, "offset": 99016 }, - "end": { "line": 3677, "column": 79, "offset": 99026 } - } - }, - { - "type": "text", - "value": ".\nThrows ", - "position": { - "start": { "line": 3677, "column": 79, "offset": 99026 }, - "end": { "line": 3678, "column": 8, "offset": 99035 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "ERR_INVALID_BUFFER_SIZE", - "position": { - "start": { "line": 3678, "column": 9, "offset": 99036 }, - "end": { "line": 3678, "column": 34, "offset": 99061 } - } - } - ], - "position": { - "start": { "line": 3678, "column": 8, "offset": 99035 }, - "end": { "line": 3678, "column": 37, "offset": 99064 } - }, - "label": "`ERR_INVALID_BUFFER_SIZE`", - "identifier": "`err_invalid_buffer_size`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": " if ", - "position": { - "start": { "line": 3678, "column": 37, "offset": 99064 }, - "end": { "line": 3678, "column": 41, "offset": 99068 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "buf.length", - "position": { - "start": { "line": 3678, "column": 42, "offset": 99069 }, - "end": { "line": 3678, "column": 54, "offset": 99081 } - } - } - ], - "position": { - "start": { "line": 3678, "column": 41, "offset": 99068 }, - "end": { "line": 3678, "column": 57, "offset": 99084 } - }, - "label": "`buf.length`", - "identifier": "`buf.length`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": " is not a multiple of 8.", - "position": { - "start": { "line": 3678, "column": 57, "offset": 99084 }, - "end": { "line": 3678, "column": 81, "offset": 99108 } - } - } - ], - "position": { - "start": { "line": 3677, "column": 1, "offset": 98948 }, - "end": { "line": 3678, "column": 81, "offset": 99108 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf1 = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8]);\n\nconsole.log(buf1);\n// Prints: \n\nbuf1.swap64();\n\nconsole.log(buf1);\n// Prints: \n\nconst buf2 = Buffer.from([0x1, 0x2, 0x3]);\n\nbuf2.swap64();\n// Throws ERR_INVALID_BUFFER_SIZE.", - "position": { - "start": { "line": 3680, "column": 1, "offset": 99110 }, - "end": { "line": 3697, "column": 4, "offset": 99466 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf1 = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8]);\n\nconsole.log(buf1);\n// Prints: \n\nbuf1.swap64();\n\nconsole.log(buf1);\n// Prints: \n\nconst buf2 = Buffer.from([0x1, 0x2, 0x3]);\n\nbuf2.swap64();\n// Throws ERR_INVALID_BUFFER_SIZE.", - "position": { - "start": { "line": 3699, "column": 1, "offset": 99468 }, - "end": { "line": 3716, "column": 4, "offset": 99829 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.toJSON()", - "position": { - "start": { "line": 3718, "column": 5, "offset": 99835 }, - "end": { "line": 3718, "column": 19, "offset": 99849 } - } - } - ], - "position": { - "start": { "line": 3718, "column": 1, "offset": 99831 }, - "end": { "line": 3718, "column": 19, "offset": 99849 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 3720, "column": 1, "offset": 99851 }, - "end": { "line": 3722, "column": 4, "offset": 99878 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {Object}", - "position": { - "start": { "line": 3724, "column": 3, "offset": 99882 }, - "end": { "line": 3724, "column": 20, "offset": 99899 } - } - } - ], - "position": { - "start": { "line": 3724, "column": 3, "offset": 99882 }, - "end": { "line": 3724, "column": 20, "offset": 99899 } - } - } - ], - "position": { - "start": { "line": 3724, "column": 1, "offset": 99880 }, - "end": { "line": 3724, "column": 20, "offset": 99899 } - } - } - ], - "position": { - "start": { "line": 3724, "column": 1, "offset": 99880 }, - "end": { "line": 3724, "column": 20, "offset": 99899 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns a JSON representation of ", - "position": { - "start": { "line": 3726, "column": 1, "offset": 99901 }, - "end": { "line": 3726, "column": 34, "offset": 99934 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 3726, "column": 34, "offset": 99934 }, - "end": { "line": 3726, "column": 39, "offset": 99939 } - } - }, - { - "type": "text", - "value": ". ", - "position": { - "start": { "line": 3726, "column": 39, "offset": 99939 }, - "end": { "line": 3726, "column": 41, "offset": 99941 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "JSON.stringify()", - "position": { - "start": { "line": 3726, "column": 42, "offset": 99942 }, - "end": { "line": 3726, "column": 60, "offset": 99960 } - } - } - ], - "position": { - "start": { "line": 3726, "column": 41, "offset": 99941 }, - "end": { "line": 3726, "column": 63, "offset": 99963 } - }, - "label": "`JSON.stringify()`", - "identifier": "`json.stringify()`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": " implicitly calls\nthis function when stringifying a ", - "position": { - "start": { "line": 3726, "column": 63, "offset": 99963 }, - "end": { "line": 3727, "column": 35, "offset": 100015 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 3727, "column": 35, "offset": 100015 }, - "end": { "line": 3727, "column": 43, "offset": 100023 } - } - }, - { - "type": "text", - "value": " instance.", - "position": { - "start": { "line": 3727, "column": 43, "offset": 100023 }, - "end": { "line": 3727, "column": 53, "offset": 100033 } - } - } - ], - "position": { - "start": { "line": 3726, "column": 1, "offset": 99901 }, - "end": { "line": 3727, "column": 53, "offset": 100033 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "Buffer.from()", - "position": { - "start": { "line": 3729, "column": 1, "offset": 100035 }, - "end": { "line": 3729, "column": 16, "offset": 100050 } - } - }, - { - "type": "text", - "value": " accepts objects in the format returned from this method.\nIn particular, ", - "position": { - "start": { "line": 3729, "column": 16, "offset": 100050 }, - "end": { "line": 3730, "column": 16, "offset": 100123 } - } - }, - { - "type": "inlineCode", - "value": "Buffer.from(buf.toJSON())", - "position": { - "start": { "line": 3730, "column": 16, "offset": 100123 }, - "end": { "line": 3730, "column": 43, "offset": 100150 } - } - }, - { - "type": "text", - "value": " works like ", - "position": { - "start": { "line": 3730, "column": 43, "offset": 100150 }, - "end": { "line": 3730, "column": 55, "offset": 100162 } - } - }, - { - "type": "inlineCode", - "value": "Buffer.from(buf)", - "position": { - "start": { "line": 3730, "column": 55, "offset": 100162 }, - "end": { "line": 3730, "column": 73, "offset": 100180 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 3730, "column": 73, "offset": 100180 }, - "end": { "line": 3730, "column": 74, "offset": 100181 } - } - } - ], - "position": { - "start": { "line": 3729, "column": 1, "offset": 100035 }, - "end": { "line": 3730, "column": 74, "offset": 100181 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5]);\nconst json = JSON.stringify(buf);\n\nconsole.log(json);\n// Prints: {\"type\":\"Buffer\",\"data\":[1,2,3,4,5]}\n\nconst copy = JSON.parse(json, (key, value) => {\n return value && value.type === 'Buffer' ?\n Buffer.from(value) :\n value;\n});\n\nconsole.log(copy);\n// Prints: ", - "position": { - "start": { "line": 3732, "column": 1, "offset": 100183 }, - "end": { "line": 3749, "column": 4, "offset": 100574 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5]);\nconst json = JSON.stringify(buf);\n\nconsole.log(json);\n// Prints: {\"type\":\"Buffer\",\"data\":[1,2,3,4,5]}\n\nconst copy = JSON.parse(json, (key, value) => {\n return value && value.type === 'Buffer' ?\n Buffer.from(value) :\n value;\n});\n\nconsole.log(copy);\n// Prints: ", - "position": { - "start": { "line": 3751, "column": 1, "offset": 100576 }, - "end": { "line": 3768, "column": 4, "offset": 100972 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.toString([encoding[, start[, end]]])", - "position": { - "start": { "line": 3770, "column": 5, "offset": 100978 }, - "end": { "line": 3770, "column": 47, "offset": 101020 } - } - } - ], - "position": { - "start": { "line": 3770, "column": 1, "offset": 100974 }, - "end": { "line": 3770, "column": 47, "offset": 101020 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 3772, "column": 1, "offset": 101022 }, - "end": { "line": 3774, "column": 4, "offset": 101050 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "encoding", - "position": { - "start": { "line": 3776, "column": 3, "offset": 101054 }, - "end": { "line": 3776, "column": 13, "offset": 101064 } - } - }, - { - "type": "text", - "value": " {string} The character encoding to use. ", - "position": { - "start": { "line": 3776, "column": 13, "offset": 101064 }, - "end": { "line": 3776, "column": 54, "offset": 101105 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { - "line": 3776, - "column": 56, - "offset": 101107 - }, - "end": { "line": 3776, "column": 64, "offset": 101115 } - } - } - ], - "position": { - "start": { "line": 3776, "column": 54, "offset": 101105 }, - "end": { "line": 3776, "column": 66, "offset": 101117 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 3776, "column": 66, "offset": 101117 }, - "end": { "line": 3776, "column": 67, "offset": 101118 } - } - }, - { - "type": "inlineCode", - "value": "'utf8'", - "position": { - "start": { "line": 3776, "column": 67, "offset": 101118 }, - "end": { "line": 3776, "column": 75, "offset": 101126 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 3776, "column": 75, "offset": 101126 }, - "end": { "line": 3776, "column": 76, "offset": 101127 } - } - } - ], - "position": { - "start": { "line": 3776, "column": 3, "offset": 101054 }, - "end": { "line": 3776, "column": 76, "offset": 101127 } - } - } - ], - "position": { - "start": { "line": 3776, "column": 1, "offset": 101052 }, - "end": { "line": 3776, "column": 76, "offset": 101127 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "start", - "position": { - "start": { "line": 3777, "column": 3, "offset": 101130 }, - "end": { "line": 3777, "column": 10, "offset": 101137 } - } - }, - { - "type": "text", - "value": " {integer} The byte offset to start decoding at. ", - "position": { - "start": { "line": 3777, "column": 10, "offset": 101137 }, - "end": { "line": 3777, "column": 59, "offset": 101186 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { - "line": 3777, - "column": 61, - "offset": 101188 - }, - "end": { "line": 3777, "column": 69, "offset": 101196 } - } - } - ], - "position": { - "start": { "line": 3777, "column": 59, "offset": 101186 }, - "end": { "line": 3777, "column": 71, "offset": 101198 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 3777, "column": 71, "offset": 101198 }, - "end": { "line": 3777, "column": 72, "offset": 101199 } - } - }, - { - "type": "inlineCode", - "value": "0", - "position": { - "start": { "line": 3777, "column": 72, "offset": 101199 }, - "end": { "line": 3777, "column": 75, "offset": 101202 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 3777, "column": 75, "offset": 101202 }, - "end": { "line": 3777, "column": 76, "offset": 101203 } - } - } - ], - "position": { - "start": { "line": 3777, "column": 3, "offset": 101130 }, - "end": { "line": 3777, "column": 76, "offset": 101203 } - } - } - ], - "position": { - "start": { "line": 3777, "column": 1, "offset": 101128 }, - "end": { "line": 3777, "column": 76, "offset": 101203 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "end", - "position": { - "start": { "line": 3778, "column": 3, "offset": 101206 }, - "end": { "line": 3778, "column": 8, "offset": 101211 } - } - }, - { - "type": "text", - "value": " {integer} The byte offset to stop decoding at (not inclusive).\n", - "position": { - "start": { "line": 3778, "column": 8, "offset": 101211 }, - "end": { "line": 3779, "column": 1, "offset": 101275 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { - "line": 3779, - "column": 5, - "offset": 101279 - }, - "end": { "line": 3779, "column": 13, "offset": 101287 } - } - } - ], - "position": { - "start": { "line": 3779, "column": 3, "offset": 101277 }, - "end": { "line": 3779, "column": 15, "offset": 101289 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 3779, "column": 15, "offset": 101289 }, - "end": { "line": 3779, "column": 16, "offset": 101290 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "buf.length", - "position": { - "start": { - "line": 3779, - "column": 17, - "offset": 101291 - }, - "end": { "line": 3779, "column": 29, "offset": 101303 } - } - } - ], - "position": { - "start": { "line": 3779, "column": 16, "offset": 101290 }, - "end": { "line": 3779, "column": 32, "offset": 101306 } - }, - "label": "`buf.length`", - "identifier": "`buf.length`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 3779, "column": 32, "offset": 101306 }, - "end": { "line": 3779, "column": 33, "offset": 101307 } - } - } - ], - "position": { - "start": { "line": 3778, "column": 3, "offset": 101206 }, - "end": { "line": 3779, "column": 33, "offset": 101307 } - } - } - ], - "position": { - "start": { "line": 3778, "column": 1, "offset": 101204 }, - "end": { "line": 3779, "column": 33, "offset": 101307 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {string}", - "position": { - "start": { "line": 3780, "column": 3, "offset": 101310 }, - "end": { "line": 3780, "column": 20, "offset": 101327 } - } - } - ], - "position": { - "start": { "line": 3780, "column": 3, "offset": 101310 }, - "end": { "line": 3780, "column": 20, "offset": 101327 } - } - } - ], - "position": { - "start": { "line": 3780, "column": 1, "offset": 101308 }, - "end": { "line": 3780, "column": 20, "offset": 101327 } - } - } - ], - "position": { - "start": { "line": 3776, "column": 1, "offset": 101052 }, - "end": { "line": 3780, "column": 20, "offset": 101327 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Decodes ", - "position": { - "start": { "line": 3782, "column": 1, "offset": 101329 }, - "end": { "line": 3782, "column": 9, "offset": 101337 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 3782, "column": 9, "offset": 101337 }, - "end": { "line": 3782, "column": 14, "offset": 101342 } - } - }, - { - "type": "text", - "value": " to a string according to the specified character encoding in\n", - "position": { - "start": { "line": 3782, "column": 14, "offset": 101342 }, - "end": { "line": 3783, "column": 1, "offset": 101404 } - } - }, - { - "type": "inlineCode", - "value": "encoding", - "position": { - "start": { "line": 3783, "column": 1, "offset": 101404 }, - "end": { "line": 3783, "column": 11, "offset": 101414 } - } - }, - { - "type": "text", - "value": ". ", - "position": { - "start": { "line": 3783, "column": 11, "offset": 101414 }, - "end": { "line": 3783, "column": 13, "offset": 101416 } - } - }, - { - "type": "inlineCode", - "value": "start", - "position": { - "start": { "line": 3783, "column": 13, "offset": 101416 }, - "end": { "line": 3783, "column": 20, "offset": 101423 } - } - }, - { - "type": "text", - "value": " and ", - "position": { - "start": { "line": 3783, "column": 20, "offset": 101423 }, - "end": { "line": 3783, "column": 25, "offset": 101428 } - } - }, - { - "type": "inlineCode", - "value": "end", - "position": { - "start": { "line": 3783, "column": 25, "offset": 101428 }, - "end": { "line": 3783, "column": 30, "offset": 101433 } - } - }, - { - "type": "text", - "value": " may be passed to decode only a subset of ", - "position": { - "start": { "line": 3783, "column": 30, "offset": 101433 }, - "end": { "line": 3783, "column": 72, "offset": 101475 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 3783, "column": 72, "offset": 101475 }, - "end": { "line": 3783, "column": 77, "offset": 101480 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 3783, "column": 77, "offset": 101480 }, - "end": { "line": 3783, "column": 78, "offset": 101481 } - } - } - ], - "position": { - "start": { "line": 3782, "column": 1, "offset": 101329 }, - "end": { "line": 3783, "column": 78, "offset": 101481 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "If ", - "position": { - "start": { "line": 3785, "column": 1, "offset": 101483 }, - "end": { "line": 3785, "column": 4, "offset": 101486 } - } - }, - { - "type": "inlineCode", - "value": "encoding", - "position": { - "start": { "line": 3785, "column": 4, "offset": 101486 }, - "end": { "line": 3785, "column": 14, "offset": 101496 } - } - }, - { - "type": "text", - "value": " is ", - "position": { - "start": { "line": 3785, "column": 14, "offset": 101496 }, - "end": { "line": 3785, "column": 18, "offset": 101500 } - } - }, - { - "type": "inlineCode", - "value": "'utf8'", - "position": { - "start": { "line": 3785, "column": 18, "offset": 101500 }, - "end": { "line": 3785, "column": 26, "offset": 101508 } - } - }, - { - "type": "text", - "value": " and a byte sequence in the input is not valid UTF-8,\nthen each invalid byte is replaced with the replacement character ", - "position": { - "start": { "line": 3785, "column": 26, "offset": 101508 }, - "end": { "line": 3786, "column": 67, "offset": 101628 } - } - }, - { - "type": "inlineCode", - "value": "U+FFFD", - "position": { - "start": { "line": 3786, "column": 67, "offset": 101628 }, - "end": { "line": 3786, "column": 75, "offset": 101636 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 3786, "column": 75, "offset": 101636 }, - "end": { "line": 3786, "column": 76, "offset": 101637 } - } - } - ], - "position": { - "start": { "line": 3785, "column": 1, "offset": 101483 }, - "end": { "line": 3786, "column": 76, "offset": 101637 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The maximum length of a string instance (in UTF-16 code units) is available\nas ", - "position": { - "start": { "line": 3788, "column": 1, "offset": 101639 }, - "end": { "line": 3789, "column": 4, "offset": 101718 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "buffer.constants.MAX_STRING_LENGTH", - "position": { - "start": { "line": 3789, "column": 5, "offset": 101719 }, - "end": { "line": 3789, "column": 41, "offset": 101755 } - } - } - ], - "position": { - "start": { "line": 3789, "column": 4, "offset": 101718 }, - "end": { "line": 3789, "column": 44, "offset": 101758 } - }, - "label": "`buffer.constants.MAX_STRING_LENGTH`", - "identifier": "`buffer.constants.max_string_length`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 3789, "column": 44, "offset": 101758 }, - "end": { "line": 3789, "column": 45, "offset": 101759 } - } - } - ], - "position": { - "start": { "line": 3788, "column": 1, "offset": 101639 }, - "end": { "line": 3789, "column": 45, "offset": 101759 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf1 = Buffer.allocUnsafe(26);\n\nfor (let i = 0; i < 26; i++) {\n // 97 is the decimal ASCII value for 'a'.\n buf1[i] = i + 97;\n}\n\nconsole.log(buf1.toString('utf8'));\n// Prints: abcdefghijklmnopqrstuvwxyz\nconsole.log(buf1.toString('utf8', 0, 5));\n// Prints: abcde\n\nconst buf2 = Buffer.from('tést');\n\nconsole.log(buf2.toString('hex'));\n// Prints: 74c3a97374\nconsole.log(buf2.toString('utf8', 0, 3));\n// Prints: té\nconsole.log(buf2.toString(undefined, 0, 3));\n// Prints: té", - "position": { - "start": { "line": 3791, "column": 1, "offset": 101761 }, - "end": { "line": 3814, "column": 4, "offset": 102287 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf1 = Buffer.allocUnsafe(26);\n\nfor (let i = 0; i < 26; i++) {\n // 97 is the decimal ASCII value for 'a'.\n buf1[i] = i + 97;\n}\n\nconsole.log(buf1.toString('utf8'));\n// Prints: abcdefghijklmnopqrstuvwxyz\nconsole.log(buf1.toString('utf8', 0, 5));\n// Prints: abcde\n\nconst buf2 = Buffer.from('tést');\n\nconsole.log(buf2.toString('hex'));\n// Prints: 74c3a97374\nconsole.log(buf2.toString('utf8', 0, 3));\n// Prints: té\nconsole.log(buf2.toString(undefined, 0, 3));\n// Prints: té", - "position": { - "start": { "line": 3816, "column": 1, "offset": 102289 }, - "end": { "line": 3839, "column": 4, "offset": 102820 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.values()", - "position": { - "start": { "line": 3841, "column": 5, "offset": 102826 }, - "end": { "line": 3841, "column": 19, "offset": 102840 } - } - } - ], - "position": { - "start": { "line": 3841, "column": 1, "offset": 102822 }, - "end": { "line": 3841, "column": 19, "offset": 102840 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 3843, "column": 1, "offset": 102842 }, - "end": { "line": 3845, "column": 4, "offset": 102869 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {Iterator}", - "position": { - "start": { "line": 3847, "column": 3, "offset": 102873 }, - "end": { "line": 3847, "column": 22, "offset": 102892 } - } - } - ], - "position": { - "start": { "line": 3847, "column": 3, "offset": 102873 }, - "end": { "line": 3847, "column": 22, "offset": 102892 } - } - } - ], - "position": { - "start": { "line": 3847, "column": 1, "offset": 102871 }, - "end": { "line": 3847, "column": 22, "offset": 102892 } - } - } - ], - "position": { - "start": { "line": 3847, "column": 1, "offset": 102871 }, - "end": { "line": 3847, "column": 22, "offset": 102892 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Creates and returns an ", - "position": { - "start": { "line": 3849, "column": 1, "offset": 102894 }, - "end": { "line": 3849, "column": 24, "offset": 102917 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "text", - "value": "iterator", - "position": { - "start": { "line": 3849, "column": 25, "offset": 102918 }, - "end": { "line": 3849, "column": 33, "offset": 102926 } - } - } - ], - "position": { - "start": { "line": 3849, "column": 24, "offset": 102917 }, - "end": { "line": 3849, "column": 36, "offset": 102929 } - }, - "label": "iterator", - "identifier": "iterator", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": " for ", - "position": { - "start": { "line": 3849, "column": 36, "offset": 102929 }, - "end": { "line": 3849, "column": 41, "offset": 102934 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 3849, "column": 41, "offset": 102934 }, - "end": { "line": 3849, "column": 46, "offset": 102939 } - } - }, - { - "type": "text", - "value": " values (bytes). This function is\ncalled automatically when a ", - "position": { - "start": { "line": 3849, "column": 46, "offset": 102939 }, - "end": { "line": 3850, "column": 29, "offset": 103001 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 3850, "column": 29, "offset": 103001 }, - "end": { "line": 3850, "column": 37, "offset": 103009 } - } - }, - { - "type": "text", - "value": " is used in a ", - "position": { - "start": { "line": 3850, "column": 37, "offset": 103009 }, - "end": { "line": 3850, "column": 51, "offset": 103023 } - } - }, - { - "type": "inlineCode", - "value": "for..of", - "position": { - "start": { "line": 3850, "column": 51, "offset": 103023 }, - "end": { "line": 3850, "column": 60, "offset": 103032 } - } - }, - { - "type": "text", - "value": " statement.", - "position": { - "start": { "line": 3850, "column": 60, "offset": 103032 }, - "end": { "line": 3850, "column": 71, "offset": 103043 } - } - } - ], - "position": { - "start": { "line": 3849, "column": 1, "offset": 102894 }, - "end": { "line": 3850, "column": 71, "offset": 103043 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.from('buffer');\n\nfor (const value of buf.values()) {\n console.log(value);\n}\n// Prints:\n// 98\n// 117\n// 102\n// 102\n// 101\n// 114\n\nfor (const value of buf) {\n console.log(value);\n}\n// Prints:\n// 98\n// 117\n// 102\n// 102\n// 101\n// 114", - "position": { - "start": { "line": 3852, "column": 1, "offset": 103045 }, - "end": { "line": 3878, "column": 4, "offset": 103370 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.from('buffer');\n\nfor (const value of buf.values()) {\n console.log(value);\n}\n// Prints:\n// 98\n// 117\n// 102\n// 102\n// 101\n// 114\n\nfor (const value of buf) {\n console.log(value);\n}\n// Prints:\n// 98\n// 117\n// 102\n// 102\n// 101\n// 114", - "position": { - "start": { "line": 3880, "column": 1, "offset": 103372 }, - "end": { "line": 3906, "column": 4, "offset": 103702 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.write(string[, offset[, length]][, encoding])", - "position": { - "start": { "line": 3908, "column": 5, "offset": 103708 }, - "end": { "line": 3908, "column": 56, "offset": 103759 } - } - } - ], - "position": { - "start": { "line": 3908, "column": 1, "offset": 103704 }, - "end": { "line": 3908, "column": 56, "offset": 103759 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 3910, "column": 1, "offset": 103761 }, - "end": { "line": 3912, "column": 4, "offset": 103789 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "string", - "position": { - "start": { "line": 3914, "column": 3, "offset": 103793 }, - "end": { "line": 3914, "column": 11, "offset": 103801 } - } - }, - { - "type": "text", - "value": " {string} String to write to ", - "position": { - "start": { "line": 3914, "column": 11, "offset": 103801 }, - "end": { "line": 3914, "column": 40, "offset": 103830 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 3914, "column": 40, "offset": 103830 }, - "end": { "line": 3914, "column": 45, "offset": 103835 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 3914, "column": 45, "offset": 103835 }, - "end": { "line": 3914, "column": 46, "offset": 103836 } - } - } - ], - "position": { - "start": { "line": 3914, "column": 3, "offset": 103793 }, - "end": { "line": 3914, "column": 46, "offset": 103836 } - } - } - ], - "position": { - "start": { "line": 3914, "column": 1, "offset": 103791 }, - "end": { "line": 3914, "column": 46, "offset": 103836 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 3915, "column": 3, "offset": 103839 }, - "end": { "line": 3915, "column": 11, "offset": 103847 } - } - }, - { - "type": "text", - "value": " {integer} Number of bytes to skip before starting to write ", - "position": { - "start": { "line": 3915, "column": 11, "offset": 103847 }, - "end": { "line": 3915, "column": 71, "offset": 103907 } - } - }, - { - "type": "inlineCode", - "value": "string", - "position": { - "start": { "line": 3915, "column": 71, "offset": 103907 }, - "end": { "line": 3915, "column": 79, "offset": 103915 } - } - }, - { - "type": "text", - "value": ".\n", - "position": { - "start": { "line": 3915, "column": 79, "offset": 103915 }, - "end": { "line": 3916, "column": 1, "offset": 103917 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { - "line": 3916, - "column": 5, - "offset": 103921 - }, - "end": { "line": 3916, "column": 13, "offset": 103929 } - } - } - ], - "position": { - "start": { "line": 3916, "column": 3, "offset": 103919 }, - "end": { "line": 3916, "column": 15, "offset": 103931 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 3916, "column": 15, "offset": 103931 }, - "end": { "line": 3916, "column": 16, "offset": 103932 } - } - }, - { - "type": "inlineCode", - "value": "0", - "position": { - "start": { "line": 3916, "column": 16, "offset": 103932 }, - "end": { "line": 3916, "column": 19, "offset": 103935 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 3916, "column": 19, "offset": 103935 }, - "end": { "line": 3916, "column": 20, "offset": 103936 } - } - } - ], - "position": { - "start": { "line": 3915, "column": 3, "offset": 103839 }, - "end": { "line": 3916, "column": 20, "offset": 103936 } - } - } - ], - "position": { - "start": { "line": 3915, "column": 1, "offset": 103837 }, - "end": { "line": 3916, "column": 20, "offset": 103936 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "length", - "position": { - "start": { "line": 3917, "column": 3, "offset": 103939 }, - "end": { "line": 3917, "column": 11, "offset": 103947 } - } - }, - { - "type": "text", - "value": " {integer} Maximum number of bytes to write (written bytes will not\nexceed ", - "position": { - "start": { "line": 3917, "column": 11, "offset": 103947 }, - "end": { "line": 3918, "column": 10, "offset": 104024 } - } - }, - { - "type": "inlineCode", - "value": "buf.length - offset", - "position": { - "start": { "line": 3918, "column": 10, "offset": 104024 }, - "end": { "line": 3918, "column": 31, "offset": 104045 } - } - }, - { - "type": "text", - "value": "). ", - "position": { - "start": { "line": 3918, "column": 31, "offset": 104045 }, - "end": { "line": 3918, "column": 34, "offset": 104048 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { - "line": 3918, - "column": 36, - "offset": 104050 - }, - "end": { "line": 3918, "column": 44, "offset": 104058 } - } - } - ], - "position": { - "start": { "line": 3918, "column": 34, "offset": 104048 }, - "end": { "line": 3918, "column": 46, "offset": 104060 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 3918, "column": 46, "offset": 104060 }, - "end": { "line": 3918, "column": 47, "offset": 104061 } - } - }, - { - "type": "inlineCode", - "value": "buf.length - offset", - "position": { - "start": { "line": 3918, "column": 47, "offset": 104061 }, - "end": { "line": 3918, "column": 68, "offset": 104082 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 3918, "column": 68, "offset": 104082 }, - "end": { "line": 3918, "column": 69, "offset": 104083 } - } - } - ], - "position": { - "start": { "line": 3917, "column": 3, "offset": 103939 }, - "end": { "line": 3918, "column": 69, "offset": 104083 } - } - } - ], - "position": { - "start": { "line": 3917, "column": 1, "offset": 103937 }, - "end": { "line": 3918, "column": 69, "offset": 104083 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "encoding", - "position": { - "start": { "line": 3919, "column": 3, "offset": 104086 }, - "end": { "line": 3919, "column": 13, "offset": 104096 } - } - }, - { - "type": "text", - "value": " {string} The character encoding of ", - "position": { - "start": { "line": 3919, "column": 13, "offset": 104096 }, - "end": { "line": 3919, "column": 49, "offset": 104132 } - } - }, - { - "type": "inlineCode", - "value": "string", - "position": { - "start": { "line": 3919, "column": 49, "offset": 104132 }, - "end": { "line": 3919, "column": 57, "offset": 104140 } - } - }, - { - "type": "text", - "value": ". ", - "position": { - "start": { "line": 3919, "column": 57, "offset": 104140 }, - "end": { "line": 3919, "column": 59, "offset": 104142 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { - "line": 3919, - "column": 61, - "offset": 104144 - }, - "end": { "line": 3919, "column": 69, "offset": 104152 } - } - } - ], - "position": { - "start": { "line": 3919, "column": 59, "offset": 104142 }, - "end": { "line": 3919, "column": 71, "offset": 104154 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 3919, "column": 71, "offset": 104154 }, - "end": { "line": 3919, "column": 72, "offset": 104155 } - } - }, - { - "type": "inlineCode", - "value": "'utf8'", - "position": { - "start": { "line": 3919, "column": 72, "offset": 104155 }, - "end": { "line": 3919, "column": 80, "offset": 104163 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 3919, "column": 80, "offset": 104163 }, - "end": { "line": 3919, "column": 81, "offset": 104164 } - } - } - ], - "position": { - "start": { "line": 3919, "column": 3, "offset": 104086 }, - "end": { "line": 3919, "column": 81, "offset": 104164 } - } - } - ], - "position": { - "start": { "line": 3919, "column": 1, "offset": 104084 }, - "end": { "line": 3919, "column": 81, "offset": 104164 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {integer} Number of bytes written.", - "position": { - "start": { "line": 3920, "column": 3, "offset": 104167 }, - "end": { "line": 3920, "column": 46, "offset": 104210 } - } - } - ], - "position": { - "start": { "line": 3920, "column": 3, "offset": 104167 }, - "end": { "line": 3920, "column": 46, "offset": 104210 } - } - } - ], - "position": { - "start": { "line": 3920, "column": 1, "offset": 104165 }, - "end": { "line": 3920, "column": 46, "offset": 104210 } - } - } - ], - "position": { - "start": { "line": 3914, "column": 1, "offset": 103791 }, - "end": { "line": 3920, "column": 46, "offset": 104210 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Writes ", - "position": { - "start": { "line": 3922, "column": 1, "offset": 104212 }, - "end": { "line": 3922, "column": 8, "offset": 104219 } - } - }, - { - "type": "inlineCode", - "value": "string", - "position": { - "start": { "line": 3922, "column": 8, "offset": 104219 }, - "end": { "line": 3922, "column": 16, "offset": 104227 } - } - }, - { - "type": "text", - "value": " to ", - "position": { - "start": { "line": 3922, "column": 16, "offset": 104227 }, - "end": { "line": 3922, "column": 20, "offset": 104231 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 3922, "column": 20, "offset": 104231 }, - "end": { "line": 3922, "column": 25, "offset": 104236 } - } - }, - { - "type": "text", - "value": " at ", - "position": { - "start": { "line": 3922, "column": 25, "offset": 104236 }, - "end": { "line": 3922, "column": 29, "offset": 104240 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 3922, "column": 29, "offset": 104240 }, - "end": { "line": 3922, "column": 37, "offset": 104248 } - } - }, - { - "type": "text", - "value": " according to the character encoding in\n", - "position": { - "start": { "line": 3922, "column": 37, "offset": 104248 }, - "end": { "line": 3923, "column": 1, "offset": 104288 } - } - }, - { - "type": "inlineCode", - "value": "encoding", - "position": { - "start": { "line": 3923, "column": 1, "offset": 104288 }, - "end": { "line": 3923, "column": 11, "offset": 104298 } - } - }, - { - "type": "text", - "value": ". The ", - "position": { - "start": { "line": 3923, "column": 11, "offset": 104298 }, - "end": { "line": 3923, "column": 17, "offset": 104304 } - } - }, - { - "type": "inlineCode", - "value": "length", - "position": { - "start": { "line": 3923, "column": 17, "offset": 104304 }, - "end": { "line": 3923, "column": 25, "offset": 104312 } - } - }, - { - "type": "text", - "value": " parameter is the number of bytes to write. If ", - "position": { - "start": { "line": 3923, "column": 25, "offset": 104312 }, - "end": { "line": 3923, "column": 72, "offset": 104359 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 3923, "column": 72, "offset": 104359 }, - "end": { "line": 3923, "column": 77, "offset": 104364 } - } - }, - { - "type": "text", - "value": " did\nnot contain enough space to fit the entire string, only part of ", - "position": { - "start": { "line": 3923, "column": 77, "offset": 104364 }, - "end": { "line": 3924, "column": 65, "offset": 104433 } - } - }, - { - "type": "inlineCode", - "value": "string", - "position": { - "start": { "line": 3924, "column": 65, "offset": 104433 }, - "end": { "line": 3924, "column": 73, "offset": 104441 } - } - }, - { - "type": "text", - "value": " will be\nwritten. However, partially encoded characters will not be written.", - "position": { - "start": { "line": 3924, "column": 73, "offset": 104441 }, - "end": { "line": 3925, "column": 68, "offset": 104517 } - } - } - ], - "position": { - "start": { "line": 3922, "column": 1, "offset": 104212 }, - "end": { "line": 3925, "column": 68, "offset": 104517 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.alloc(256);\n\nconst len = buf.write('\\u00bd + \\u00bc = \\u00be', 0);\n\nconsole.log(`${len} bytes: ${buf.toString('utf8', 0, len)}`);\n// Prints: 12 bytes: ½ + ¼ = ¾\n\nconst buffer = Buffer.alloc(10);\n\nconst length = buffer.write('abcd', 8);\n\nconsole.log(`${length} bytes: ${buffer.toString('utf8', 8, 10)}`);\n// Prints: 2 bytes : ab", - "position": { - "start": { "line": 3927, "column": 1, "offset": 104519 }, - "end": { "line": 3943, "column": 4, "offset": 104915 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.alloc(256);\n\nconst len = buf.write('\\u00bd + \\u00bc = \\u00be', 0);\n\nconsole.log(`${len} bytes: ${buf.toString('utf8', 0, len)}`);\n// Prints: 12 bytes: ½ + ¼ = ¾\n\nconst buffer = Buffer.alloc(10);\n\nconst length = buffer.write('abcd', 8);\n\nconsole.log(`${length} bytes: ${buffer.toString('utf8', 8, 10)}`);\n// Prints: 2 bytes : ab", - "position": { - "start": { "line": 3945, "column": 1, "offset": 104917 }, - "end": { "line": 3961, "column": 4, "offset": 105318 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.writeBigInt64BE(value[, offset])", - "position": { - "start": { "line": 3963, "column": 5, "offset": 105324 }, - "end": { "line": 3963, "column": 43, "offset": 105362 } - } - } - ], - "position": { - "start": { "line": 3963, "column": 1, "offset": 105320 }, - "end": { "line": 3963, "column": 43, "offset": 105362 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 3965, "column": 1, "offset": 105364 }, - "end": { "line": 3969, "column": 4, "offset": 105407 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 3971, "column": 3, "offset": 105411 }, - "end": { "line": 3971, "column": 10, "offset": 105418 } - } - }, - { - "type": "text", - "value": " {bigint} Number to be written to ", - "position": { - "start": { "line": 3971, "column": 10, "offset": 105418 }, - "end": { "line": 3971, "column": 44, "offset": 105452 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 3971, "column": 44, "offset": 105452 }, - "end": { "line": 3971, "column": 49, "offset": 105457 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 3971, "column": 49, "offset": 105457 }, - "end": { "line": 3971, "column": 50, "offset": 105458 } - } - } - ], - "position": { - "start": { "line": 3971, "column": 3, "offset": 105411 }, - "end": { "line": 3971, "column": 50, "offset": 105458 } - } - } - ], - "position": { - "start": { "line": 3971, "column": 1, "offset": 105409 }, - "end": { "line": 3971, "column": 50, "offset": 105458 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 3972, "column": 3, "offset": 105461 }, - "end": { "line": 3972, "column": 11, "offset": 105469 } - } - }, - { - "type": "text", - "value": " {integer} Number of bytes to skip before starting to write. Must\nsatisfy: ", - "position": { - "start": { "line": 3972, "column": 11, "offset": 105469 }, - "end": { "line": 3973, "column": 12, "offset": 105546 } - } - }, - { - "type": "inlineCode", - "value": "0 <= offset <= buf.length - 8", - "position": { - "start": { "line": 3973, "column": 12, "offset": 105546 }, - "end": { "line": 3973, "column": 43, "offset": 105577 } - } - }, - { - "type": "text", - "value": ". ", - "position": { - "start": { "line": 3973, "column": 43, "offset": 105577 }, - "end": { "line": 3973, "column": 45, "offset": 105579 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { - "line": 3973, - "column": 47, - "offset": 105581 - }, - "end": { "line": 3973, "column": 55, "offset": 105589 } - } - } - ], - "position": { - "start": { "line": 3973, "column": 45, "offset": 105579 }, - "end": { "line": 3973, "column": 57, "offset": 105591 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 3973, "column": 57, "offset": 105591 }, - "end": { "line": 3973, "column": 58, "offset": 105592 } - } - }, - { - "type": "inlineCode", - "value": "0", - "position": { - "start": { "line": 3973, "column": 58, "offset": 105592 }, - "end": { "line": 3973, "column": 61, "offset": 105595 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 3973, "column": 61, "offset": 105595 }, - "end": { "line": 3973, "column": 62, "offset": 105596 } - } - } - ], - "position": { - "start": { "line": 3972, "column": 3, "offset": 105461 }, - "end": { "line": 3973, "column": 62, "offset": 105596 } - } - } - ], - "position": { - "start": { "line": 3972, "column": 1, "offset": 105459 }, - "end": { "line": 3973, "column": 62, "offset": 105596 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {integer} ", - "position": { - "start": { "line": 3974, "column": 3, "offset": 105599 }, - "end": { "line": 3974, "column": 22, "offset": 105618 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 3974, "column": 22, "offset": 105618 }, - "end": { "line": 3974, "column": 30, "offset": 105626 } - } - }, - { - "type": "text", - "value": " plus the number of bytes written.", - "position": { - "start": { "line": 3974, "column": 30, "offset": 105626 }, - "end": { "line": 3974, "column": 64, "offset": 105660 } - } - } - ], - "position": { - "start": { "line": 3974, "column": 3, "offset": 105599 }, - "end": { "line": 3974, "column": 64, "offset": 105660 } - } - } - ], - "position": { - "start": { "line": 3974, "column": 1, "offset": 105597 }, - "end": { "line": 3974, "column": 64, "offset": 105660 } - } - } - ], - "position": { - "start": { "line": 3971, "column": 1, "offset": 105409 }, - "end": { "line": 3974, "column": 64, "offset": 105660 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Writes ", - "position": { - "start": { "line": 3976, "column": 1, "offset": 105662 }, - "end": { "line": 3976, "column": 8, "offset": 105669 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 3976, "column": 8, "offset": 105669 }, - "end": { "line": 3976, "column": 15, "offset": 105676 } - } - }, - { - "type": "text", - "value": " to ", - "position": { - "start": { "line": 3976, "column": 15, "offset": 105676 }, - "end": { "line": 3976, "column": 19, "offset": 105680 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 3976, "column": 19, "offset": 105680 }, - "end": { "line": 3976, "column": 24, "offset": 105685 } - } - }, - { - "type": "text", - "value": " at the specified ", - "position": { - "start": { "line": 3976, "column": 24, "offset": 105685 }, - "end": { "line": 3976, "column": 42, "offset": 105703 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 3976, "column": 42, "offset": 105703 }, - "end": { "line": 3976, "column": 50, "offset": 105711 } - } - }, - { - "type": "text", - "value": " as big-endian.", - "position": { - "start": { "line": 3976, "column": 50, "offset": 105711 }, - "end": { "line": 3976, "column": 65, "offset": 105726 } - } - } - ], - "position": { - "start": { "line": 3976, "column": 1, "offset": 105662 }, - "end": { "line": 3976, "column": 65, "offset": 105726 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 3978, "column": 1, "offset": 105728 }, - "end": { "line": 3978, "column": 8, "offset": 105735 } - } - }, - { - "type": "text", - "value": " is interpreted and written as a two's complement signed integer.", - "position": { - "start": { "line": 3978, "column": 8, "offset": 105735 }, - "end": { "line": 3978, "column": 73, "offset": 105800 } - } - } - ], - "position": { - "start": { "line": 3978, "column": 1, "offset": 105728 }, - "end": { "line": 3978, "column": 73, "offset": 105800 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.allocUnsafe(8);\n\nbuf.writeBigInt64BE(0x0102030405060708n, 0);\n\nconsole.log(buf);\n// Prints: ", - "position": { - "start": { "line": 3980, "column": 1, "offset": 105802 }, - "end": { "line": 3989, "column": 4, "offset": 105995 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.allocUnsafe(8);\n\nbuf.writeBigInt64BE(0x0102030405060708n, 0);\n\nconsole.log(buf);\n// Prints: ", - "position": { - "start": { "line": 3991, "column": 1, "offset": 105997 }, - "end": { "line": 4000, "column": 4, "offset": 106195 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.writeBigInt64LE(value[, offset])", - "position": { - "start": { "line": 4002, "column": 5, "offset": 106201 }, - "end": { "line": 4002, "column": 43, "offset": 106239 } - } - } - ], - "position": { - "start": { "line": 4002, "column": 1, "offset": 106197 }, - "end": { "line": 4002, "column": 43, "offset": 106239 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 4004, "column": 1, "offset": 106241 }, - "end": { "line": 4008, "column": 4, "offset": 106284 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4010, "column": 3, "offset": 106288 }, - "end": { "line": 4010, "column": 10, "offset": 106295 } - } - }, - { - "type": "text", - "value": " {bigint} Number to be written to ", - "position": { - "start": { "line": 4010, "column": 10, "offset": 106295 }, - "end": { "line": 4010, "column": 44, "offset": 106329 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 4010, "column": 44, "offset": 106329 }, - "end": { "line": 4010, "column": 49, "offset": 106334 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 4010, "column": 49, "offset": 106334 }, - "end": { "line": 4010, "column": 50, "offset": 106335 } - } - } - ], - "position": { - "start": { "line": 4010, "column": 3, "offset": 106288 }, - "end": { "line": 4010, "column": 50, "offset": 106335 } - } - } - ], - "position": { - "start": { "line": 4010, "column": 1, "offset": 106286 }, - "end": { "line": 4010, "column": 50, "offset": 106335 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 4011, "column": 3, "offset": 106338 }, - "end": { "line": 4011, "column": 11, "offset": 106346 } - } - }, - { - "type": "text", - "value": " {integer} Number of bytes to skip before starting to write. Must\nsatisfy: ", - "position": { - "start": { "line": 4011, "column": 11, "offset": 106346 }, - "end": { "line": 4012, "column": 12, "offset": 106423 } - } - }, - { - "type": "inlineCode", - "value": "0 <= offset <= buf.length - 8", - "position": { - "start": { "line": 4012, "column": 12, "offset": 106423 }, - "end": { "line": 4012, "column": 43, "offset": 106454 } - } - }, - { - "type": "text", - "value": ". ", - "position": { - "start": { "line": 4012, "column": 43, "offset": 106454 }, - "end": { "line": 4012, "column": 45, "offset": 106456 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { - "line": 4012, - "column": 47, - "offset": 106458 - }, - "end": { "line": 4012, "column": 55, "offset": 106466 } - } - } - ], - "position": { - "start": { "line": 4012, "column": 45, "offset": 106456 }, - "end": { "line": 4012, "column": 57, "offset": 106468 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 4012, "column": 57, "offset": 106468 }, - "end": { "line": 4012, "column": 58, "offset": 106469 } - } - }, - { - "type": "inlineCode", - "value": "0", - "position": { - "start": { "line": 4012, "column": 58, "offset": 106469 }, - "end": { "line": 4012, "column": 61, "offset": 106472 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 4012, "column": 61, "offset": 106472 }, - "end": { "line": 4012, "column": 62, "offset": 106473 } - } - } - ], - "position": { - "start": { "line": 4011, "column": 3, "offset": 106338 }, - "end": { "line": 4012, "column": 62, "offset": 106473 } - } - } - ], - "position": { - "start": { "line": 4011, "column": 1, "offset": 106336 }, - "end": { "line": 4012, "column": 62, "offset": 106473 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {integer} ", - "position": { - "start": { "line": 4013, "column": 3, "offset": 106476 }, - "end": { "line": 4013, "column": 22, "offset": 106495 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 4013, "column": 22, "offset": 106495 }, - "end": { "line": 4013, "column": 30, "offset": 106503 } - } - }, - { - "type": "text", - "value": " plus the number of bytes written.", - "position": { - "start": { "line": 4013, "column": 30, "offset": 106503 }, - "end": { "line": 4013, "column": 64, "offset": 106537 } - } - } - ], - "position": { - "start": { "line": 4013, "column": 3, "offset": 106476 }, - "end": { "line": 4013, "column": 64, "offset": 106537 } - } - } - ], - "position": { - "start": { "line": 4013, "column": 1, "offset": 106474 }, - "end": { "line": 4013, "column": 64, "offset": 106537 } - } - } - ], - "position": { - "start": { "line": 4010, "column": 1, "offset": 106286 }, - "end": { "line": 4013, "column": 64, "offset": 106537 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Writes ", - "position": { - "start": { "line": 4015, "column": 1, "offset": 106539 }, - "end": { "line": 4015, "column": 8, "offset": 106546 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4015, "column": 8, "offset": 106546 }, - "end": { "line": 4015, "column": 15, "offset": 106553 } - } - }, - { - "type": "text", - "value": " to ", - "position": { - "start": { "line": 4015, "column": 15, "offset": 106553 }, - "end": { "line": 4015, "column": 19, "offset": 106557 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 4015, "column": 19, "offset": 106557 }, - "end": { "line": 4015, "column": 24, "offset": 106562 } - } - }, - { - "type": "text", - "value": " at the specified ", - "position": { - "start": { "line": 4015, "column": 24, "offset": 106562 }, - "end": { "line": 4015, "column": 42, "offset": 106580 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 4015, "column": 42, "offset": 106580 }, - "end": { "line": 4015, "column": 50, "offset": 106588 } - } - }, - { - "type": "text", - "value": " as little-endian.", - "position": { - "start": { "line": 4015, "column": 50, "offset": 106588 }, - "end": { "line": 4015, "column": 68, "offset": 106606 } - } - } - ], - "position": { - "start": { "line": 4015, "column": 1, "offset": 106539 }, - "end": { "line": 4015, "column": 68, "offset": 106606 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4017, "column": 1, "offset": 106608 }, - "end": { "line": 4017, "column": 8, "offset": 106615 } - } - }, - { - "type": "text", - "value": " is interpreted and written as a two's complement signed integer.", - "position": { - "start": { "line": 4017, "column": 8, "offset": 106615 }, - "end": { "line": 4017, "column": 73, "offset": 106680 } - } - } - ], - "position": { - "start": { "line": 4017, "column": 1, "offset": 106608 }, - "end": { "line": 4017, "column": 73, "offset": 106680 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.allocUnsafe(8);\n\nbuf.writeBigInt64LE(0x0102030405060708n, 0);\n\nconsole.log(buf);\n// Prints: ", - "position": { - "start": { "line": 4019, "column": 1, "offset": 106682 }, - "end": { "line": 4028, "column": 4, "offset": 106875 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.allocUnsafe(8);\n\nbuf.writeBigInt64LE(0x0102030405060708n, 0);\n\nconsole.log(buf);\n// Prints: ", - "position": { - "start": { "line": 4030, "column": 1, "offset": 106877 }, - "end": { "line": 4039, "column": 4, "offset": 107075 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.writeBigUInt64BE(value[, offset])", - "position": { - "start": { "line": 4041, "column": 5, "offset": 107081 }, - "end": { "line": 4041, "column": 44, "offset": 107120 } - } - } - ], - "position": { - "start": { "line": 4041, "column": 1, "offset": 107077 }, - "end": { "line": 4041, "column": 44, "offset": 107120 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 4043, "column": 1, "offset": 107122 }, - "end": { "line": 4053, "column": 4, "offset": 107349 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4055, "column": 3, "offset": 107353 }, - "end": { "line": 4055, "column": 10, "offset": 107360 } - } - }, - { - "type": "text", - "value": " {bigint} Number to be written to ", - "position": { - "start": { "line": 4055, "column": 10, "offset": 107360 }, - "end": { "line": 4055, "column": 44, "offset": 107394 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 4055, "column": 44, "offset": 107394 }, - "end": { "line": 4055, "column": 49, "offset": 107399 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 4055, "column": 49, "offset": 107399 }, - "end": { "line": 4055, "column": 50, "offset": 107400 } - } - } - ], - "position": { - "start": { "line": 4055, "column": 3, "offset": 107353 }, - "end": { "line": 4055, "column": 50, "offset": 107400 } - } - } - ], - "position": { - "start": { "line": 4055, "column": 1, "offset": 107351 }, - "end": { "line": 4055, "column": 50, "offset": 107400 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 4056, "column": 3, "offset": 107403 }, - "end": { "line": 4056, "column": 11, "offset": 107411 } - } - }, - { - "type": "text", - "value": " {integer} Number of bytes to skip before starting to write. Must\nsatisfy: ", - "position": { - "start": { "line": 4056, "column": 11, "offset": 107411 }, - "end": { "line": 4057, "column": 12, "offset": 107488 } - } - }, - { - "type": "inlineCode", - "value": "0 <= offset <= buf.length - 8", - "position": { - "start": { "line": 4057, "column": 12, "offset": 107488 }, - "end": { "line": 4057, "column": 43, "offset": 107519 } - } - }, - { - "type": "text", - "value": ". ", - "position": { - "start": { "line": 4057, "column": 43, "offset": 107519 }, - "end": { "line": 4057, "column": 45, "offset": 107521 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { - "line": 4057, - "column": 47, - "offset": 107523 - }, - "end": { "line": 4057, "column": 55, "offset": 107531 } - } - } - ], - "position": { - "start": { "line": 4057, "column": 45, "offset": 107521 }, - "end": { "line": 4057, "column": 57, "offset": 107533 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 4057, "column": 57, "offset": 107533 }, - "end": { "line": 4057, "column": 58, "offset": 107534 } - } - }, - { - "type": "inlineCode", - "value": "0", - "position": { - "start": { "line": 4057, "column": 58, "offset": 107534 }, - "end": { "line": 4057, "column": 61, "offset": 107537 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 4057, "column": 61, "offset": 107537 }, - "end": { "line": 4057, "column": 62, "offset": 107538 } - } - } - ], - "position": { - "start": { "line": 4056, "column": 3, "offset": 107403 }, - "end": { "line": 4057, "column": 62, "offset": 107538 } - } - } - ], - "position": { - "start": { "line": 4056, "column": 1, "offset": 107401 }, - "end": { "line": 4057, "column": 62, "offset": 107538 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {integer} ", - "position": { - "start": { "line": 4058, "column": 3, "offset": 107541 }, - "end": { "line": 4058, "column": 22, "offset": 107560 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 4058, "column": 22, "offset": 107560 }, - "end": { "line": 4058, "column": 30, "offset": 107568 } - } - }, - { - "type": "text", - "value": " plus the number of bytes written.", - "position": { - "start": { "line": 4058, "column": 30, "offset": 107568 }, - "end": { "line": 4058, "column": 64, "offset": 107602 } - } - } - ], - "position": { - "start": { "line": 4058, "column": 3, "offset": 107541 }, - "end": { "line": 4058, "column": 64, "offset": 107602 } - } - } - ], - "position": { - "start": { "line": 4058, "column": 1, "offset": 107539 }, - "end": { "line": 4058, "column": 64, "offset": 107602 } - } - } - ], - "position": { - "start": { "line": 4055, "column": 1, "offset": 107351 }, - "end": { "line": 4058, "column": 64, "offset": 107602 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Writes ", - "position": { - "start": { "line": 4060, "column": 1, "offset": 107604 }, - "end": { "line": 4060, "column": 8, "offset": 107611 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4060, "column": 8, "offset": 107611 }, - "end": { "line": 4060, "column": 15, "offset": 107618 } - } - }, - { - "type": "text", - "value": " to ", - "position": { - "start": { "line": 4060, "column": 15, "offset": 107618 }, - "end": { "line": 4060, "column": 19, "offset": 107622 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 4060, "column": 19, "offset": 107622 }, - "end": { "line": 4060, "column": 24, "offset": 107627 } - } - }, - { - "type": "text", - "value": " at the specified ", - "position": { - "start": { "line": 4060, "column": 24, "offset": 107627 }, - "end": { "line": 4060, "column": 42, "offset": 107645 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 4060, "column": 42, "offset": 107645 }, - "end": { "line": 4060, "column": 50, "offset": 107653 } - } - }, - { - "type": "text", - "value": " as big-endian.", - "position": { - "start": { "line": 4060, "column": 50, "offset": 107653 }, - "end": { "line": 4060, "column": 65, "offset": 107668 } - } - } - ], - "position": { - "start": { "line": 4060, "column": 1, "offset": 107604 }, - "end": { "line": 4060, "column": 65, "offset": 107668 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This function is also available under the ", - "position": { - "start": { "line": 4062, "column": 1, "offset": 107670 }, - "end": { "line": 4062, "column": 43, "offset": 107712 } - } - }, - { - "type": "inlineCode", - "value": "writeBigUint64BE", - "position": { - "start": { "line": 4062, "column": 43, "offset": 107712 }, - "end": { "line": 4062, "column": 61, "offset": 107730 } - } - }, - { - "type": "text", - "value": " alias.", - "position": { - "start": { "line": 4062, "column": 61, "offset": 107730 }, - "end": { "line": 4062, "column": 68, "offset": 107737 } - } - } - ], - "position": { - "start": { "line": 4062, "column": 1, "offset": 107670 }, - "end": { "line": 4062, "column": 68, "offset": 107737 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.allocUnsafe(8);\n\nbuf.writeBigUInt64BE(0xdecafafecacefaden, 0);\n\nconsole.log(buf);\n// Prints: ", - "position": { - "start": { "line": 4064, "column": 1, "offset": 107739 }, - "end": { "line": 4073, "column": 4, "offset": 107933 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.allocUnsafe(8);\n\nbuf.writeBigUInt64BE(0xdecafafecacefaden, 0);\n\nconsole.log(buf);\n// Prints: ", - "position": { - "start": { "line": 4075, "column": 1, "offset": 107935 }, - "end": { "line": 4084, "column": 4, "offset": 108134 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.writeBigUInt64LE(value[, offset])", - "position": { - "start": { "line": 4086, "column": 5, "offset": 108140 }, - "end": { "line": 4086, "column": 44, "offset": 108179 } - } - } - ], - "position": { - "start": { "line": 4086, "column": 1, "offset": 108136 }, - "end": { "line": 4086, "column": 44, "offset": 108179 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 4088, "column": 1, "offset": 108181 }, - "end": { "line": 4098, "column": 4, "offset": 108408 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4100, "column": 3, "offset": 108412 }, - "end": { "line": 4100, "column": 10, "offset": 108419 } - } - }, - { - "type": "text", - "value": " {bigint} Number to be written to ", - "position": { - "start": { "line": 4100, "column": 10, "offset": 108419 }, - "end": { "line": 4100, "column": 44, "offset": 108453 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 4100, "column": 44, "offset": 108453 }, - "end": { "line": 4100, "column": 49, "offset": 108458 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 4100, "column": 49, "offset": 108458 }, - "end": { "line": 4100, "column": 50, "offset": 108459 } - } - } - ], - "position": { - "start": { "line": 4100, "column": 3, "offset": 108412 }, - "end": { "line": 4100, "column": 50, "offset": 108459 } - } - } - ], - "position": { - "start": { "line": 4100, "column": 1, "offset": 108410 }, - "end": { "line": 4100, "column": 50, "offset": 108459 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 4101, "column": 3, "offset": 108462 }, - "end": { "line": 4101, "column": 11, "offset": 108470 } - } - }, - { - "type": "text", - "value": " {integer} Number of bytes to skip before starting to write. Must\nsatisfy: ", - "position": { - "start": { "line": 4101, "column": 11, "offset": 108470 }, - "end": { "line": 4102, "column": 12, "offset": 108547 } - } - }, - { - "type": "inlineCode", - "value": "0 <= offset <= buf.length - 8", - "position": { - "start": { "line": 4102, "column": 12, "offset": 108547 }, - "end": { "line": 4102, "column": 43, "offset": 108578 } - } - }, - { - "type": "text", - "value": ". ", - "position": { - "start": { "line": 4102, "column": 43, "offset": 108578 }, - "end": { "line": 4102, "column": 45, "offset": 108580 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { - "line": 4102, - "column": 47, - "offset": 108582 - }, - "end": { "line": 4102, "column": 55, "offset": 108590 } - } - } - ], - "position": { - "start": { "line": 4102, "column": 45, "offset": 108580 }, - "end": { "line": 4102, "column": 57, "offset": 108592 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 4102, "column": 57, "offset": 108592 }, - "end": { "line": 4102, "column": 58, "offset": 108593 } - } - }, - { - "type": "inlineCode", - "value": "0", - "position": { - "start": { "line": 4102, "column": 58, "offset": 108593 }, - "end": { "line": 4102, "column": 61, "offset": 108596 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 4102, "column": 61, "offset": 108596 }, - "end": { "line": 4102, "column": 62, "offset": 108597 } - } - } - ], - "position": { - "start": { "line": 4101, "column": 3, "offset": 108462 }, - "end": { "line": 4102, "column": 62, "offset": 108597 } - } - } - ], - "position": { - "start": { "line": 4101, "column": 1, "offset": 108460 }, - "end": { "line": 4102, "column": 62, "offset": 108597 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {integer} ", - "position": { - "start": { "line": 4103, "column": 3, "offset": 108600 }, - "end": { "line": 4103, "column": 22, "offset": 108619 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 4103, "column": 22, "offset": 108619 }, - "end": { "line": 4103, "column": 30, "offset": 108627 } - } - }, - { - "type": "text", - "value": " plus the number of bytes written.", - "position": { - "start": { "line": 4103, "column": 30, "offset": 108627 }, - "end": { "line": 4103, "column": 64, "offset": 108661 } - } - } - ], - "position": { - "start": { "line": 4103, "column": 3, "offset": 108600 }, - "end": { "line": 4103, "column": 64, "offset": 108661 } - } - } - ], - "position": { - "start": { "line": 4103, "column": 1, "offset": 108598 }, - "end": { "line": 4103, "column": 64, "offset": 108661 } - } - } - ], - "position": { - "start": { "line": 4100, "column": 1, "offset": 108410 }, - "end": { "line": 4103, "column": 64, "offset": 108661 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Writes ", - "position": { - "start": { "line": 4105, "column": 1, "offset": 108663 }, - "end": { "line": 4105, "column": 8, "offset": 108670 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4105, "column": 8, "offset": 108670 }, - "end": { "line": 4105, "column": 15, "offset": 108677 } - } - }, - { - "type": "text", - "value": " to ", - "position": { - "start": { "line": 4105, "column": 15, "offset": 108677 }, - "end": { "line": 4105, "column": 19, "offset": 108681 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 4105, "column": 19, "offset": 108681 }, - "end": { "line": 4105, "column": 24, "offset": 108686 } - } - }, - { - "type": "text", - "value": " at the specified ", - "position": { - "start": { "line": 4105, "column": 24, "offset": 108686 }, - "end": { "line": 4105, "column": 42, "offset": 108704 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 4105, "column": 42, "offset": 108704 }, - "end": { "line": 4105, "column": 50, "offset": 108712 } - } - }, - { - "type": "text", - "value": " as little-endian", - "position": { - "start": { "line": 4105, "column": 50, "offset": 108712 }, - "end": { "line": 4105, "column": 67, "offset": 108729 } - } - } - ], - "position": { - "start": { "line": 4105, "column": 1, "offset": 108663 }, - "end": { "line": 4105, "column": 67, "offset": 108729 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.allocUnsafe(8);\n\nbuf.writeBigUInt64LE(0xdecafafecacefaden, 0);\n\nconsole.log(buf);\n// Prints: ", - "position": { - "start": { "line": 4107, "column": 1, "offset": 108731 }, - "end": { "line": 4116, "column": 4, "offset": 108925 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.allocUnsafe(8);\n\nbuf.writeBigUInt64LE(0xdecafafecacefaden, 0);\n\nconsole.log(buf);\n// Prints: ", - "position": { - "start": { "line": 4118, "column": 1, "offset": 108927 }, - "end": { "line": 4127, "column": 4, "offset": 109126 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This function is also available under the ", - "position": { - "start": { "line": 4129, "column": 1, "offset": 109128 }, - "end": { "line": 4129, "column": 43, "offset": 109170 } - } - }, - { - "type": "inlineCode", - "value": "writeBigUint64LE", - "position": { - "start": { "line": 4129, "column": 43, "offset": 109170 }, - "end": { "line": 4129, "column": 61, "offset": 109188 } - } - }, - { - "type": "text", - "value": " alias.", - "position": { - "start": { "line": 4129, "column": 61, "offset": 109188 }, - "end": { "line": 4129, "column": 68, "offset": 109195 } - } - } - ], - "position": { - "start": { "line": 4129, "column": 1, "offset": 109128 }, - "end": { "line": 4129, "column": 68, "offset": 109195 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.writeDoubleBE(value[, offset])", - "position": { - "start": { "line": 4131, "column": 5, "offset": 109201 }, - "end": { "line": 4131, "column": 41, "offset": 109237 } - } - } - ], - "position": { - "start": { "line": 4131, "column": 1, "offset": 109197 }, - "end": { "line": 4131, "column": 41, "offset": 109237 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 4133, "column": 1, "offset": 109239 }, - "end": { "line": 4140, "column": 4, "offset": 109465 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4142, "column": 3, "offset": 109469 }, - "end": { "line": 4142, "column": 10, "offset": 109476 } - } - }, - { - "type": "text", - "value": " {number} Number to be written to ", - "position": { - "start": { "line": 4142, "column": 10, "offset": 109476 }, - "end": { "line": 4142, "column": 44, "offset": 109510 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 4142, "column": 44, "offset": 109510 }, - "end": { "line": 4142, "column": 49, "offset": 109515 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 4142, "column": 49, "offset": 109515 }, - "end": { "line": 4142, "column": 50, "offset": 109516 } - } - } - ], - "position": { - "start": { "line": 4142, "column": 3, "offset": 109469 }, - "end": { "line": 4142, "column": 50, "offset": 109516 } - } - } - ], - "position": { - "start": { "line": 4142, "column": 1, "offset": 109467 }, - "end": { "line": 4142, "column": 50, "offset": 109516 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 4143, "column": 3, "offset": 109519 }, - "end": { "line": 4143, "column": 11, "offset": 109527 } - } - }, - { - "type": "text", - "value": " {integer} Number of bytes to skip before starting to write. Must\nsatisfy ", - "position": { - "start": { "line": 4143, "column": 11, "offset": 109527 }, - "end": { "line": 4144, "column": 11, "offset": 109603 } - } - }, - { - "type": "inlineCode", - "value": "0 <= offset <= buf.length - 8", - "position": { - "start": { "line": 4144, "column": 11, "offset": 109603 }, - "end": { "line": 4144, "column": 42, "offset": 109634 } - } - }, - { - "type": "text", - "value": ". ", - "position": { - "start": { "line": 4144, "column": 42, "offset": 109634 }, - "end": { "line": 4144, "column": 44, "offset": 109636 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { - "line": 4144, - "column": 46, - "offset": 109638 - }, - "end": { "line": 4144, "column": 54, "offset": 109646 } - } - } - ], - "position": { - "start": { "line": 4144, "column": 44, "offset": 109636 }, - "end": { "line": 4144, "column": 56, "offset": 109648 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 4144, "column": 56, "offset": 109648 }, - "end": { "line": 4144, "column": 57, "offset": 109649 } - } - }, - { - "type": "inlineCode", - "value": "0", - "position": { - "start": { "line": 4144, "column": 57, "offset": 109649 }, - "end": { "line": 4144, "column": 60, "offset": 109652 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 4144, "column": 60, "offset": 109652 }, - "end": { "line": 4144, "column": 61, "offset": 109653 } - } - } - ], - "position": { - "start": { "line": 4143, "column": 3, "offset": 109519 }, - "end": { "line": 4144, "column": 61, "offset": 109653 } - } - } - ], - "position": { - "start": { "line": 4143, "column": 1, "offset": 109517 }, - "end": { "line": 4144, "column": 61, "offset": 109653 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {integer} ", - "position": { - "start": { "line": 4145, "column": 3, "offset": 109656 }, - "end": { "line": 4145, "column": 22, "offset": 109675 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 4145, "column": 22, "offset": 109675 }, - "end": { "line": 4145, "column": 30, "offset": 109683 } - } - }, - { - "type": "text", - "value": " plus the number of bytes written.", - "position": { - "start": { "line": 4145, "column": 30, "offset": 109683 }, - "end": { "line": 4145, "column": 64, "offset": 109717 } - } - } - ], - "position": { - "start": { "line": 4145, "column": 3, "offset": 109656 }, - "end": { "line": 4145, "column": 64, "offset": 109717 } - } - } - ], - "position": { - "start": { "line": 4145, "column": 1, "offset": 109654 }, - "end": { "line": 4145, "column": 64, "offset": 109717 } - } - } - ], - "position": { - "start": { "line": 4142, "column": 1, "offset": 109467 }, - "end": { "line": 4145, "column": 64, "offset": 109717 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Writes ", - "position": { - "start": { "line": 4147, "column": 1, "offset": 109719 }, - "end": { "line": 4147, "column": 8, "offset": 109726 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4147, "column": 8, "offset": 109726 }, - "end": { "line": 4147, "column": 15, "offset": 109733 } - } - }, - { - "type": "text", - "value": " to ", - "position": { - "start": { "line": 4147, "column": 15, "offset": 109733 }, - "end": { "line": 4147, "column": 19, "offset": 109737 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 4147, "column": 19, "offset": 109737 }, - "end": { "line": 4147, "column": 24, "offset": 109742 } - } - }, - { - "type": "text", - "value": " at the specified ", - "position": { - "start": { "line": 4147, "column": 24, "offset": 109742 }, - "end": { "line": 4147, "column": 42, "offset": 109760 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 4147, "column": 42, "offset": 109760 }, - "end": { "line": 4147, "column": 50, "offset": 109768 } - } - }, - { - "type": "text", - "value": " as big-endian. The ", - "position": { - "start": { "line": 4147, "column": 50, "offset": 109768 }, - "end": { "line": 4147, "column": 70, "offset": 109788 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4147, "column": 70, "offset": 109788 }, - "end": { "line": 4147, "column": 77, "offset": 109795 } - } - }, - { - "type": "text", - "value": "\nmust be a JavaScript number. Behavior is undefined when ", - "position": { - "start": { "line": 4147, "column": 77, "offset": 109795 }, - "end": { "line": 4148, "column": 57, "offset": 109852 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4148, "column": 57, "offset": 109852 }, - "end": { "line": 4148, "column": 64, "offset": 109859 } - } - }, - { - "type": "text", - "value": " is anything\nother than a JavaScript number.", - "position": { - "start": { "line": 4148, "column": 64, "offset": 109859 }, - "end": { "line": 4149, "column": 32, "offset": 109903 } - } - } - ], - "position": { - "start": { "line": 4147, "column": 1, "offset": 109719 }, - "end": { "line": 4149, "column": 32, "offset": 109903 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.allocUnsafe(8);\n\nbuf.writeDoubleBE(123.456, 0);\n\nconsole.log(buf);\n// Prints: ", - "position": { - "start": { "line": 4151, "column": 1, "offset": 109905 }, - "end": { "line": 4160, "column": 4, "offset": 110084 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.allocUnsafe(8);\n\nbuf.writeDoubleBE(123.456, 0);\n\nconsole.log(buf);\n// Prints: ", - "position": { - "start": { "line": 4162, "column": 1, "offset": 110086 }, - "end": { "line": 4171, "column": 4, "offset": 110270 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.writeDoubleLE(value[, offset])", - "position": { - "start": { "line": 4173, "column": 5, "offset": 110276 }, - "end": { "line": 4173, "column": 41, "offset": 110312 } - } - } - ], - "position": { - "start": { "line": 4173, "column": 1, "offset": 110272 }, - "end": { "line": 4173, "column": 41, "offset": 110312 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 4175, "column": 1, "offset": 110314 }, - "end": { "line": 4182, "column": 4, "offset": 110540 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4184, "column": 3, "offset": 110544 }, - "end": { "line": 4184, "column": 10, "offset": 110551 } - } - }, - { - "type": "text", - "value": " {number} Number to be written to ", - "position": { - "start": { "line": 4184, "column": 10, "offset": 110551 }, - "end": { "line": 4184, "column": 44, "offset": 110585 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 4184, "column": 44, "offset": 110585 }, - "end": { "line": 4184, "column": 49, "offset": 110590 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 4184, "column": 49, "offset": 110590 }, - "end": { "line": 4184, "column": 50, "offset": 110591 } - } - } - ], - "position": { - "start": { "line": 4184, "column": 3, "offset": 110544 }, - "end": { "line": 4184, "column": 50, "offset": 110591 } - } - } - ], - "position": { - "start": { "line": 4184, "column": 1, "offset": 110542 }, - "end": { "line": 4184, "column": 50, "offset": 110591 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 4185, "column": 3, "offset": 110594 }, - "end": { "line": 4185, "column": 11, "offset": 110602 } - } - }, - { - "type": "text", - "value": " {integer} Number of bytes to skip before starting to write. Must\nsatisfy ", - "position": { - "start": { "line": 4185, "column": 11, "offset": 110602 }, - "end": { "line": 4186, "column": 11, "offset": 110678 } - } - }, - { - "type": "inlineCode", - "value": "0 <= offset <= buf.length - 8", - "position": { - "start": { "line": 4186, "column": 11, "offset": 110678 }, - "end": { "line": 4186, "column": 42, "offset": 110709 } - } - }, - { - "type": "text", - "value": ". ", - "position": { - "start": { "line": 4186, "column": 42, "offset": 110709 }, - "end": { "line": 4186, "column": 44, "offset": 110711 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { - "line": 4186, - "column": 46, - "offset": 110713 - }, - "end": { "line": 4186, "column": 54, "offset": 110721 } - } - } - ], - "position": { - "start": { "line": 4186, "column": 44, "offset": 110711 }, - "end": { "line": 4186, "column": 56, "offset": 110723 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 4186, "column": 56, "offset": 110723 }, - "end": { "line": 4186, "column": 57, "offset": 110724 } - } - }, - { - "type": "inlineCode", - "value": "0", - "position": { - "start": { "line": 4186, "column": 57, "offset": 110724 }, - "end": { "line": 4186, "column": 60, "offset": 110727 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 4186, "column": 60, "offset": 110727 }, - "end": { "line": 4186, "column": 61, "offset": 110728 } - } - } - ], - "position": { - "start": { "line": 4185, "column": 3, "offset": 110594 }, - "end": { "line": 4186, "column": 61, "offset": 110728 } - } - } - ], - "position": { - "start": { "line": 4185, "column": 1, "offset": 110592 }, - "end": { "line": 4186, "column": 61, "offset": 110728 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {integer} ", - "position": { - "start": { "line": 4187, "column": 3, "offset": 110731 }, - "end": { "line": 4187, "column": 22, "offset": 110750 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 4187, "column": 22, "offset": 110750 }, - "end": { "line": 4187, "column": 30, "offset": 110758 } - } - }, - { - "type": "text", - "value": " plus the number of bytes written.", - "position": { - "start": { "line": 4187, "column": 30, "offset": 110758 }, - "end": { "line": 4187, "column": 64, "offset": 110792 } - } - } - ], - "position": { - "start": { "line": 4187, "column": 3, "offset": 110731 }, - "end": { "line": 4187, "column": 64, "offset": 110792 } - } - } - ], - "position": { - "start": { "line": 4187, "column": 1, "offset": 110729 }, - "end": { "line": 4187, "column": 64, "offset": 110792 } - } - } - ], - "position": { - "start": { "line": 4184, "column": 1, "offset": 110542 }, - "end": { "line": 4187, "column": 64, "offset": 110792 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Writes ", - "position": { - "start": { "line": 4189, "column": 1, "offset": 110794 }, - "end": { "line": 4189, "column": 8, "offset": 110801 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4189, "column": 8, "offset": 110801 }, - "end": { "line": 4189, "column": 15, "offset": 110808 } - } - }, - { - "type": "text", - "value": " to ", - "position": { - "start": { "line": 4189, "column": 15, "offset": 110808 }, - "end": { "line": 4189, "column": 19, "offset": 110812 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 4189, "column": 19, "offset": 110812 }, - "end": { "line": 4189, "column": 24, "offset": 110817 } - } - }, - { - "type": "text", - "value": " at the specified ", - "position": { - "start": { "line": 4189, "column": 24, "offset": 110817 }, - "end": { "line": 4189, "column": 42, "offset": 110835 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 4189, "column": 42, "offset": 110835 }, - "end": { "line": 4189, "column": 50, "offset": 110843 } - } - }, - { - "type": "text", - "value": " as little-endian. The ", - "position": { - "start": { "line": 4189, "column": 50, "offset": 110843 }, - "end": { "line": 4189, "column": 73, "offset": 110866 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4189, "column": 73, "offset": 110866 }, - "end": { "line": 4189, "column": 80, "offset": 110873 } - } - }, - { - "type": "text", - "value": "\nmust be a JavaScript number. Behavior is undefined when ", - "position": { - "start": { "line": 4189, "column": 80, "offset": 110873 }, - "end": { "line": 4190, "column": 57, "offset": 110930 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4190, "column": 57, "offset": 110930 }, - "end": { "line": 4190, "column": 64, "offset": 110937 } - } - }, - { - "type": "text", - "value": " is anything\nother than a JavaScript number.", - "position": { - "start": { "line": 4190, "column": 64, "offset": 110937 }, - "end": { "line": 4191, "column": 32, "offset": 110981 } - } - } - ], - "position": { - "start": { "line": 4189, "column": 1, "offset": 110794 }, - "end": { "line": 4191, "column": 32, "offset": 110981 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.allocUnsafe(8);\n\nbuf.writeDoubleLE(123.456, 0);\n\nconsole.log(buf);\n// Prints: ", - "position": { - "start": { "line": 4193, "column": 1, "offset": 110983 }, - "end": { "line": 4202, "column": 4, "offset": 111162 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.allocUnsafe(8);\n\nbuf.writeDoubleLE(123.456, 0);\n\nconsole.log(buf);\n// Prints: ", - "position": { - "start": { "line": 4204, "column": 1, "offset": 111164 }, - "end": { "line": 4213, "column": 4, "offset": 111348 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.writeFloatBE(value[, offset])", - "position": { - "start": { "line": 4215, "column": 5, "offset": 111354 }, - "end": { "line": 4215, "column": 40, "offset": 111389 } - } - } - ], - "position": { - "start": { "line": 4215, "column": 1, "offset": 111350 }, - "end": { "line": 4215, "column": 40, "offset": 111389 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 4217, "column": 1, "offset": 111391 }, - "end": { "line": 4224, "column": 4, "offset": 111617 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4226, "column": 3, "offset": 111621 }, - "end": { "line": 4226, "column": 10, "offset": 111628 } - } - }, - { - "type": "text", - "value": " {number} Number to be written to ", - "position": { - "start": { "line": 4226, "column": 10, "offset": 111628 }, - "end": { "line": 4226, "column": 44, "offset": 111662 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 4226, "column": 44, "offset": 111662 }, - "end": { "line": 4226, "column": 49, "offset": 111667 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 4226, "column": 49, "offset": 111667 }, - "end": { "line": 4226, "column": 50, "offset": 111668 } - } - } - ], - "position": { - "start": { "line": 4226, "column": 3, "offset": 111621 }, - "end": { "line": 4226, "column": 50, "offset": 111668 } - } - } - ], - "position": { - "start": { "line": 4226, "column": 1, "offset": 111619 }, - "end": { "line": 4226, "column": 50, "offset": 111668 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 4227, "column": 3, "offset": 111671 }, - "end": { "line": 4227, "column": 11, "offset": 111679 } - } - }, - { - "type": "text", - "value": " {integer} Number of bytes to skip before starting to write. Must\nsatisfy ", - "position": { - "start": { "line": 4227, "column": 11, "offset": 111679 }, - "end": { "line": 4228, "column": 11, "offset": 111755 } - } - }, - { - "type": "inlineCode", - "value": "0 <= offset <= buf.length - 4", - "position": { - "start": { "line": 4228, "column": 11, "offset": 111755 }, - "end": { "line": 4228, "column": 42, "offset": 111786 } - } - }, - { - "type": "text", - "value": ". ", - "position": { - "start": { "line": 4228, "column": 42, "offset": 111786 }, - "end": { "line": 4228, "column": 44, "offset": 111788 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { - "line": 4228, - "column": 46, - "offset": 111790 - }, - "end": { "line": 4228, "column": 54, "offset": 111798 } - } - } - ], - "position": { - "start": { "line": 4228, "column": 44, "offset": 111788 }, - "end": { "line": 4228, "column": 56, "offset": 111800 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 4228, "column": 56, "offset": 111800 }, - "end": { "line": 4228, "column": 57, "offset": 111801 } - } - }, - { - "type": "inlineCode", - "value": "0", - "position": { - "start": { "line": 4228, "column": 57, "offset": 111801 }, - "end": { "line": 4228, "column": 60, "offset": 111804 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 4228, "column": 60, "offset": 111804 }, - "end": { "line": 4228, "column": 61, "offset": 111805 } - } - } - ], - "position": { - "start": { "line": 4227, "column": 3, "offset": 111671 }, - "end": { "line": 4228, "column": 61, "offset": 111805 } - } - } - ], - "position": { - "start": { "line": 4227, "column": 1, "offset": 111669 }, - "end": { "line": 4228, "column": 61, "offset": 111805 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {integer} ", - "position": { - "start": { "line": 4229, "column": 3, "offset": 111808 }, - "end": { "line": 4229, "column": 22, "offset": 111827 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 4229, "column": 22, "offset": 111827 }, - "end": { "line": 4229, "column": 30, "offset": 111835 } - } - }, - { - "type": "text", - "value": " plus the number of bytes written.", - "position": { - "start": { "line": 4229, "column": 30, "offset": 111835 }, - "end": { "line": 4229, "column": 64, "offset": 111869 } - } - } - ], - "position": { - "start": { "line": 4229, "column": 3, "offset": 111808 }, - "end": { "line": 4229, "column": 64, "offset": 111869 } - } - } - ], - "position": { - "start": { "line": 4229, "column": 1, "offset": 111806 }, - "end": { "line": 4229, "column": 64, "offset": 111869 } - } - } - ], - "position": { - "start": { "line": 4226, "column": 1, "offset": 111619 }, - "end": { "line": 4229, "column": 64, "offset": 111869 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Writes ", - "position": { - "start": { "line": 4231, "column": 1, "offset": 111871 }, - "end": { "line": 4231, "column": 8, "offset": 111878 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4231, "column": 8, "offset": 111878 }, - "end": { "line": 4231, "column": 15, "offset": 111885 } - } - }, - { - "type": "text", - "value": " to ", - "position": { - "start": { "line": 4231, "column": 15, "offset": 111885 }, - "end": { "line": 4231, "column": 19, "offset": 111889 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 4231, "column": 19, "offset": 111889 }, - "end": { "line": 4231, "column": 24, "offset": 111894 } - } - }, - { - "type": "text", - "value": " at the specified ", - "position": { - "start": { "line": 4231, "column": 24, "offset": 111894 }, - "end": { "line": 4231, "column": 42, "offset": 111912 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 4231, "column": 42, "offset": 111912 }, - "end": { "line": 4231, "column": 50, "offset": 111920 } - } - }, - { - "type": "text", - "value": " as big-endian. Behavior is\nundefined when ", - "position": { - "start": { "line": 4231, "column": 50, "offset": 111920 }, - "end": { "line": 4232, "column": 16, "offset": 111963 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4232, "column": 16, "offset": 111963 }, - "end": { "line": 4232, "column": 23, "offset": 111970 } - } - }, - { - "type": "text", - "value": " is anything other than a JavaScript number.", - "position": { - "start": { "line": 4232, "column": 23, "offset": 111970 }, - "end": { "line": 4232, "column": 67, "offset": 112014 } - } - } - ], - "position": { - "start": { "line": 4231, "column": 1, "offset": 111871 }, - "end": { "line": 4232, "column": 67, "offset": 112014 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.allocUnsafe(4);\n\nbuf.writeFloatBE(0xcafebabe, 0);\n\nconsole.log(buf);\n// Prints: ", - "position": { - "start": { "line": 4234, "column": 1, "offset": 112016 }, - "end": { "line": 4243, "column": 4, "offset": 112185 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.allocUnsafe(4);\n\nbuf.writeFloatBE(0xcafebabe, 0);\n\nconsole.log(buf);\n// Prints: ", - "position": { - "start": { "line": 4245, "column": 1, "offset": 112187 }, - "end": { "line": 4254, "column": 4, "offset": 112361 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.writeFloatLE(value[, offset])", - "position": { - "start": { "line": 4256, "column": 5, "offset": 112367 }, - "end": { "line": 4256, "column": 40, "offset": 112402 } - } - } - ], - "position": { - "start": { "line": 4256, "column": 1, "offset": 112363 }, - "end": { "line": 4256, "column": 40, "offset": 112402 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 4258, "column": 1, "offset": 112404 }, - "end": { "line": 4265, "column": 4, "offset": 112630 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4267, "column": 3, "offset": 112634 }, - "end": { "line": 4267, "column": 10, "offset": 112641 } - } - }, - { - "type": "text", - "value": " {number} Number to be written to ", - "position": { - "start": { "line": 4267, "column": 10, "offset": 112641 }, - "end": { "line": 4267, "column": 44, "offset": 112675 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 4267, "column": 44, "offset": 112675 }, - "end": { "line": 4267, "column": 49, "offset": 112680 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 4267, "column": 49, "offset": 112680 }, - "end": { "line": 4267, "column": 50, "offset": 112681 } - } - } - ], - "position": { - "start": { "line": 4267, "column": 3, "offset": 112634 }, - "end": { "line": 4267, "column": 50, "offset": 112681 } - } - } - ], - "position": { - "start": { "line": 4267, "column": 1, "offset": 112632 }, - "end": { "line": 4267, "column": 50, "offset": 112681 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 4268, "column": 3, "offset": 112684 }, - "end": { "line": 4268, "column": 11, "offset": 112692 } - } - }, - { - "type": "text", - "value": " {integer} Number of bytes to skip before starting to write. Must\nsatisfy ", - "position": { - "start": { "line": 4268, "column": 11, "offset": 112692 }, - "end": { "line": 4269, "column": 11, "offset": 112768 } - } - }, - { - "type": "inlineCode", - "value": "0 <= offset <= buf.length - 4", - "position": { - "start": { "line": 4269, "column": 11, "offset": 112768 }, - "end": { "line": 4269, "column": 42, "offset": 112799 } - } - }, - { - "type": "text", - "value": ". ", - "position": { - "start": { "line": 4269, "column": 42, "offset": 112799 }, - "end": { "line": 4269, "column": 44, "offset": 112801 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { - "line": 4269, - "column": 46, - "offset": 112803 - }, - "end": { "line": 4269, "column": 54, "offset": 112811 } - } - } - ], - "position": { - "start": { "line": 4269, "column": 44, "offset": 112801 }, - "end": { "line": 4269, "column": 56, "offset": 112813 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 4269, "column": 56, "offset": 112813 }, - "end": { "line": 4269, "column": 57, "offset": 112814 } - } - }, - { - "type": "inlineCode", - "value": "0", - "position": { - "start": { "line": 4269, "column": 57, "offset": 112814 }, - "end": { "line": 4269, "column": 60, "offset": 112817 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 4269, "column": 60, "offset": 112817 }, - "end": { "line": 4269, "column": 61, "offset": 112818 } - } - } - ], - "position": { - "start": { "line": 4268, "column": 3, "offset": 112684 }, - "end": { "line": 4269, "column": 61, "offset": 112818 } - } - } - ], - "position": { - "start": { "line": 4268, "column": 1, "offset": 112682 }, - "end": { "line": 4269, "column": 61, "offset": 112818 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {integer} ", - "position": { - "start": { "line": 4270, "column": 3, "offset": 112821 }, - "end": { "line": 4270, "column": 22, "offset": 112840 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 4270, "column": 22, "offset": 112840 }, - "end": { "line": 4270, "column": 30, "offset": 112848 } - } - }, - { - "type": "text", - "value": " plus the number of bytes written.", - "position": { - "start": { "line": 4270, "column": 30, "offset": 112848 }, - "end": { "line": 4270, "column": 64, "offset": 112882 } - } - } - ], - "position": { - "start": { "line": 4270, "column": 3, "offset": 112821 }, - "end": { "line": 4270, "column": 64, "offset": 112882 } - } - } - ], - "position": { - "start": { "line": 4270, "column": 1, "offset": 112819 }, - "end": { "line": 4270, "column": 64, "offset": 112882 } - } - } - ], - "position": { - "start": { "line": 4267, "column": 1, "offset": 112632 }, - "end": { "line": 4270, "column": 64, "offset": 112882 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Writes ", - "position": { - "start": { "line": 4272, "column": 1, "offset": 112884 }, - "end": { "line": 4272, "column": 8, "offset": 112891 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4272, "column": 8, "offset": 112891 }, - "end": { "line": 4272, "column": 15, "offset": 112898 } - } - }, - { - "type": "text", - "value": " to ", - "position": { - "start": { "line": 4272, "column": 15, "offset": 112898 }, - "end": { "line": 4272, "column": 19, "offset": 112902 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 4272, "column": 19, "offset": 112902 }, - "end": { "line": 4272, "column": 24, "offset": 112907 } - } - }, - { - "type": "text", - "value": " at the specified ", - "position": { - "start": { "line": 4272, "column": 24, "offset": 112907 }, - "end": { "line": 4272, "column": 42, "offset": 112925 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 4272, "column": 42, "offset": 112925 }, - "end": { "line": 4272, "column": 50, "offset": 112933 } - } - }, - { - "type": "text", - "value": " as little-endian. Behavior is\nundefined when ", - "position": { - "start": { "line": 4272, "column": 50, "offset": 112933 }, - "end": { "line": 4273, "column": 16, "offset": 112979 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4273, "column": 16, "offset": 112979 }, - "end": { "line": 4273, "column": 23, "offset": 112986 } - } - }, - { - "type": "text", - "value": " is anything other than a JavaScript number.", - "position": { - "start": { "line": 4273, "column": 23, "offset": 112986 }, - "end": { "line": 4273, "column": 67, "offset": 113030 } - } - } - ], - "position": { - "start": { "line": 4272, "column": 1, "offset": 112884 }, - "end": { "line": 4273, "column": 67, "offset": 113030 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.allocUnsafe(4);\n\nbuf.writeFloatLE(0xcafebabe, 0);\n\nconsole.log(buf);\n// Prints: ", - "position": { - "start": { "line": 4275, "column": 1, "offset": 113032 }, - "end": { "line": 4284, "column": 4, "offset": 113201 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.allocUnsafe(4);\n\nbuf.writeFloatLE(0xcafebabe, 0);\n\nconsole.log(buf);\n// Prints: ", - "position": { - "start": { "line": 4286, "column": 1, "offset": 113203 }, - "end": { "line": 4295, "column": 4, "offset": 113377 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.writeInt8(value[, offset])", - "position": { - "start": { "line": 4297, "column": 5, "offset": 113383 }, - "end": { "line": 4297, "column": 37, "offset": 113415 } - } - } - ], - "position": { - "start": { "line": 4297, "column": 1, "offset": 113379 }, - "end": { "line": 4297, "column": 37, "offset": 113415 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 4299, "column": 1, "offset": 113417 }, - "end": { "line": 4306, "column": 4, "offset": 113641 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4308, "column": 3, "offset": 113645 }, - "end": { "line": 4308, "column": 10, "offset": 113652 } - } - }, - { - "type": "text", - "value": " {integer} Number to be written to ", - "position": { - "start": { "line": 4308, "column": 10, "offset": 113652 }, - "end": { "line": 4308, "column": 45, "offset": 113687 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 4308, "column": 45, "offset": 113687 }, - "end": { "line": 4308, "column": 50, "offset": 113692 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 4308, "column": 50, "offset": 113692 }, - "end": { "line": 4308, "column": 51, "offset": 113693 } - } - } - ], - "position": { - "start": { "line": 4308, "column": 3, "offset": 113645 }, - "end": { "line": 4308, "column": 51, "offset": 113693 } - } - } - ], - "position": { - "start": { "line": 4308, "column": 1, "offset": 113643 }, - "end": { "line": 4308, "column": 51, "offset": 113693 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 4309, "column": 3, "offset": 113696 }, - "end": { "line": 4309, "column": 11, "offset": 113704 } - } - }, - { - "type": "text", - "value": " {integer} Number of bytes to skip before starting to write. Must\nsatisfy ", - "position": { - "start": { "line": 4309, "column": 11, "offset": 113704 }, - "end": { "line": 4310, "column": 11, "offset": 113780 } - } - }, - { - "type": "inlineCode", - "value": "0 <= offset <= buf.length - 1", - "position": { - "start": { "line": 4310, "column": 11, "offset": 113780 }, - "end": { "line": 4310, "column": 42, "offset": 113811 } - } - }, - { - "type": "text", - "value": ". ", - "position": { - "start": { "line": 4310, "column": 42, "offset": 113811 }, - "end": { "line": 4310, "column": 44, "offset": 113813 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { - "line": 4310, - "column": 46, - "offset": 113815 - }, - "end": { "line": 4310, "column": 54, "offset": 113823 } - } - } - ], - "position": { - "start": { "line": 4310, "column": 44, "offset": 113813 }, - "end": { "line": 4310, "column": 56, "offset": 113825 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 4310, "column": 56, "offset": 113825 }, - "end": { "line": 4310, "column": 57, "offset": 113826 } - } - }, - { - "type": "inlineCode", - "value": "0", - "position": { - "start": { "line": 4310, "column": 57, "offset": 113826 }, - "end": { "line": 4310, "column": 60, "offset": 113829 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 4310, "column": 60, "offset": 113829 }, - "end": { "line": 4310, "column": 61, "offset": 113830 } - } - } - ], - "position": { - "start": { "line": 4309, "column": 3, "offset": 113696 }, - "end": { "line": 4310, "column": 61, "offset": 113830 } - } - } - ], - "position": { - "start": { "line": 4309, "column": 1, "offset": 113694 }, - "end": { "line": 4310, "column": 61, "offset": 113830 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {integer} ", - "position": { - "start": { "line": 4311, "column": 3, "offset": 113833 }, - "end": { "line": 4311, "column": 22, "offset": 113852 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 4311, "column": 22, "offset": 113852 }, - "end": { "line": 4311, "column": 30, "offset": 113860 } - } - }, - { - "type": "text", - "value": " plus the number of bytes written.", - "position": { - "start": { "line": 4311, "column": 30, "offset": 113860 }, - "end": { "line": 4311, "column": 64, "offset": 113894 } - } - } - ], - "position": { - "start": { "line": 4311, "column": 3, "offset": 113833 }, - "end": { "line": 4311, "column": 64, "offset": 113894 } - } - } - ], - "position": { - "start": { "line": 4311, "column": 1, "offset": 113831 }, - "end": { "line": 4311, "column": 64, "offset": 113894 } - } - } - ], - "position": { - "start": { "line": 4308, "column": 1, "offset": 113643 }, - "end": { "line": 4311, "column": 64, "offset": 113894 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Writes ", - "position": { - "start": { "line": 4313, "column": 1, "offset": 113896 }, - "end": { "line": 4313, "column": 8, "offset": 113903 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4313, "column": 8, "offset": 113903 }, - "end": { "line": 4313, "column": 15, "offset": 113910 } - } - }, - { - "type": "text", - "value": " to ", - "position": { - "start": { "line": 4313, "column": 15, "offset": 113910 }, - "end": { "line": 4313, "column": 19, "offset": 113914 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 4313, "column": 19, "offset": 113914 }, - "end": { "line": 4313, "column": 24, "offset": 113919 } - } - }, - { - "type": "text", - "value": " at the specified ", - "position": { - "start": { "line": 4313, "column": 24, "offset": 113919 }, - "end": { "line": 4313, "column": 42, "offset": 113937 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 4313, "column": 42, "offset": 113937 }, - "end": { "line": 4313, "column": 50, "offset": 113945 } - } - }, - { - "type": "text", - "value": ". ", - "position": { - "start": { "line": 4313, "column": 50, "offset": 113945 }, - "end": { "line": 4313, "column": 52, "offset": 113947 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4313, "column": 52, "offset": 113947 }, - "end": { "line": 4313, "column": 59, "offset": 113954 } - } - }, - { - "type": "text", - "value": " must be a valid\nsigned 8-bit integer. Behavior is undefined when ", - "position": { - "start": { "line": 4313, "column": 59, "offset": 113954 }, - "end": { "line": 4314, "column": 50, "offset": 114020 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4314, "column": 50, "offset": 114020 }, - "end": { "line": 4314, "column": 57, "offset": 114027 } - } - }, - { - "type": "text", - "value": " is anything other than\na signed 8-bit integer.", - "position": { - "start": { "line": 4314, "column": 57, "offset": 114027 }, - "end": { "line": 4315, "column": 24, "offset": 114074 } - } - } - ], - "position": { - "start": { "line": 4313, "column": 1, "offset": 113896 }, - "end": { "line": 4315, "column": 24, "offset": 114074 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4317, "column": 1, "offset": 114076 }, - "end": { "line": 4317, "column": 8, "offset": 114083 } - } - }, - { - "type": "text", - "value": " is interpreted and written as a two's complement signed integer.", - "position": { - "start": { "line": 4317, "column": 8, "offset": 114083 }, - "end": { "line": 4317, "column": 73, "offset": 114148 } - } - } - ], - "position": { - "start": { "line": 4317, "column": 1, "offset": 114076 }, - "end": { "line": 4317, "column": 73, "offset": 114148 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.allocUnsafe(2);\n\nbuf.writeInt8(2, 0);\nbuf.writeInt8(-2, 1);\n\nconsole.log(buf);\n// Prints: ", - "position": { - "start": { "line": 4319, "column": 1, "offset": 114150 }, - "end": { "line": 4329, "column": 4, "offset": 114323 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.allocUnsafe(2);\n\nbuf.writeInt8(2, 0);\nbuf.writeInt8(-2, 1);\n\nconsole.log(buf);\n// Prints: ", - "position": { - "start": { "line": 4331, "column": 1, "offset": 114325 }, - "end": { "line": 4341, "column": 4, "offset": 114503 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.writeInt16BE(value[, offset])", - "position": { - "start": { "line": 4343, "column": 5, "offset": 114509 }, - "end": { "line": 4343, "column": 40, "offset": 114544 } - } - } - ], - "position": { - "start": { "line": 4343, "column": 1, "offset": 114505 }, - "end": { "line": 4343, "column": 40, "offset": 114544 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 4345, "column": 1, "offset": 114546 }, - "end": { "line": 4352, "column": 4, "offset": 114770 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4354, "column": 3, "offset": 114774 }, - "end": { "line": 4354, "column": 10, "offset": 114781 } - } - }, - { - "type": "text", - "value": " {integer} Number to be written to ", - "position": { - "start": { "line": 4354, "column": 10, "offset": 114781 }, - "end": { "line": 4354, "column": 45, "offset": 114816 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 4354, "column": 45, "offset": 114816 }, - "end": { "line": 4354, "column": 50, "offset": 114821 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 4354, "column": 50, "offset": 114821 }, - "end": { "line": 4354, "column": 51, "offset": 114822 } - } - } - ], - "position": { - "start": { "line": 4354, "column": 3, "offset": 114774 }, - "end": { "line": 4354, "column": 51, "offset": 114822 } - } - } - ], - "position": { - "start": { "line": 4354, "column": 1, "offset": 114772 }, - "end": { "line": 4354, "column": 51, "offset": 114822 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 4355, "column": 3, "offset": 114825 }, - "end": { "line": 4355, "column": 11, "offset": 114833 } - } - }, - { - "type": "text", - "value": " {integer} Number of bytes to skip before starting to write. Must\nsatisfy ", - "position": { - "start": { "line": 4355, "column": 11, "offset": 114833 }, - "end": { "line": 4356, "column": 11, "offset": 114909 } - } - }, - { - "type": "inlineCode", - "value": "0 <= offset <= buf.length - 2", - "position": { - "start": { "line": 4356, "column": 11, "offset": 114909 }, - "end": { "line": 4356, "column": 42, "offset": 114940 } - } - }, - { - "type": "text", - "value": ". ", - "position": { - "start": { "line": 4356, "column": 42, "offset": 114940 }, - "end": { "line": 4356, "column": 44, "offset": 114942 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { - "line": 4356, - "column": 46, - "offset": 114944 - }, - "end": { "line": 4356, "column": 54, "offset": 114952 } - } - } - ], - "position": { - "start": { "line": 4356, "column": 44, "offset": 114942 }, - "end": { "line": 4356, "column": 56, "offset": 114954 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 4356, "column": 56, "offset": 114954 }, - "end": { "line": 4356, "column": 57, "offset": 114955 } - } - }, - { - "type": "inlineCode", - "value": "0", - "position": { - "start": { "line": 4356, "column": 57, "offset": 114955 }, - "end": { "line": 4356, "column": 60, "offset": 114958 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 4356, "column": 60, "offset": 114958 }, - "end": { "line": 4356, "column": 61, "offset": 114959 } - } - } - ], - "position": { - "start": { "line": 4355, "column": 3, "offset": 114825 }, - "end": { "line": 4356, "column": 61, "offset": 114959 } - } - } - ], - "position": { - "start": { "line": 4355, "column": 1, "offset": 114823 }, - "end": { "line": 4356, "column": 61, "offset": 114959 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {integer} ", - "position": { - "start": { "line": 4357, "column": 3, "offset": 114962 }, - "end": { "line": 4357, "column": 22, "offset": 114981 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 4357, "column": 22, "offset": 114981 }, - "end": { "line": 4357, "column": 30, "offset": 114989 } - } - }, - { - "type": "text", - "value": " plus the number of bytes written.", - "position": { - "start": { "line": 4357, "column": 30, "offset": 114989 }, - "end": { "line": 4357, "column": 64, "offset": 115023 } - } - } - ], - "position": { - "start": { "line": 4357, "column": 3, "offset": 114962 }, - "end": { "line": 4357, "column": 64, "offset": 115023 } - } - } - ], - "position": { - "start": { "line": 4357, "column": 1, "offset": 114960 }, - "end": { "line": 4357, "column": 64, "offset": 115023 } - } - } - ], - "position": { - "start": { "line": 4354, "column": 1, "offset": 114772 }, - "end": { "line": 4357, "column": 64, "offset": 115023 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Writes ", - "position": { - "start": { "line": 4359, "column": 1, "offset": 115025 }, - "end": { "line": 4359, "column": 8, "offset": 115032 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4359, "column": 8, "offset": 115032 }, - "end": { "line": 4359, "column": 15, "offset": 115039 } - } - }, - { - "type": "text", - "value": " to ", - "position": { - "start": { "line": 4359, "column": 15, "offset": 115039 }, - "end": { "line": 4359, "column": 19, "offset": 115043 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 4359, "column": 19, "offset": 115043 }, - "end": { "line": 4359, "column": 24, "offset": 115048 } - } - }, - { - "type": "text", - "value": " at the specified ", - "position": { - "start": { "line": 4359, "column": 24, "offset": 115048 }, - "end": { "line": 4359, "column": 42, "offset": 115066 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 4359, "column": 42, "offset": 115066 }, - "end": { "line": 4359, "column": 50, "offset": 115074 } - } - }, - { - "type": "text", - "value": " as big-endian. The ", - "position": { - "start": { "line": 4359, "column": 50, "offset": 115074 }, - "end": { "line": 4359, "column": 71, "offset": 115095 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4359, "column": 71, "offset": 115095 }, - "end": { "line": 4359, "column": 78, "offset": 115102 } - } - }, - { - "type": "text", - "value": "\nmust be a valid signed 16-bit integer. Behavior is undefined when ", - "position": { - "start": { "line": 4359, "column": 78, "offset": 115102 }, - "end": { "line": 4360, "column": 67, "offset": 115169 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4360, "column": 67, "offset": 115169 }, - "end": { "line": 4360, "column": 74, "offset": 115176 } - } - }, - { - "type": "text", - "value": " is\nanything other than a signed 16-bit integer.", - "position": { - "start": { "line": 4360, "column": 74, "offset": 115176 }, - "end": { "line": 4361, "column": 45, "offset": 115224 } - } - } - ], - "position": { - "start": { "line": 4359, "column": 1, "offset": 115025 }, - "end": { "line": 4361, "column": 45, "offset": 115224 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The ", - "position": { - "start": { "line": 4363, "column": 1, "offset": 115226 }, - "end": { "line": 4363, "column": 5, "offset": 115230 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4363, "column": 5, "offset": 115230 }, - "end": { "line": 4363, "column": 12, "offset": 115237 } - } - }, - { - "type": "text", - "value": " is interpreted and written as a two's complement signed integer.", - "position": { - "start": { "line": 4363, "column": 12, "offset": 115237 }, - "end": { "line": 4363, "column": 77, "offset": 115302 } - } - } - ], - "position": { - "start": { "line": 4363, "column": 1, "offset": 115226 }, - "end": { "line": 4363, "column": 77, "offset": 115302 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.allocUnsafe(2);\n\nbuf.writeInt16BE(0x0102, 0);\n\nconsole.log(buf);\n// Prints: ", - "position": { - "start": { "line": 4365, "column": 1, "offset": 115304 }, - "end": { "line": 4374, "column": 4, "offset": 115463 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.allocUnsafe(2);\n\nbuf.writeInt16BE(0x0102, 0);\n\nconsole.log(buf);\n// Prints: ", - "position": { - "start": { "line": 4376, "column": 1, "offset": 115465 }, - "end": { "line": 4385, "column": 4, "offset": 115629 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.writeInt16LE(value[, offset])", - "position": { - "start": { "line": 4387, "column": 5, "offset": 115635 }, - "end": { "line": 4387, "column": 40, "offset": 115670 } - } - } - ], - "position": { - "start": { "line": 4387, "column": 1, "offset": 115631 }, - "end": { "line": 4387, "column": 40, "offset": 115670 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 4389, "column": 1, "offset": 115672 }, - "end": { "line": 4396, "column": 4, "offset": 115896 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4398, "column": 3, "offset": 115900 }, - "end": { "line": 4398, "column": 10, "offset": 115907 } - } - }, - { - "type": "text", - "value": " {integer} Number to be written to ", - "position": { - "start": { "line": 4398, "column": 10, "offset": 115907 }, - "end": { "line": 4398, "column": 45, "offset": 115942 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 4398, "column": 45, "offset": 115942 }, - "end": { "line": 4398, "column": 50, "offset": 115947 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 4398, "column": 50, "offset": 115947 }, - "end": { "line": 4398, "column": 51, "offset": 115948 } - } - } - ], - "position": { - "start": { "line": 4398, "column": 3, "offset": 115900 }, - "end": { "line": 4398, "column": 51, "offset": 115948 } - } - } - ], - "position": { - "start": { "line": 4398, "column": 1, "offset": 115898 }, - "end": { "line": 4398, "column": 51, "offset": 115948 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 4399, "column": 3, "offset": 115951 }, - "end": { "line": 4399, "column": 11, "offset": 115959 } - } - }, - { - "type": "text", - "value": " {integer} Number of bytes to skip before starting to write. Must\nsatisfy ", - "position": { - "start": { "line": 4399, "column": 11, "offset": 115959 }, - "end": { "line": 4400, "column": 11, "offset": 116035 } - } - }, - { - "type": "inlineCode", - "value": "0 <= offset <= buf.length - 2", - "position": { - "start": { "line": 4400, "column": 11, "offset": 116035 }, - "end": { "line": 4400, "column": 42, "offset": 116066 } - } - }, - { - "type": "text", - "value": ". ", - "position": { - "start": { "line": 4400, "column": 42, "offset": 116066 }, - "end": { "line": 4400, "column": 44, "offset": 116068 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { - "line": 4400, - "column": 46, - "offset": 116070 - }, - "end": { "line": 4400, "column": 54, "offset": 116078 } - } - } - ], - "position": { - "start": { "line": 4400, "column": 44, "offset": 116068 }, - "end": { "line": 4400, "column": 56, "offset": 116080 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 4400, "column": 56, "offset": 116080 }, - "end": { "line": 4400, "column": 57, "offset": 116081 } - } - }, - { - "type": "inlineCode", - "value": "0", - "position": { - "start": { "line": 4400, "column": 57, "offset": 116081 }, - "end": { "line": 4400, "column": 60, "offset": 116084 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 4400, "column": 60, "offset": 116084 }, - "end": { "line": 4400, "column": 61, "offset": 116085 } - } - } - ], - "position": { - "start": { "line": 4399, "column": 3, "offset": 115951 }, - "end": { "line": 4400, "column": 61, "offset": 116085 } - } - } - ], - "position": { - "start": { "line": 4399, "column": 1, "offset": 115949 }, - "end": { "line": 4400, "column": 61, "offset": 116085 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {integer} ", - "position": { - "start": { "line": 4401, "column": 3, "offset": 116088 }, - "end": { "line": 4401, "column": 22, "offset": 116107 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 4401, "column": 22, "offset": 116107 }, - "end": { "line": 4401, "column": 30, "offset": 116115 } - } - }, - { - "type": "text", - "value": " plus the number of bytes written.", - "position": { - "start": { "line": 4401, "column": 30, "offset": 116115 }, - "end": { "line": 4401, "column": 64, "offset": 116149 } - } - } - ], - "position": { - "start": { "line": 4401, "column": 3, "offset": 116088 }, - "end": { "line": 4401, "column": 64, "offset": 116149 } - } - } - ], - "position": { - "start": { "line": 4401, "column": 1, "offset": 116086 }, - "end": { "line": 4401, "column": 64, "offset": 116149 } - } - } - ], - "position": { - "start": { "line": 4398, "column": 1, "offset": 115898 }, - "end": { "line": 4401, "column": 64, "offset": 116149 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Writes ", - "position": { - "start": { "line": 4403, "column": 1, "offset": 116151 }, - "end": { "line": 4403, "column": 8, "offset": 116158 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4403, "column": 8, "offset": 116158 }, - "end": { "line": 4403, "column": 15, "offset": 116165 } - } - }, - { - "type": "text", - "value": " to ", - "position": { - "start": { "line": 4403, "column": 15, "offset": 116165 }, - "end": { "line": 4403, "column": 19, "offset": 116169 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 4403, "column": 19, "offset": 116169 }, - "end": { "line": 4403, "column": 24, "offset": 116174 } - } - }, - { - "type": "text", - "value": " at the specified ", - "position": { - "start": { "line": 4403, "column": 24, "offset": 116174 }, - "end": { "line": 4403, "column": 42, "offset": 116192 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 4403, "column": 42, "offset": 116192 }, - "end": { "line": 4403, "column": 50, "offset": 116200 } - } - }, - { - "type": "text", - "value": " as little-endian. The ", - "position": { - "start": { "line": 4403, "column": 50, "offset": 116200 }, - "end": { "line": 4403, "column": 74, "offset": 116224 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4403, "column": 74, "offset": 116224 }, - "end": { "line": 4403, "column": 81, "offset": 116231 } - } - }, - { - "type": "text", - "value": "\nmust be a valid signed 16-bit integer. Behavior is undefined when ", - "position": { - "start": { "line": 4403, "column": 81, "offset": 116231 }, - "end": { "line": 4404, "column": 67, "offset": 116298 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4404, "column": 67, "offset": 116298 }, - "end": { "line": 4404, "column": 74, "offset": 116305 } - } - }, - { - "type": "text", - "value": " is\nanything other than a signed 16-bit integer.", - "position": { - "start": { "line": 4404, "column": 74, "offset": 116305 }, - "end": { "line": 4405, "column": 45, "offset": 116353 } - } - } - ], - "position": { - "start": { "line": 4403, "column": 1, "offset": 116151 }, - "end": { "line": 4405, "column": 45, "offset": 116353 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The ", - "position": { - "start": { "line": 4407, "column": 1, "offset": 116355 }, - "end": { "line": 4407, "column": 5, "offset": 116359 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4407, "column": 5, "offset": 116359 }, - "end": { "line": 4407, "column": 12, "offset": 116366 } - } - }, - { - "type": "text", - "value": " is interpreted and written as a two's complement signed integer.", - "position": { - "start": { "line": 4407, "column": 12, "offset": 116366 }, - "end": { "line": 4407, "column": 77, "offset": 116431 } - } - } - ], - "position": { - "start": { "line": 4407, "column": 1, "offset": 116355 }, - "end": { "line": 4407, "column": 77, "offset": 116431 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.allocUnsafe(2);\n\nbuf.writeInt16LE(0x0304, 0);\n\nconsole.log(buf);\n// Prints: ", - "position": { - "start": { "line": 4409, "column": 1, "offset": 116433 }, - "end": { "line": 4418, "column": 4, "offset": 116592 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.allocUnsafe(2);\n\nbuf.writeInt16LE(0x0304, 0);\n\nconsole.log(buf);\n// Prints: ", - "position": { - "start": { "line": 4420, "column": 1, "offset": 116594 }, - "end": { "line": 4429, "column": 4, "offset": 116758 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.writeInt32BE(value[, offset])", - "position": { - "start": { "line": 4431, "column": 5, "offset": 116764 }, - "end": { "line": 4431, "column": 40, "offset": 116799 } - } - } - ], - "position": { - "start": { "line": 4431, "column": 1, "offset": 116760 }, - "end": { "line": 4431, "column": 40, "offset": 116799 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 4433, "column": 1, "offset": 116801 }, - "end": { "line": 4440, "column": 4, "offset": 117025 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4442, "column": 3, "offset": 117029 }, - "end": { "line": 4442, "column": 10, "offset": 117036 } - } - }, - { - "type": "text", - "value": " {integer} Number to be written to ", - "position": { - "start": { "line": 4442, "column": 10, "offset": 117036 }, - "end": { "line": 4442, "column": 45, "offset": 117071 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 4442, "column": 45, "offset": 117071 }, - "end": { "line": 4442, "column": 50, "offset": 117076 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 4442, "column": 50, "offset": 117076 }, - "end": { "line": 4442, "column": 51, "offset": 117077 } - } - } - ], - "position": { - "start": { "line": 4442, "column": 3, "offset": 117029 }, - "end": { "line": 4442, "column": 51, "offset": 117077 } - } - } - ], - "position": { - "start": { "line": 4442, "column": 1, "offset": 117027 }, - "end": { "line": 4442, "column": 51, "offset": 117077 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 4443, "column": 3, "offset": 117080 }, - "end": { "line": 4443, "column": 11, "offset": 117088 } - } - }, - { - "type": "text", - "value": " {integer} Number of bytes to skip before starting to write. Must\nsatisfy ", - "position": { - "start": { "line": 4443, "column": 11, "offset": 117088 }, - "end": { "line": 4444, "column": 11, "offset": 117164 } - } - }, - { - "type": "inlineCode", - "value": "0 <= offset <= buf.length - 4", - "position": { - "start": { "line": 4444, "column": 11, "offset": 117164 }, - "end": { "line": 4444, "column": 42, "offset": 117195 } - } - }, - { - "type": "text", - "value": ". ", - "position": { - "start": { "line": 4444, "column": 42, "offset": 117195 }, - "end": { "line": 4444, "column": 44, "offset": 117197 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { - "line": 4444, - "column": 46, - "offset": 117199 - }, - "end": { "line": 4444, "column": 54, "offset": 117207 } - } - } - ], - "position": { - "start": { "line": 4444, "column": 44, "offset": 117197 }, - "end": { "line": 4444, "column": 56, "offset": 117209 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 4444, "column": 56, "offset": 117209 }, - "end": { "line": 4444, "column": 57, "offset": 117210 } - } - }, - { - "type": "inlineCode", - "value": "0", - "position": { - "start": { "line": 4444, "column": 57, "offset": 117210 }, - "end": { "line": 4444, "column": 60, "offset": 117213 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 4444, "column": 60, "offset": 117213 }, - "end": { "line": 4444, "column": 61, "offset": 117214 } - } - } - ], - "position": { - "start": { "line": 4443, "column": 3, "offset": 117080 }, - "end": { "line": 4444, "column": 61, "offset": 117214 } - } - } - ], - "position": { - "start": { "line": 4443, "column": 1, "offset": 117078 }, - "end": { "line": 4444, "column": 61, "offset": 117214 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {integer} ", - "position": { - "start": { "line": 4445, "column": 3, "offset": 117217 }, - "end": { "line": 4445, "column": 22, "offset": 117236 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 4445, "column": 22, "offset": 117236 }, - "end": { "line": 4445, "column": 30, "offset": 117244 } - } - }, - { - "type": "text", - "value": " plus the number of bytes written.", - "position": { - "start": { "line": 4445, "column": 30, "offset": 117244 }, - "end": { "line": 4445, "column": 64, "offset": 117278 } - } - } - ], - "position": { - "start": { "line": 4445, "column": 3, "offset": 117217 }, - "end": { "line": 4445, "column": 64, "offset": 117278 } - } - } - ], - "position": { - "start": { "line": 4445, "column": 1, "offset": 117215 }, - "end": { "line": 4445, "column": 64, "offset": 117278 } - } - } - ], - "position": { - "start": { "line": 4442, "column": 1, "offset": 117027 }, - "end": { "line": 4445, "column": 64, "offset": 117278 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Writes ", - "position": { - "start": { "line": 4447, "column": 1, "offset": 117280 }, - "end": { "line": 4447, "column": 8, "offset": 117287 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4447, "column": 8, "offset": 117287 }, - "end": { "line": 4447, "column": 15, "offset": 117294 } - } - }, - { - "type": "text", - "value": " to ", - "position": { - "start": { "line": 4447, "column": 15, "offset": 117294 }, - "end": { "line": 4447, "column": 19, "offset": 117298 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 4447, "column": 19, "offset": 117298 }, - "end": { "line": 4447, "column": 24, "offset": 117303 } - } - }, - { - "type": "text", - "value": " at the specified ", - "position": { - "start": { "line": 4447, "column": 24, "offset": 117303 }, - "end": { "line": 4447, "column": 42, "offset": 117321 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 4447, "column": 42, "offset": 117321 }, - "end": { "line": 4447, "column": 50, "offset": 117329 } - } - }, - { - "type": "text", - "value": " as big-endian. The ", - "position": { - "start": { "line": 4447, "column": 50, "offset": 117329 }, - "end": { "line": 4447, "column": 70, "offset": 117349 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4447, "column": 70, "offset": 117349 }, - "end": { "line": 4447, "column": 77, "offset": 117356 } - } - }, - { - "type": "text", - "value": "\nmust be a valid signed 32-bit integer. Behavior is undefined when ", - "position": { - "start": { "line": 4447, "column": 77, "offset": 117356 }, - "end": { "line": 4448, "column": 67, "offset": 117423 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4448, "column": 67, "offset": 117423 }, - "end": { "line": 4448, "column": 74, "offset": 117430 } - } - }, - { - "type": "text", - "value": " is\nanything other than a signed 32-bit integer.", - "position": { - "start": { "line": 4448, "column": 74, "offset": 117430 }, - "end": { "line": 4449, "column": 45, "offset": 117478 } - } - } - ], - "position": { - "start": { "line": 4447, "column": 1, "offset": 117280 }, - "end": { "line": 4449, "column": 45, "offset": 117478 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The ", - "position": { - "start": { "line": 4451, "column": 1, "offset": 117480 }, - "end": { "line": 4451, "column": 5, "offset": 117484 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4451, "column": 5, "offset": 117484 }, - "end": { "line": 4451, "column": 12, "offset": 117491 } - } - }, - { - "type": "text", - "value": " is interpreted and written as a two's complement signed integer.", - "position": { - "start": { "line": 4451, "column": 12, "offset": 117491 }, - "end": { "line": 4451, "column": 77, "offset": 117556 } - } - } - ], - "position": { - "start": { "line": 4451, "column": 1, "offset": 117480 }, - "end": { "line": 4451, "column": 77, "offset": 117556 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.allocUnsafe(4);\n\nbuf.writeInt32BE(0x01020304, 0);\n\nconsole.log(buf);\n// Prints: ", - "position": { - "start": { "line": 4453, "column": 1, "offset": 117558 }, - "end": { "line": 4462, "column": 4, "offset": 117727 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.allocUnsafe(4);\n\nbuf.writeInt32BE(0x01020304, 0);\n\nconsole.log(buf);\n// Prints: ", - "position": { - "start": { "line": 4464, "column": 1, "offset": 117729 }, - "end": { "line": 4473, "column": 4, "offset": 117903 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.writeInt32LE(value[, offset])", - "position": { - "start": { "line": 4475, "column": 5, "offset": 117909 }, - "end": { "line": 4475, "column": 40, "offset": 117944 } - } - } - ], - "position": { - "start": { "line": 4475, "column": 1, "offset": 117905 }, - "end": { "line": 4475, "column": 40, "offset": 117944 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 4477, "column": 1, "offset": 117946 }, - "end": { "line": 4484, "column": 4, "offset": 118170 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4486, "column": 3, "offset": 118174 }, - "end": { "line": 4486, "column": 10, "offset": 118181 } - } - }, - { - "type": "text", - "value": " {integer} Number to be written to ", - "position": { - "start": { "line": 4486, "column": 10, "offset": 118181 }, - "end": { "line": 4486, "column": 45, "offset": 118216 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 4486, "column": 45, "offset": 118216 }, - "end": { "line": 4486, "column": 50, "offset": 118221 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 4486, "column": 50, "offset": 118221 }, - "end": { "line": 4486, "column": 51, "offset": 118222 } - } - } - ], - "position": { - "start": { "line": 4486, "column": 3, "offset": 118174 }, - "end": { "line": 4486, "column": 51, "offset": 118222 } - } - } - ], - "position": { - "start": { "line": 4486, "column": 1, "offset": 118172 }, - "end": { "line": 4486, "column": 51, "offset": 118222 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 4487, "column": 3, "offset": 118225 }, - "end": { "line": 4487, "column": 11, "offset": 118233 } - } - }, - { - "type": "text", - "value": " {integer} Number of bytes to skip before starting to write. Must\nsatisfy ", - "position": { - "start": { "line": 4487, "column": 11, "offset": 118233 }, - "end": { "line": 4488, "column": 11, "offset": 118309 } - } - }, - { - "type": "inlineCode", - "value": "0 <= offset <= buf.length - 4", - "position": { - "start": { "line": 4488, "column": 11, "offset": 118309 }, - "end": { "line": 4488, "column": 42, "offset": 118340 } - } - }, - { - "type": "text", - "value": ". ", - "position": { - "start": { "line": 4488, "column": 42, "offset": 118340 }, - "end": { "line": 4488, "column": 44, "offset": 118342 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { - "line": 4488, - "column": 46, - "offset": 118344 - }, - "end": { "line": 4488, "column": 54, "offset": 118352 } - } - } - ], - "position": { - "start": { "line": 4488, "column": 44, "offset": 118342 }, - "end": { "line": 4488, "column": 56, "offset": 118354 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 4488, "column": 56, "offset": 118354 }, - "end": { "line": 4488, "column": 57, "offset": 118355 } - } - }, - { - "type": "inlineCode", - "value": "0", - "position": { - "start": { "line": 4488, "column": 57, "offset": 118355 }, - "end": { "line": 4488, "column": 60, "offset": 118358 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 4488, "column": 60, "offset": 118358 }, - "end": { "line": 4488, "column": 61, "offset": 118359 } - } - } - ], - "position": { - "start": { "line": 4487, "column": 3, "offset": 118225 }, - "end": { "line": 4488, "column": 61, "offset": 118359 } - } - } - ], - "position": { - "start": { "line": 4487, "column": 1, "offset": 118223 }, - "end": { "line": 4488, "column": 61, "offset": 118359 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {integer} ", - "position": { - "start": { "line": 4489, "column": 3, "offset": 118362 }, - "end": { "line": 4489, "column": 22, "offset": 118381 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 4489, "column": 22, "offset": 118381 }, - "end": { "line": 4489, "column": 30, "offset": 118389 } - } - }, - { - "type": "text", - "value": " plus the number of bytes written.", - "position": { - "start": { "line": 4489, "column": 30, "offset": 118389 }, - "end": { "line": 4489, "column": 64, "offset": 118423 } - } - } - ], - "position": { - "start": { "line": 4489, "column": 3, "offset": 118362 }, - "end": { "line": 4489, "column": 64, "offset": 118423 } - } - } - ], - "position": { - "start": { "line": 4489, "column": 1, "offset": 118360 }, - "end": { "line": 4489, "column": 64, "offset": 118423 } - } - } - ], - "position": { - "start": { "line": 4486, "column": 1, "offset": 118172 }, - "end": { "line": 4489, "column": 64, "offset": 118423 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Writes ", - "position": { - "start": { "line": 4491, "column": 1, "offset": 118425 }, - "end": { "line": 4491, "column": 8, "offset": 118432 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4491, "column": 8, "offset": 118432 }, - "end": { "line": 4491, "column": 15, "offset": 118439 } - } - }, - { - "type": "text", - "value": " to ", - "position": { - "start": { "line": 4491, "column": 15, "offset": 118439 }, - "end": { "line": 4491, "column": 19, "offset": 118443 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 4491, "column": 19, "offset": 118443 }, - "end": { "line": 4491, "column": 24, "offset": 118448 } - } - }, - { - "type": "text", - "value": " at the specified ", - "position": { - "start": { "line": 4491, "column": 24, "offset": 118448 }, - "end": { "line": 4491, "column": 42, "offset": 118466 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 4491, "column": 42, "offset": 118466 }, - "end": { "line": 4491, "column": 50, "offset": 118474 } - } - }, - { - "type": "text", - "value": " as little-endian. The ", - "position": { - "start": { "line": 4491, "column": 50, "offset": 118474 }, - "end": { "line": 4491, "column": 73, "offset": 118497 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4491, "column": 73, "offset": 118497 }, - "end": { "line": 4491, "column": 80, "offset": 118504 } - } - }, - { - "type": "text", - "value": "\nmust be a valid signed 32-bit integer. Behavior is undefined when ", - "position": { - "start": { "line": 4491, "column": 80, "offset": 118504 }, - "end": { "line": 4492, "column": 67, "offset": 118571 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4492, "column": 67, "offset": 118571 }, - "end": { "line": 4492, "column": 74, "offset": 118578 } - } - }, - { - "type": "text", - "value": " is\nanything other than a signed 32-bit integer.", - "position": { - "start": { "line": 4492, "column": 74, "offset": 118578 }, - "end": { "line": 4493, "column": 45, "offset": 118626 } - } - } - ], - "position": { - "start": { "line": 4491, "column": 1, "offset": 118425 }, - "end": { "line": 4493, "column": 45, "offset": 118626 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The ", - "position": { - "start": { "line": 4495, "column": 1, "offset": 118628 }, - "end": { "line": 4495, "column": 5, "offset": 118632 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4495, "column": 5, "offset": 118632 }, - "end": { "line": 4495, "column": 12, "offset": 118639 } - } - }, - { - "type": "text", - "value": " is interpreted and written as a two's complement signed integer.", - "position": { - "start": { "line": 4495, "column": 12, "offset": 118639 }, - "end": { "line": 4495, "column": 77, "offset": 118704 } - } - } - ], - "position": { - "start": { "line": 4495, "column": 1, "offset": 118628 }, - "end": { "line": 4495, "column": 77, "offset": 118704 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.allocUnsafe(4);\n\nbuf.writeInt32LE(0x05060708, 0);\n\nconsole.log(buf);\n// Prints: ", - "position": { - "start": { "line": 4497, "column": 1, "offset": 118706 }, - "end": { "line": 4506, "column": 4, "offset": 118875 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.allocUnsafe(4);\n\nbuf.writeInt32LE(0x05060708, 0);\n\nconsole.log(buf);\n// Prints: ", - "position": { - "start": { "line": 4508, "column": 1, "offset": 118877 }, - "end": { "line": 4517, "column": 4, "offset": 119051 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.writeIntBE(value, offset, byteLength)", - "position": { - "start": { "line": 4519, "column": 5, "offset": 119057 }, - "end": { "line": 4519, "column": 48, "offset": 119100 } - } - } - ], - "position": { - "start": { "line": 4519, "column": 1, "offset": 119053 }, - "end": { "line": 4519, "column": 48, "offset": 119100 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 4521, "column": 1, "offset": 119102 }, - "end": { "line": 4528, "column": 4, "offset": 119345 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4530, "column": 3, "offset": 119349 }, - "end": { "line": 4530, "column": 10, "offset": 119356 } - } - }, - { - "type": "text", - "value": " {integer} Number to be written to ", - "position": { - "start": { "line": 4530, "column": 10, "offset": 119356 }, - "end": { "line": 4530, "column": 45, "offset": 119391 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 4530, "column": 45, "offset": 119391 }, - "end": { "line": 4530, "column": 50, "offset": 119396 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 4530, "column": 50, "offset": 119396 }, - "end": { "line": 4530, "column": 51, "offset": 119397 } - } - } - ], - "position": { - "start": { "line": 4530, "column": 3, "offset": 119349 }, - "end": { "line": 4530, "column": 51, "offset": 119397 } - } - } - ], - "position": { - "start": { "line": 4530, "column": 1, "offset": 119347 }, - "end": { "line": 4530, "column": 51, "offset": 119397 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 4531, "column": 3, "offset": 119400 }, - "end": { "line": 4531, "column": 11, "offset": 119408 } - } - }, - { - "type": "text", - "value": " {integer} Number of bytes to skip before starting to write. Must\nsatisfy ", - "position": { - "start": { "line": 4531, "column": 11, "offset": 119408 }, - "end": { "line": 4532, "column": 11, "offset": 119484 } - } - }, - { - "type": "inlineCode", - "value": "0 <= offset <= buf.length - byteLength", - "position": { - "start": { "line": 4532, "column": 11, "offset": 119484 }, - "end": { "line": 4532, "column": 51, "offset": 119524 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 4532, "column": 51, "offset": 119524 }, - "end": { "line": 4532, "column": 52, "offset": 119525 } - } - } - ], - "position": { - "start": { "line": 4531, "column": 3, "offset": 119400 }, - "end": { "line": 4532, "column": 52, "offset": 119525 } - } - } - ], - "position": { - "start": { "line": 4531, "column": 1, "offset": 119398 }, - "end": { "line": 4532, "column": 52, "offset": 119525 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "byteLength", - "position": { - "start": { "line": 4533, "column": 3, "offset": 119528 }, - "end": { "line": 4533, "column": 15, "offset": 119540 } - } - }, - { - "type": "text", - "value": " {integer} Number of bytes to write. Must satisfy\n", - "position": { - "start": { "line": 4533, "column": 15, "offset": 119540 }, - "end": { "line": 4534, "column": 1, "offset": 119590 } - } - }, - { - "type": "inlineCode", - "value": "0 < byteLength <= 6", - "position": { - "start": { "line": 4534, "column": 3, "offset": 119592 }, - "end": { "line": 4534, "column": 24, "offset": 119613 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 4534, "column": 24, "offset": 119613 }, - "end": { "line": 4534, "column": 25, "offset": 119614 } - } - } - ], - "position": { - "start": { "line": 4533, "column": 3, "offset": 119528 }, - "end": { "line": 4534, "column": 25, "offset": 119614 } - } - } - ], - "position": { - "start": { "line": 4533, "column": 1, "offset": 119526 }, - "end": { "line": 4534, "column": 25, "offset": 119614 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {integer} ", - "position": { - "start": { "line": 4535, "column": 3, "offset": 119617 }, - "end": { "line": 4535, "column": 22, "offset": 119636 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 4535, "column": 22, "offset": 119636 }, - "end": { "line": 4535, "column": 30, "offset": 119644 } - } - }, - { - "type": "text", - "value": " plus the number of bytes written.", - "position": { - "start": { "line": 4535, "column": 30, "offset": 119644 }, - "end": { "line": 4535, "column": 64, "offset": 119678 } - } - } - ], - "position": { - "start": { "line": 4535, "column": 3, "offset": 119617 }, - "end": { "line": 4535, "column": 64, "offset": 119678 } - } - } - ], - "position": { - "start": { "line": 4535, "column": 1, "offset": 119615 }, - "end": { "line": 4535, "column": 64, "offset": 119678 } - } - } - ], - "position": { - "start": { "line": 4530, "column": 1, "offset": 119347 }, - "end": { "line": 4535, "column": 64, "offset": 119678 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Writes ", - "position": { - "start": { "line": 4537, "column": 1, "offset": 119680 }, - "end": { "line": 4537, "column": 8, "offset": 119687 } - } - }, - { - "type": "inlineCode", - "value": "byteLength", - "position": { - "start": { "line": 4537, "column": 8, "offset": 119687 }, - "end": { "line": 4537, "column": 20, "offset": 119699 } - } - }, - { - "type": "text", - "value": " bytes of ", - "position": { - "start": { "line": 4537, "column": 20, "offset": 119699 }, - "end": { "line": 4537, "column": 30, "offset": 119709 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4537, "column": 30, "offset": 119709 }, - "end": { "line": 4537, "column": 37, "offset": 119716 } - } - }, - { - "type": "text", - "value": " to ", - "position": { - "start": { "line": 4537, "column": 37, "offset": 119716 }, - "end": { "line": 4537, "column": 41, "offset": 119720 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 4537, "column": 41, "offset": 119720 }, - "end": { "line": 4537, "column": 46, "offset": 119725 } - } - }, - { - "type": "text", - "value": " at the specified ", - "position": { - "start": { "line": 4537, "column": 46, "offset": 119725 }, - "end": { "line": 4537, "column": 64, "offset": 119743 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 4537, "column": 64, "offset": 119743 }, - "end": { "line": 4537, "column": 72, "offset": 119751 } - } - }, - { - "type": "text", - "value": "\nas big-endian. Supports up to 48 bits of accuracy. Behavior is undefined when\n", - "position": { - "start": { "line": 4537, "column": 72, "offset": 119751 }, - "end": { "line": 4539, "column": 1, "offset": 119830 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4539, "column": 1, "offset": 119830 }, - "end": { "line": 4539, "column": 8, "offset": 119837 } - } - }, - { - "type": "text", - "value": " is anything other than a signed integer.", - "position": { - "start": { "line": 4539, "column": 8, "offset": 119837 }, - "end": { "line": 4539, "column": 49, "offset": 119878 } - } - } - ], - "position": { - "start": { "line": 4537, "column": 1, "offset": 119680 }, - "end": { "line": 4539, "column": 49, "offset": 119878 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.allocUnsafe(6);\n\nbuf.writeIntBE(0x1234567890ab, 0, 6);\n\nconsole.log(buf);\n// Prints: ", - "position": { - "start": { "line": 4541, "column": 1, "offset": 119880 }, - "end": { "line": 4550, "column": 4, "offset": 120060 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.allocUnsafe(6);\n\nbuf.writeIntBE(0x1234567890ab, 0, 6);\n\nconsole.log(buf);\n// Prints: ", - "position": { - "start": { "line": 4552, "column": 1, "offset": 120062 }, - "end": { "line": 4561, "column": 4, "offset": 120247 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.writeIntLE(value, offset, byteLength)", - "position": { - "start": { "line": 4563, "column": 5, "offset": 120253 }, - "end": { "line": 4563, "column": 48, "offset": 120296 } - } - } - ], - "position": { - "start": { "line": 4563, "column": 1, "offset": 120249 }, - "end": { "line": 4563, "column": 48, "offset": 120296 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 4565, "column": 1, "offset": 120298 }, - "end": { "line": 4572, "column": 4, "offset": 120541 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4574, "column": 3, "offset": 120545 }, - "end": { "line": 4574, "column": 10, "offset": 120552 } - } - }, - { - "type": "text", - "value": " {integer} Number to be written to ", - "position": { - "start": { "line": 4574, "column": 10, "offset": 120552 }, - "end": { "line": 4574, "column": 45, "offset": 120587 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 4574, "column": 45, "offset": 120587 }, - "end": { "line": 4574, "column": 50, "offset": 120592 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 4574, "column": 50, "offset": 120592 }, - "end": { "line": 4574, "column": 51, "offset": 120593 } - } - } - ], - "position": { - "start": { "line": 4574, "column": 3, "offset": 120545 }, - "end": { "line": 4574, "column": 51, "offset": 120593 } - } - } - ], - "position": { - "start": { "line": 4574, "column": 1, "offset": 120543 }, - "end": { "line": 4574, "column": 51, "offset": 120593 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 4575, "column": 3, "offset": 120596 }, - "end": { "line": 4575, "column": 11, "offset": 120604 } - } - }, - { - "type": "text", - "value": " {integer} Number of bytes to skip before starting to write. Must\nsatisfy ", - "position": { - "start": { "line": 4575, "column": 11, "offset": 120604 }, - "end": { "line": 4576, "column": 11, "offset": 120680 } - } - }, - { - "type": "inlineCode", - "value": "0 <= offset <= buf.length - byteLength", - "position": { - "start": { "line": 4576, "column": 11, "offset": 120680 }, - "end": { "line": 4576, "column": 51, "offset": 120720 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 4576, "column": 51, "offset": 120720 }, - "end": { "line": 4576, "column": 52, "offset": 120721 } - } - } - ], - "position": { - "start": { "line": 4575, "column": 3, "offset": 120596 }, - "end": { "line": 4576, "column": 52, "offset": 120721 } - } - } - ], - "position": { - "start": { "line": 4575, "column": 1, "offset": 120594 }, - "end": { "line": 4576, "column": 52, "offset": 120721 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "byteLength", - "position": { - "start": { "line": 4577, "column": 3, "offset": 120724 }, - "end": { "line": 4577, "column": 15, "offset": 120736 } - } - }, - { - "type": "text", - "value": " {integer} Number of bytes to write. Must satisfy\n", - "position": { - "start": { "line": 4577, "column": 15, "offset": 120736 }, - "end": { "line": 4578, "column": 1, "offset": 120786 } - } - }, - { - "type": "inlineCode", - "value": "0 < byteLength <= 6", - "position": { - "start": { "line": 4578, "column": 3, "offset": 120788 }, - "end": { "line": 4578, "column": 24, "offset": 120809 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 4578, "column": 24, "offset": 120809 }, - "end": { "line": 4578, "column": 25, "offset": 120810 } - } - } - ], - "position": { - "start": { "line": 4577, "column": 3, "offset": 120724 }, - "end": { "line": 4578, "column": 25, "offset": 120810 } - } - } - ], - "position": { - "start": { "line": 4577, "column": 1, "offset": 120722 }, - "end": { "line": 4578, "column": 25, "offset": 120810 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {integer} ", - "position": { - "start": { "line": 4579, "column": 3, "offset": 120813 }, - "end": { "line": 4579, "column": 22, "offset": 120832 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 4579, "column": 22, "offset": 120832 }, - "end": { "line": 4579, "column": 30, "offset": 120840 } - } - }, - { - "type": "text", - "value": " plus the number of bytes written.", - "position": { - "start": { "line": 4579, "column": 30, "offset": 120840 }, - "end": { "line": 4579, "column": 64, "offset": 120874 } - } - } - ], - "position": { - "start": { "line": 4579, "column": 3, "offset": 120813 }, - "end": { "line": 4579, "column": 64, "offset": 120874 } - } - } - ], - "position": { - "start": { "line": 4579, "column": 1, "offset": 120811 }, - "end": { "line": 4579, "column": 64, "offset": 120874 } - } - } - ], - "position": { - "start": { "line": 4574, "column": 1, "offset": 120543 }, - "end": { "line": 4579, "column": 64, "offset": 120874 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Writes ", - "position": { - "start": { "line": 4581, "column": 1, "offset": 120876 }, - "end": { "line": 4581, "column": 8, "offset": 120883 } - } - }, - { - "type": "inlineCode", - "value": "byteLength", - "position": { - "start": { "line": 4581, "column": 8, "offset": 120883 }, - "end": { "line": 4581, "column": 20, "offset": 120895 } - } - }, - { - "type": "text", - "value": " bytes of ", - "position": { - "start": { "line": 4581, "column": 20, "offset": 120895 }, - "end": { "line": 4581, "column": 30, "offset": 120905 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4581, "column": 30, "offset": 120905 }, - "end": { "line": 4581, "column": 37, "offset": 120912 } - } - }, - { - "type": "text", - "value": " to ", - "position": { - "start": { "line": 4581, "column": 37, "offset": 120912 }, - "end": { "line": 4581, "column": 41, "offset": 120916 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 4581, "column": 41, "offset": 120916 }, - "end": { "line": 4581, "column": 46, "offset": 120921 } - } - }, - { - "type": "text", - "value": " at the specified ", - "position": { - "start": { "line": 4581, "column": 46, "offset": 120921 }, - "end": { "line": 4581, "column": 64, "offset": 120939 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 4581, "column": 64, "offset": 120939 }, - "end": { "line": 4581, "column": 72, "offset": 120947 } - } - }, - { - "type": "text", - "value": "\nas little-endian. Supports up to 48 bits of accuracy. Behavior is undefined\nwhen ", - "position": { - "start": { "line": 4581, "column": 72, "offset": 120947 }, - "end": { "line": 4583, "column": 6, "offset": 121029 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4583, "column": 6, "offset": 121029 }, - "end": { "line": 4583, "column": 13, "offset": 121036 } - } - }, - { - "type": "text", - "value": " is anything other than a signed integer.", - "position": { - "start": { "line": 4583, "column": 13, "offset": 121036 }, - "end": { "line": 4583, "column": 54, "offset": 121077 } - } - } - ], - "position": { - "start": { "line": 4581, "column": 1, "offset": 120876 }, - "end": { "line": 4583, "column": 54, "offset": 121077 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.allocUnsafe(6);\n\nbuf.writeIntLE(0x1234567890ab, 0, 6);\n\nconsole.log(buf);\n// Prints: ", - "position": { - "start": { "line": 4585, "column": 1, "offset": 121079 }, - "end": { "line": 4594, "column": 4, "offset": 121259 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.allocUnsafe(6);\n\nbuf.writeIntLE(0x1234567890ab, 0, 6);\n\nconsole.log(buf);\n// Prints: ", - "position": { - "start": { "line": 4596, "column": 1, "offset": 121261 }, - "end": { "line": 4605, "column": 4, "offset": 121446 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.writeUInt8(value[, offset])", - "position": { - "start": { "line": 4607, "column": 5, "offset": 121452 }, - "end": { "line": 4607, "column": 38, "offset": 121485 } - } - } - ], - "position": { - "start": { "line": 4607, "column": 1, "offset": 121448 }, - "end": { "line": 4607, "column": 38, "offset": 121485 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 4609, "column": 1, "offset": 121487 }, - "end": { "line": 4621, "column": 4, "offset": 121879 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4623, "column": 3, "offset": 121883 }, - "end": { "line": 4623, "column": 10, "offset": 121890 } - } - }, - { - "type": "text", - "value": " {integer} Number to be written to ", - "position": { - "start": { "line": 4623, "column": 10, "offset": 121890 }, - "end": { "line": 4623, "column": 45, "offset": 121925 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 4623, "column": 45, "offset": 121925 }, - "end": { "line": 4623, "column": 50, "offset": 121930 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 4623, "column": 50, "offset": 121930 }, - "end": { "line": 4623, "column": 51, "offset": 121931 } - } - } - ], - "position": { - "start": { "line": 4623, "column": 3, "offset": 121883 }, - "end": { "line": 4623, "column": 51, "offset": 121931 } - } - } - ], - "position": { - "start": { "line": 4623, "column": 1, "offset": 121881 }, - "end": { "line": 4623, "column": 51, "offset": 121931 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 4624, "column": 3, "offset": 121934 }, - "end": { "line": 4624, "column": 11, "offset": 121942 } - } - }, - { - "type": "text", - "value": " {integer} Number of bytes to skip before starting to write. Must\nsatisfy ", - "position": { - "start": { "line": 4624, "column": 11, "offset": 121942 }, - "end": { "line": 4625, "column": 11, "offset": 122018 } - } - }, - { - "type": "inlineCode", - "value": "0 <= offset <= buf.length - 1", - "position": { - "start": { "line": 4625, "column": 11, "offset": 122018 }, - "end": { "line": 4625, "column": 42, "offset": 122049 } - } - }, - { - "type": "text", - "value": ". ", - "position": { - "start": { "line": 4625, "column": 42, "offset": 122049 }, - "end": { "line": 4625, "column": 44, "offset": 122051 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { - "line": 4625, - "column": 46, - "offset": 122053 - }, - "end": { "line": 4625, "column": 54, "offset": 122061 } - } - } - ], - "position": { - "start": { "line": 4625, "column": 44, "offset": 122051 }, - "end": { "line": 4625, "column": 56, "offset": 122063 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 4625, "column": 56, "offset": 122063 }, - "end": { "line": 4625, "column": 57, "offset": 122064 } - } - }, - { - "type": "inlineCode", - "value": "0", - "position": { - "start": { "line": 4625, "column": 57, "offset": 122064 }, - "end": { "line": 4625, "column": 60, "offset": 122067 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 4625, "column": 60, "offset": 122067 }, - "end": { "line": 4625, "column": 61, "offset": 122068 } - } - } - ], - "position": { - "start": { "line": 4624, "column": 3, "offset": 121934 }, - "end": { "line": 4625, "column": 61, "offset": 122068 } - } - } - ], - "position": { - "start": { "line": 4624, "column": 1, "offset": 121932 }, - "end": { "line": 4625, "column": 61, "offset": 122068 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {integer} ", - "position": { - "start": { "line": 4626, "column": 3, "offset": 122071 }, - "end": { "line": 4626, "column": 22, "offset": 122090 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 4626, "column": 22, "offset": 122090 }, - "end": { "line": 4626, "column": 30, "offset": 122098 } - } - }, - { - "type": "text", - "value": " plus the number of bytes written.", - "position": { - "start": { "line": 4626, "column": 30, "offset": 122098 }, - "end": { "line": 4626, "column": 64, "offset": 122132 } - } - } - ], - "position": { - "start": { "line": 4626, "column": 3, "offset": 122071 }, - "end": { "line": 4626, "column": 64, "offset": 122132 } - } - } - ], - "position": { - "start": { "line": 4626, "column": 1, "offset": 122069 }, - "end": { "line": 4626, "column": 64, "offset": 122132 } - } - } - ], - "position": { - "start": { "line": 4623, "column": 1, "offset": 121881 }, - "end": { "line": 4626, "column": 64, "offset": 122132 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Writes ", - "position": { - "start": { "line": 4628, "column": 1, "offset": 122134 }, - "end": { "line": 4628, "column": 8, "offset": 122141 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4628, "column": 8, "offset": 122141 }, - "end": { "line": 4628, "column": 15, "offset": 122148 } - } - }, - { - "type": "text", - "value": " to ", - "position": { - "start": { "line": 4628, "column": 15, "offset": 122148 }, - "end": { "line": 4628, "column": 19, "offset": 122152 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 4628, "column": 19, "offset": 122152 }, - "end": { "line": 4628, "column": 24, "offset": 122157 } - } - }, - { - "type": "text", - "value": " at the specified ", - "position": { - "start": { "line": 4628, "column": 24, "offset": 122157 }, - "end": { "line": 4628, "column": 42, "offset": 122175 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 4628, "column": 42, "offset": 122175 }, - "end": { "line": 4628, "column": 50, "offset": 122183 } - } - }, - { - "type": "text", - "value": ". ", - "position": { - "start": { "line": 4628, "column": 50, "offset": 122183 }, - "end": { "line": 4628, "column": 52, "offset": 122185 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4628, "column": 52, "offset": 122185 }, - "end": { "line": 4628, "column": 59, "offset": 122192 } - } - }, - { - "type": "text", - "value": " must be a\nvalid unsigned 8-bit integer. Behavior is undefined when ", - "position": { - "start": { "line": 4628, "column": 59, "offset": 122192 }, - "end": { "line": 4629, "column": 58, "offset": 122260 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4629, "column": 58, "offset": 122260 }, - "end": { "line": 4629, "column": 65, "offset": 122267 } - } - }, - { - "type": "text", - "value": " is anything\nother than an unsigned 8-bit integer.", - "position": { - "start": { "line": 4629, "column": 65, "offset": 122267 }, - "end": { "line": 4630, "column": 38, "offset": 122317 } - } - } - ], - "position": { - "start": { "line": 4628, "column": 1, "offset": 122134 }, - "end": { "line": 4630, "column": 38, "offset": 122317 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This function is also available under the ", - "position": { - "start": { "line": 4632, "column": 1, "offset": 122319 }, - "end": { "line": 4632, "column": 43, "offset": 122361 } - } - }, - { - "type": "inlineCode", - "value": "writeUint8", - "position": { - "start": { "line": 4632, "column": 43, "offset": 122361 }, - "end": { "line": 4632, "column": 55, "offset": 122373 } - } - }, - { - "type": "text", - "value": " alias.", - "position": { - "start": { "line": 4632, "column": 55, "offset": 122373 }, - "end": { "line": 4632, "column": 62, "offset": 122380 } - } - } - ], - "position": { - "start": { "line": 4632, "column": 1, "offset": 122319 }, - "end": { "line": 4632, "column": 62, "offset": 122380 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.allocUnsafe(4);\n\nbuf.writeUInt8(0x3, 0);\nbuf.writeUInt8(0x4, 1);\nbuf.writeUInt8(0x23, 2);\nbuf.writeUInt8(0x42, 3);\n\nconsole.log(buf);\n// Prints: ", - "position": { - "start": { "line": 4634, "column": 1, "offset": 122382 }, - "end": { "line": 4646, "column": 4, "offset": 122616 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.allocUnsafe(4);\n\nbuf.writeUInt8(0x3, 0);\nbuf.writeUInt8(0x4, 1);\nbuf.writeUInt8(0x23, 2);\nbuf.writeUInt8(0x42, 3);\n\nconsole.log(buf);\n// Prints: ", - "position": { - "start": { "line": 4648, "column": 1, "offset": 122618 }, - "end": { "line": 4660, "column": 4, "offset": 122857 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.writeUInt16BE(value[, offset])", - "position": { - "start": { "line": 4662, "column": 5, "offset": 122863 }, - "end": { "line": 4662, "column": 41, "offset": 122899 } - } - } - ], - "position": { - "start": { "line": 4662, "column": 1, "offset": 122859 }, - "end": { "line": 4662, "column": 41, "offset": 122899 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 4664, "column": 1, "offset": 122901 }, - "end": { "line": 4676, "column": 4, "offset": 123296 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4678, "column": 3, "offset": 123300 }, - "end": { "line": 4678, "column": 10, "offset": 123307 } - } - }, - { - "type": "text", - "value": " {integer} Number to be written to ", - "position": { - "start": { "line": 4678, "column": 10, "offset": 123307 }, - "end": { "line": 4678, "column": 45, "offset": 123342 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 4678, "column": 45, "offset": 123342 }, - "end": { "line": 4678, "column": 50, "offset": 123347 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 4678, "column": 50, "offset": 123347 }, - "end": { "line": 4678, "column": 51, "offset": 123348 } - } - } - ], - "position": { - "start": { "line": 4678, "column": 3, "offset": 123300 }, - "end": { "line": 4678, "column": 51, "offset": 123348 } - } - } - ], - "position": { - "start": { "line": 4678, "column": 1, "offset": 123298 }, - "end": { "line": 4678, "column": 51, "offset": 123348 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 4679, "column": 3, "offset": 123351 }, - "end": { "line": 4679, "column": 11, "offset": 123359 } - } - }, - { - "type": "text", - "value": " {integer} Number of bytes to skip before starting to write. Must\nsatisfy ", - "position": { - "start": { "line": 4679, "column": 11, "offset": 123359 }, - "end": { "line": 4680, "column": 11, "offset": 123435 } - } - }, - { - "type": "inlineCode", - "value": "0 <= offset <= buf.length - 2", - "position": { - "start": { "line": 4680, "column": 11, "offset": 123435 }, - "end": { "line": 4680, "column": 42, "offset": 123466 } - } - }, - { - "type": "text", - "value": ". ", - "position": { - "start": { "line": 4680, "column": 42, "offset": 123466 }, - "end": { "line": 4680, "column": 44, "offset": 123468 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { - "line": 4680, - "column": 46, - "offset": 123470 - }, - "end": { "line": 4680, "column": 54, "offset": 123478 } - } - } - ], - "position": { - "start": { "line": 4680, "column": 44, "offset": 123468 }, - "end": { "line": 4680, "column": 56, "offset": 123480 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 4680, "column": 56, "offset": 123480 }, - "end": { "line": 4680, "column": 57, "offset": 123481 } - } - }, - { - "type": "inlineCode", - "value": "0", - "position": { - "start": { "line": 4680, "column": 57, "offset": 123481 }, - "end": { "line": 4680, "column": 60, "offset": 123484 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 4680, "column": 60, "offset": 123484 }, - "end": { "line": 4680, "column": 61, "offset": 123485 } - } - } - ], - "position": { - "start": { "line": 4679, "column": 3, "offset": 123351 }, - "end": { "line": 4680, "column": 61, "offset": 123485 } - } - } - ], - "position": { - "start": { "line": 4679, "column": 1, "offset": 123349 }, - "end": { "line": 4680, "column": 61, "offset": 123485 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {integer} ", - "position": { - "start": { "line": 4681, "column": 3, "offset": 123488 }, - "end": { "line": 4681, "column": 22, "offset": 123507 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 4681, "column": 22, "offset": 123507 }, - "end": { "line": 4681, "column": 30, "offset": 123515 } - } - }, - { - "type": "text", - "value": " plus the number of bytes written.", - "position": { - "start": { "line": 4681, "column": 30, "offset": 123515 }, - "end": { "line": 4681, "column": 64, "offset": 123549 } - } - } - ], - "position": { - "start": { "line": 4681, "column": 3, "offset": 123488 }, - "end": { "line": 4681, "column": 64, "offset": 123549 } - } - } - ], - "position": { - "start": { "line": 4681, "column": 1, "offset": 123486 }, - "end": { "line": 4681, "column": 64, "offset": 123549 } - } - } - ], - "position": { - "start": { "line": 4678, "column": 1, "offset": 123298 }, - "end": { "line": 4681, "column": 64, "offset": 123549 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Writes ", - "position": { - "start": { "line": 4683, "column": 1, "offset": 123551 }, - "end": { "line": 4683, "column": 8, "offset": 123558 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4683, "column": 8, "offset": 123558 }, - "end": { "line": 4683, "column": 15, "offset": 123565 } - } - }, - { - "type": "text", - "value": " to ", - "position": { - "start": { "line": 4683, "column": 15, "offset": 123565 }, - "end": { "line": 4683, "column": 19, "offset": 123569 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 4683, "column": 19, "offset": 123569 }, - "end": { "line": 4683, "column": 24, "offset": 123574 } - } - }, - { - "type": "text", - "value": " at the specified ", - "position": { - "start": { "line": 4683, "column": 24, "offset": 123574 }, - "end": { "line": 4683, "column": 42, "offset": 123592 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 4683, "column": 42, "offset": 123592 }, - "end": { "line": 4683, "column": 50, "offset": 123600 } - } - }, - { - "type": "text", - "value": " as big-endian. The ", - "position": { - "start": { "line": 4683, "column": 50, "offset": 123600 }, - "end": { "line": 4683, "column": 70, "offset": 123620 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4683, "column": 70, "offset": 123620 }, - "end": { "line": 4683, "column": 77, "offset": 123627 } - } - }, - { - "type": "text", - "value": "\nmust be a valid unsigned 16-bit integer. Behavior is undefined when ", - "position": { - "start": { "line": 4683, "column": 77, "offset": 123627 }, - "end": { "line": 4684, "column": 69, "offset": 123696 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4684, "column": 69, "offset": 123696 }, - "end": { "line": 4684, "column": 76, "offset": 123703 } - } - }, - { - "type": "text", - "value": "\nis anything other than an unsigned 16-bit integer.", - "position": { - "start": { "line": 4684, "column": 76, "offset": 123703 }, - "end": { "line": 4685, "column": 51, "offset": 123754 } - } - } - ], - "position": { - "start": { "line": 4683, "column": 1, "offset": 123551 }, - "end": { "line": 4685, "column": 51, "offset": 123754 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This function is also available under the ", - "position": { - "start": { "line": 4687, "column": 1, "offset": 123756 }, - "end": { "line": 4687, "column": 43, "offset": 123798 } - } - }, - { - "type": "inlineCode", - "value": "writeUint16BE", - "position": { - "start": { "line": 4687, "column": 43, "offset": 123798 }, - "end": { "line": 4687, "column": 58, "offset": 123813 } - } - }, - { - "type": "text", - "value": " alias.", - "position": { - "start": { "line": 4687, "column": 58, "offset": 123813 }, - "end": { "line": 4687, "column": 65, "offset": 123820 } - } - } - ], - "position": { - "start": { "line": 4687, "column": 1, "offset": 123756 }, - "end": { "line": 4687, "column": 65, "offset": 123820 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.allocUnsafe(4);\n\nbuf.writeUInt16BE(0xdead, 0);\nbuf.writeUInt16BE(0xbeef, 2);\n\nconsole.log(buf);\n// Prints: ", - "position": { - "start": { "line": 4689, "column": 1, "offset": 123822 }, - "end": { "line": 4699, "column": 4, "offset": 124018 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.allocUnsafe(4);\n\nbuf.writeUInt16BE(0xdead, 0);\nbuf.writeUInt16BE(0xbeef, 2);\n\nconsole.log(buf);\n// Prints: ", - "position": { - "start": { "line": 4701, "column": 1, "offset": 124020 }, - "end": { "line": 4711, "column": 4, "offset": 124221 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.writeUInt16LE(value[, offset])", - "position": { - "start": { "line": 4713, "column": 5, "offset": 124227 }, - "end": { "line": 4713, "column": 41, "offset": 124263 } - } - } - ], - "position": { - "start": { "line": 4713, "column": 1, "offset": 124223 }, - "end": { "line": 4713, "column": 41, "offset": 124263 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 4715, "column": 1, "offset": 124265 }, - "end": { "line": 4727, "column": 4, "offset": 124660 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4729, "column": 3, "offset": 124664 }, - "end": { "line": 4729, "column": 10, "offset": 124671 } - } - }, - { - "type": "text", - "value": " {integer} Number to be written to ", - "position": { - "start": { "line": 4729, "column": 10, "offset": 124671 }, - "end": { "line": 4729, "column": 45, "offset": 124706 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 4729, "column": 45, "offset": 124706 }, - "end": { "line": 4729, "column": 50, "offset": 124711 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 4729, "column": 50, "offset": 124711 }, - "end": { "line": 4729, "column": 51, "offset": 124712 } - } - } - ], - "position": { - "start": { "line": 4729, "column": 3, "offset": 124664 }, - "end": { "line": 4729, "column": 51, "offset": 124712 } - } - } - ], - "position": { - "start": { "line": 4729, "column": 1, "offset": 124662 }, - "end": { "line": 4729, "column": 51, "offset": 124712 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 4730, "column": 3, "offset": 124715 }, - "end": { "line": 4730, "column": 11, "offset": 124723 } - } - }, - { - "type": "text", - "value": " {integer} Number of bytes to skip before starting to write. Must\nsatisfy ", - "position": { - "start": { "line": 4730, "column": 11, "offset": 124723 }, - "end": { "line": 4731, "column": 11, "offset": 124799 } - } - }, - { - "type": "inlineCode", - "value": "0 <= offset <= buf.length - 2", - "position": { - "start": { "line": 4731, "column": 11, "offset": 124799 }, - "end": { "line": 4731, "column": 42, "offset": 124830 } - } - }, - { - "type": "text", - "value": ". ", - "position": { - "start": { "line": 4731, "column": 42, "offset": 124830 }, - "end": { "line": 4731, "column": 44, "offset": 124832 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { - "line": 4731, - "column": 46, - "offset": 124834 - }, - "end": { "line": 4731, "column": 54, "offset": 124842 } - } - } - ], - "position": { - "start": { "line": 4731, "column": 44, "offset": 124832 }, - "end": { "line": 4731, "column": 56, "offset": 124844 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 4731, "column": 56, "offset": 124844 }, - "end": { "line": 4731, "column": 57, "offset": 124845 } - } - }, - { - "type": "inlineCode", - "value": "0", - "position": { - "start": { "line": 4731, "column": 57, "offset": 124845 }, - "end": { "line": 4731, "column": 60, "offset": 124848 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 4731, "column": 60, "offset": 124848 }, - "end": { "line": 4731, "column": 61, "offset": 124849 } - } - } - ], - "position": { - "start": { "line": 4730, "column": 3, "offset": 124715 }, - "end": { "line": 4731, "column": 61, "offset": 124849 } - } - } - ], - "position": { - "start": { "line": 4730, "column": 1, "offset": 124713 }, - "end": { "line": 4731, "column": 61, "offset": 124849 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {integer} ", - "position": { - "start": { "line": 4732, "column": 3, "offset": 124852 }, - "end": { "line": 4732, "column": 22, "offset": 124871 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 4732, "column": 22, "offset": 124871 }, - "end": { "line": 4732, "column": 30, "offset": 124879 } - } - }, - { - "type": "text", - "value": " plus the number of bytes written.", - "position": { - "start": { "line": 4732, "column": 30, "offset": 124879 }, - "end": { "line": 4732, "column": 64, "offset": 124913 } - } - } - ], - "position": { - "start": { "line": 4732, "column": 3, "offset": 124852 }, - "end": { "line": 4732, "column": 64, "offset": 124913 } - } - } - ], - "position": { - "start": { "line": 4732, "column": 1, "offset": 124850 }, - "end": { "line": 4732, "column": 64, "offset": 124913 } - } - } - ], - "position": { - "start": { "line": 4729, "column": 1, "offset": 124662 }, - "end": { "line": 4732, "column": 64, "offset": 124913 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Writes ", - "position": { - "start": { "line": 4734, "column": 1, "offset": 124915 }, - "end": { "line": 4734, "column": 8, "offset": 124922 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4734, "column": 8, "offset": 124922 }, - "end": { "line": 4734, "column": 15, "offset": 124929 } - } - }, - { - "type": "text", - "value": " to ", - "position": { - "start": { "line": 4734, "column": 15, "offset": 124929 }, - "end": { "line": 4734, "column": 19, "offset": 124933 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 4734, "column": 19, "offset": 124933 }, - "end": { "line": 4734, "column": 24, "offset": 124938 } - } - }, - { - "type": "text", - "value": " at the specified ", - "position": { - "start": { "line": 4734, "column": 24, "offset": 124938 }, - "end": { "line": 4734, "column": 42, "offset": 124956 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 4734, "column": 42, "offset": 124956 }, - "end": { "line": 4734, "column": 50, "offset": 124964 } - } - }, - { - "type": "text", - "value": " as little-endian. The ", - "position": { - "start": { "line": 4734, "column": 50, "offset": 124964 }, - "end": { "line": 4734, "column": 73, "offset": 124987 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4734, "column": 73, "offset": 124987 }, - "end": { "line": 4734, "column": 80, "offset": 124994 } - } - }, - { - "type": "text", - "value": "\nmust be a valid unsigned 16-bit integer. Behavior is undefined when ", - "position": { - "start": { "line": 4734, "column": 80, "offset": 124994 }, - "end": { "line": 4735, "column": 69, "offset": 125063 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4735, "column": 69, "offset": 125063 }, - "end": { "line": 4735, "column": 76, "offset": 125070 } - } - }, - { - "type": "text", - "value": " is\nanything other than an unsigned 16-bit integer.", - "position": { - "start": { "line": 4735, "column": 76, "offset": 125070 }, - "end": { "line": 4736, "column": 48, "offset": 125121 } - } - } - ], - "position": { - "start": { "line": 4734, "column": 1, "offset": 124915 }, - "end": { "line": 4736, "column": 48, "offset": 125121 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This function is also available under the ", - "position": { - "start": { "line": 4738, "column": 1, "offset": 125123 }, - "end": { "line": 4738, "column": 43, "offset": 125165 } - } - }, - { - "type": "inlineCode", - "value": "writeUint16LE", - "position": { - "start": { "line": 4738, "column": 43, "offset": 125165 }, - "end": { "line": 4738, "column": 58, "offset": 125180 } - } - }, - { - "type": "text", - "value": " alias.", - "position": { - "start": { "line": 4738, "column": 58, "offset": 125180 }, - "end": { "line": 4738, "column": 65, "offset": 125187 } - } - } - ], - "position": { - "start": { "line": 4738, "column": 1, "offset": 125123 }, - "end": { "line": 4738, "column": 65, "offset": 125187 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.allocUnsafe(4);\n\nbuf.writeUInt16LE(0xdead, 0);\nbuf.writeUInt16LE(0xbeef, 2);\n\nconsole.log(buf);\n// Prints: ", - "position": { - "start": { "line": 4740, "column": 1, "offset": 125189 }, - "end": { "line": 4750, "column": 4, "offset": 125385 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.allocUnsafe(4);\n\nbuf.writeUInt16LE(0xdead, 0);\nbuf.writeUInt16LE(0xbeef, 2);\n\nconsole.log(buf);\n// Prints: ", - "position": { - "start": { "line": 4752, "column": 1, "offset": 125387 }, - "end": { "line": 4762, "column": 4, "offset": 125588 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.writeUInt32BE(value[, offset])", - "position": { - "start": { "line": 4764, "column": 5, "offset": 125594 }, - "end": { "line": 4764, "column": 41, "offset": 125630 } - } - } - ], - "position": { - "start": { "line": 4764, "column": 1, "offset": 125590 }, - "end": { "line": 4764, "column": 41, "offset": 125630 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 4766, "column": 1, "offset": 125632 }, - "end": { "line": 4778, "column": 4, "offset": 126027 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4780, "column": 3, "offset": 126031 }, - "end": { "line": 4780, "column": 10, "offset": 126038 } - } - }, - { - "type": "text", - "value": " {integer} Number to be written to ", - "position": { - "start": { "line": 4780, "column": 10, "offset": 126038 }, - "end": { "line": 4780, "column": 45, "offset": 126073 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 4780, "column": 45, "offset": 126073 }, - "end": { "line": 4780, "column": 50, "offset": 126078 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 4780, "column": 50, "offset": 126078 }, - "end": { "line": 4780, "column": 51, "offset": 126079 } - } - } - ], - "position": { - "start": { "line": 4780, "column": 3, "offset": 126031 }, - "end": { "line": 4780, "column": 51, "offset": 126079 } - } - } - ], - "position": { - "start": { "line": 4780, "column": 1, "offset": 126029 }, - "end": { "line": 4780, "column": 51, "offset": 126079 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 4781, "column": 3, "offset": 126082 }, - "end": { "line": 4781, "column": 11, "offset": 126090 } - } - }, - { - "type": "text", - "value": " {integer} Number of bytes to skip before starting to write. Must\nsatisfy ", - "position": { - "start": { "line": 4781, "column": 11, "offset": 126090 }, - "end": { "line": 4782, "column": 11, "offset": 126166 } - } - }, - { - "type": "inlineCode", - "value": "0 <= offset <= buf.length - 4", - "position": { - "start": { "line": 4782, "column": 11, "offset": 126166 }, - "end": { "line": 4782, "column": 42, "offset": 126197 } - } - }, - { - "type": "text", - "value": ". ", - "position": { - "start": { "line": 4782, "column": 42, "offset": 126197 }, - "end": { "line": 4782, "column": 44, "offset": 126199 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { - "line": 4782, - "column": 46, - "offset": 126201 - }, - "end": { "line": 4782, "column": 54, "offset": 126209 } - } - } - ], - "position": { - "start": { "line": 4782, "column": 44, "offset": 126199 }, - "end": { "line": 4782, "column": 56, "offset": 126211 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 4782, "column": 56, "offset": 126211 }, - "end": { "line": 4782, "column": 57, "offset": 126212 } - } - }, - { - "type": "inlineCode", - "value": "0", - "position": { - "start": { "line": 4782, "column": 57, "offset": 126212 }, - "end": { "line": 4782, "column": 60, "offset": 126215 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 4782, "column": 60, "offset": 126215 }, - "end": { "line": 4782, "column": 61, "offset": 126216 } - } - } - ], - "position": { - "start": { "line": 4781, "column": 3, "offset": 126082 }, - "end": { "line": 4782, "column": 61, "offset": 126216 } - } - } - ], - "position": { - "start": { "line": 4781, "column": 1, "offset": 126080 }, - "end": { "line": 4782, "column": 61, "offset": 126216 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {integer} ", - "position": { - "start": { "line": 4783, "column": 3, "offset": 126219 }, - "end": { "line": 4783, "column": 22, "offset": 126238 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 4783, "column": 22, "offset": 126238 }, - "end": { "line": 4783, "column": 30, "offset": 126246 } - } - }, - { - "type": "text", - "value": " plus the number of bytes written.", - "position": { - "start": { "line": 4783, "column": 30, "offset": 126246 }, - "end": { "line": 4783, "column": 64, "offset": 126280 } - } - } - ], - "position": { - "start": { "line": 4783, "column": 3, "offset": 126219 }, - "end": { "line": 4783, "column": 64, "offset": 126280 } - } - } - ], - "position": { - "start": { "line": 4783, "column": 1, "offset": 126217 }, - "end": { "line": 4783, "column": 64, "offset": 126280 } - } - } - ], - "position": { - "start": { "line": 4780, "column": 1, "offset": 126029 }, - "end": { "line": 4783, "column": 64, "offset": 126280 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Writes ", - "position": { - "start": { "line": 4785, "column": 1, "offset": 126282 }, - "end": { "line": 4785, "column": 8, "offset": 126289 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4785, "column": 8, "offset": 126289 }, - "end": { "line": 4785, "column": 15, "offset": 126296 } - } - }, - { - "type": "text", - "value": " to ", - "position": { - "start": { "line": 4785, "column": 15, "offset": 126296 }, - "end": { "line": 4785, "column": 19, "offset": 126300 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 4785, "column": 19, "offset": 126300 }, - "end": { "line": 4785, "column": 24, "offset": 126305 } - } - }, - { - "type": "text", - "value": " at the specified ", - "position": { - "start": { "line": 4785, "column": 24, "offset": 126305 }, - "end": { "line": 4785, "column": 42, "offset": 126323 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 4785, "column": 42, "offset": 126323 }, - "end": { "line": 4785, "column": 50, "offset": 126331 } - } - }, - { - "type": "text", - "value": " as big-endian. The ", - "position": { - "start": { "line": 4785, "column": 50, "offset": 126331 }, - "end": { "line": 4785, "column": 70, "offset": 126351 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4785, "column": 70, "offset": 126351 }, - "end": { "line": 4785, "column": 77, "offset": 126358 } - } - }, - { - "type": "text", - "value": "\nmust be a valid unsigned 32-bit integer. Behavior is undefined when ", - "position": { - "start": { "line": 4785, "column": 77, "offset": 126358 }, - "end": { "line": 4786, "column": 69, "offset": 126427 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4786, "column": 69, "offset": 126427 }, - "end": { "line": 4786, "column": 76, "offset": 126434 } - } - }, - { - "type": "text", - "value": "\nis anything other than an unsigned 32-bit integer.", - "position": { - "start": { "line": 4786, "column": 76, "offset": 126434 }, - "end": { "line": 4787, "column": 51, "offset": 126485 } - } - } - ], - "position": { - "start": { "line": 4785, "column": 1, "offset": 126282 }, - "end": { "line": 4787, "column": 51, "offset": 126485 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This function is also available under the ", - "position": { - "start": { "line": 4789, "column": 1, "offset": 126487 }, - "end": { "line": 4789, "column": 43, "offset": 126529 } - } - }, - { - "type": "inlineCode", - "value": "writeUint32BE", - "position": { - "start": { "line": 4789, "column": 43, "offset": 126529 }, - "end": { "line": 4789, "column": 58, "offset": 126544 } - } - }, - { - "type": "text", - "value": " alias.", - "position": { - "start": { "line": 4789, "column": 58, "offset": 126544 }, - "end": { "line": 4789, "column": 65, "offset": 126551 } - } - } - ], - "position": { - "start": { "line": 4789, "column": 1, "offset": 126487 }, - "end": { "line": 4789, "column": 65, "offset": 126551 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.allocUnsafe(4);\n\nbuf.writeUInt32BE(0xfeedface, 0);\n\nconsole.log(buf);\n// Prints: ", - "position": { - "start": { "line": 4791, "column": 1, "offset": 126553 }, - "end": { "line": 4800, "column": 4, "offset": 126723 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.allocUnsafe(4);\n\nbuf.writeUInt32BE(0xfeedface, 0);\n\nconsole.log(buf);\n// Prints: ", - "position": { - "start": { "line": 4802, "column": 1, "offset": 126725 }, - "end": { "line": 4811, "column": 4, "offset": 126900 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.writeUInt32LE(value[, offset])", - "position": { - "start": { "line": 4813, "column": 5, "offset": 126906 }, - "end": { "line": 4813, "column": 41, "offset": 126942 } - } - } - ], - "position": { - "start": { "line": 4813, "column": 1, "offset": 126902 }, - "end": { "line": 4813, "column": 41, "offset": 126942 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 4815, "column": 1, "offset": 126944 }, - "end": { "line": 4827, "column": 4, "offset": 127339 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4829, "column": 3, "offset": 127343 }, - "end": { "line": 4829, "column": 10, "offset": 127350 } - } - }, - { - "type": "text", - "value": " {integer} Number to be written to ", - "position": { - "start": { "line": 4829, "column": 10, "offset": 127350 }, - "end": { "line": 4829, "column": 45, "offset": 127385 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 4829, "column": 45, "offset": 127385 }, - "end": { "line": 4829, "column": 50, "offset": 127390 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 4829, "column": 50, "offset": 127390 }, - "end": { "line": 4829, "column": 51, "offset": 127391 } - } - } - ], - "position": { - "start": { "line": 4829, "column": 3, "offset": 127343 }, - "end": { "line": 4829, "column": 51, "offset": 127391 } - } - } - ], - "position": { - "start": { "line": 4829, "column": 1, "offset": 127341 }, - "end": { "line": 4829, "column": 51, "offset": 127391 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 4830, "column": 3, "offset": 127394 }, - "end": { "line": 4830, "column": 11, "offset": 127402 } - } - }, - { - "type": "text", - "value": " {integer} Number of bytes to skip before starting to write. Must\nsatisfy ", - "position": { - "start": { "line": 4830, "column": 11, "offset": 127402 }, - "end": { "line": 4831, "column": 11, "offset": 127478 } - } - }, - { - "type": "inlineCode", - "value": "0 <= offset <= buf.length - 4", - "position": { - "start": { "line": 4831, "column": 11, "offset": 127478 }, - "end": { "line": 4831, "column": 42, "offset": 127509 } - } - }, - { - "type": "text", - "value": ". ", - "position": { - "start": { "line": 4831, "column": 42, "offset": 127509 }, - "end": { "line": 4831, "column": 44, "offset": 127511 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { - "line": 4831, - "column": 46, - "offset": 127513 - }, - "end": { "line": 4831, "column": 54, "offset": 127521 } - } - } - ], - "position": { - "start": { "line": 4831, "column": 44, "offset": 127511 }, - "end": { "line": 4831, "column": 56, "offset": 127523 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 4831, "column": 56, "offset": 127523 }, - "end": { "line": 4831, "column": 57, "offset": 127524 } - } - }, - { - "type": "inlineCode", - "value": "0", - "position": { - "start": { "line": 4831, "column": 57, "offset": 127524 }, - "end": { "line": 4831, "column": 60, "offset": 127527 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 4831, "column": 60, "offset": 127527 }, - "end": { "line": 4831, "column": 61, "offset": 127528 } - } - } - ], - "position": { - "start": { "line": 4830, "column": 3, "offset": 127394 }, - "end": { "line": 4831, "column": 61, "offset": 127528 } - } - } - ], - "position": { - "start": { "line": 4830, "column": 1, "offset": 127392 }, - "end": { "line": 4831, "column": 61, "offset": 127528 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {integer} ", - "position": { - "start": { "line": 4832, "column": 3, "offset": 127531 }, - "end": { "line": 4832, "column": 22, "offset": 127550 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 4832, "column": 22, "offset": 127550 }, - "end": { "line": 4832, "column": 30, "offset": 127558 } - } - }, - { - "type": "text", - "value": " plus the number of bytes written.", - "position": { - "start": { "line": 4832, "column": 30, "offset": 127558 }, - "end": { "line": 4832, "column": 64, "offset": 127592 } - } - } - ], - "position": { - "start": { "line": 4832, "column": 3, "offset": 127531 }, - "end": { "line": 4832, "column": 64, "offset": 127592 } - } - } - ], - "position": { - "start": { "line": 4832, "column": 1, "offset": 127529 }, - "end": { "line": 4832, "column": 64, "offset": 127592 } - } - } - ], - "position": { - "start": { "line": 4829, "column": 1, "offset": 127341 }, - "end": { "line": 4832, "column": 64, "offset": 127592 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Writes ", - "position": { - "start": { "line": 4834, "column": 1, "offset": 127594 }, - "end": { "line": 4834, "column": 8, "offset": 127601 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4834, "column": 8, "offset": 127601 }, - "end": { "line": 4834, "column": 15, "offset": 127608 } - } - }, - { - "type": "text", - "value": " to ", - "position": { - "start": { "line": 4834, "column": 15, "offset": 127608 }, - "end": { "line": 4834, "column": 19, "offset": 127612 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 4834, "column": 19, "offset": 127612 }, - "end": { "line": 4834, "column": 24, "offset": 127617 } - } - }, - { - "type": "text", - "value": " at the specified ", - "position": { - "start": { "line": 4834, "column": 24, "offset": 127617 }, - "end": { "line": 4834, "column": 42, "offset": 127635 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 4834, "column": 42, "offset": 127635 }, - "end": { "line": 4834, "column": 50, "offset": 127643 } - } - }, - { - "type": "text", - "value": " as little-endian. The ", - "position": { - "start": { "line": 4834, "column": 50, "offset": 127643 }, - "end": { "line": 4834, "column": 73, "offset": 127666 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4834, "column": 73, "offset": 127666 }, - "end": { "line": 4834, "column": 80, "offset": 127673 } - } - }, - { - "type": "text", - "value": "\nmust be a valid unsigned 32-bit integer. Behavior is undefined when ", - "position": { - "start": { "line": 4834, "column": 80, "offset": 127673 }, - "end": { "line": 4835, "column": 69, "offset": 127742 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4835, "column": 69, "offset": 127742 }, - "end": { "line": 4835, "column": 76, "offset": 127749 } - } - }, - { - "type": "text", - "value": " is\nanything other than an unsigned 32-bit integer.", - "position": { - "start": { "line": 4835, "column": 76, "offset": 127749 }, - "end": { "line": 4836, "column": 48, "offset": 127800 } - } - } - ], - "position": { - "start": { "line": 4834, "column": 1, "offset": 127594 }, - "end": { "line": 4836, "column": 48, "offset": 127800 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This function is also available under the ", - "position": { - "start": { "line": 4838, "column": 1, "offset": 127802 }, - "end": { "line": 4838, "column": 43, "offset": 127844 } - } - }, - { - "type": "inlineCode", - "value": "writeUint32LE", - "position": { - "start": { "line": 4838, "column": 43, "offset": 127844 }, - "end": { "line": 4838, "column": 58, "offset": 127859 } - } - }, - { - "type": "text", - "value": " alias.", - "position": { - "start": { "line": 4838, "column": 58, "offset": 127859 }, - "end": { "line": 4838, "column": 65, "offset": 127866 } - } - } - ], - "position": { - "start": { "line": 4838, "column": 1, "offset": 127802 }, - "end": { "line": 4838, "column": 65, "offset": 127866 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.allocUnsafe(4);\n\nbuf.writeUInt32LE(0xfeedface, 0);\n\nconsole.log(buf);\n// Prints: ", - "position": { - "start": { "line": 4840, "column": 1, "offset": 127868 }, - "end": { "line": 4849, "column": 4, "offset": 128038 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.allocUnsafe(4);\n\nbuf.writeUInt32LE(0xfeedface, 0);\n\nconsole.log(buf);\n// Prints: ", - "position": { - "start": { "line": 4851, "column": 1, "offset": 128040 }, - "end": { "line": 4860, "column": 4, "offset": 128215 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.writeUIntBE(value, offset, byteLength)", - "position": { - "start": { "line": 4862, "column": 5, "offset": 128221 }, - "end": { "line": 4862, "column": 49, "offset": 128265 } - } - } - ], - "position": { - "start": { "line": 4862, "column": 1, "offset": 128217 }, - "end": { "line": 4862, "column": 49, "offset": 128265 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 4864, "column": 1, "offset": 128267 }, - "end": { "line": 4876, "column": 4, "offset": 128677 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4878, "column": 3, "offset": 128681 }, - "end": { "line": 4878, "column": 10, "offset": 128688 } - } - }, - { - "type": "text", - "value": " {integer} Number to be written to ", - "position": { - "start": { "line": 4878, "column": 10, "offset": 128688 }, - "end": { "line": 4878, "column": 45, "offset": 128723 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 4878, "column": 45, "offset": 128723 }, - "end": { "line": 4878, "column": 50, "offset": 128728 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 4878, "column": 50, "offset": 128728 }, - "end": { "line": 4878, "column": 51, "offset": 128729 } - } - } - ], - "position": { - "start": { "line": 4878, "column": 3, "offset": 128681 }, - "end": { "line": 4878, "column": 51, "offset": 128729 } - } - } - ], - "position": { - "start": { "line": 4878, "column": 1, "offset": 128679 }, - "end": { "line": 4878, "column": 51, "offset": 128729 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 4879, "column": 3, "offset": 128732 }, - "end": { "line": 4879, "column": 11, "offset": 128740 } - } - }, - { - "type": "text", - "value": " {integer} Number of bytes to skip before starting to write. Must\nsatisfy ", - "position": { - "start": { "line": 4879, "column": 11, "offset": 128740 }, - "end": { "line": 4880, "column": 11, "offset": 128816 } - } - }, - { - "type": "inlineCode", - "value": "0 <= offset <= buf.length - byteLength", - "position": { - "start": { "line": 4880, "column": 11, "offset": 128816 }, - "end": { "line": 4880, "column": 51, "offset": 128856 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 4880, "column": 51, "offset": 128856 }, - "end": { "line": 4880, "column": 52, "offset": 128857 } - } - } - ], - "position": { - "start": { "line": 4879, "column": 3, "offset": 128732 }, - "end": { "line": 4880, "column": 52, "offset": 128857 } - } - } - ], - "position": { - "start": { "line": 4879, "column": 1, "offset": 128730 }, - "end": { "line": 4880, "column": 52, "offset": 128857 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "byteLength", - "position": { - "start": { "line": 4881, "column": 3, "offset": 128860 }, - "end": { "line": 4881, "column": 15, "offset": 128872 } - } - }, - { - "type": "text", - "value": " {integer} Number of bytes to write. Must satisfy\n", - "position": { - "start": { "line": 4881, "column": 15, "offset": 128872 }, - "end": { "line": 4882, "column": 1, "offset": 128922 } - } - }, - { - "type": "inlineCode", - "value": "0 < byteLength <= 6", - "position": { - "start": { "line": 4882, "column": 3, "offset": 128924 }, - "end": { "line": 4882, "column": 24, "offset": 128945 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 4882, "column": 24, "offset": 128945 }, - "end": { "line": 4882, "column": 25, "offset": 128946 } - } - } - ], - "position": { - "start": { "line": 4881, "column": 3, "offset": 128860 }, - "end": { "line": 4882, "column": 25, "offset": 128946 } - } - } - ], - "position": { - "start": { "line": 4881, "column": 1, "offset": 128858 }, - "end": { "line": 4882, "column": 25, "offset": 128946 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {integer} ", - "position": { - "start": { "line": 4883, "column": 3, "offset": 128949 }, - "end": { "line": 4883, "column": 22, "offset": 128968 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 4883, "column": 22, "offset": 128968 }, - "end": { "line": 4883, "column": 30, "offset": 128976 } - } - }, - { - "type": "text", - "value": " plus the number of bytes written.", - "position": { - "start": { "line": 4883, "column": 30, "offset": 128976 }, - "end": { "line": 4883, "column": 64, "offset": 129010 } - } - } - ], - "position": { - "start": { "line": 4883, "column": 3, "offset": 128949 }, - "end": { "line": 4883, "column": 64, "offset": 129010 } - } - } - ], - "position": { - "start": { "line": 4883, "column": 1, "offset": 128947 }, - "end": { "line": 4883, "column": 64, "offset": 129010 } - } - } - ], - "position": { - "start": { "line": 4878, "column": 1, "offset": 128679 }, - "end": { "line": 4883, "column": 64, "offset": 129010 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Writes ", - "position": { - "start": { "line": 4885, "column": 1, "offset": 129012 }, - "end": { "line": 4885, "column": 8, "offset": 129019 } - } - }, - { - "type": "inlineCode", - "value": "byteLength", - "position": { - "start": { "line": 4885, "column": 8, "offset": 129019 }, - "end": { "line": 4885, "column": 20, "offset": 129031 } - } - }, - { - "type": "text", - "value": " bytes of ", - "position": { - "start": { "line": 4885, "column": 20, "offset": 129031 }, - "end": { "line": 4885, "column": 30, "offset": 129041 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4885, "column": 30, "offset": 129041 }, - "end": { "line": 4885, "column": 37, "offset": 129048 } - } - }, - { - "type": "text", - "value": " to ", - "position": { - "start": { "line": 4885, "column": 37, "offset": 129048 }, - "end": { "line": 4885, "column": 41, "offset": 129052 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 4885, "column": 41, "offset": 129052 }, - "end": { "line": 4885, "column": 46, "offset": 129057 } - } - }, - { - "type": "text", - "value": " at the specified ", - "position": { - "start": { "line": 4885, "column": 46, "offset": 129057 }, - "end": { "line": 4885, "column": 64, "offset": 129075 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 4885, "column": 64, "offset": 129075 }, - "end": { "line": 4885, "column": 72, "offset": 129083 } - } - }, - { - "type": "text", - "value": "\nas big-endian. Supports up to 48 bits of accuracy. Behavior is undefined\nwhen ", - "position": { - "start": { "line": 4885, "column": 72, "offset": 129083 }, - "end": { "line": 4887, "column": 6, "offset": 129162 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4887, "column": 6, "offset": 129162 }, - "end": { "line": 4887, "column": 13, "offset": 129169 } - } - }, - { - "type": "text", - "value": " is anything other than an unsigned integer.", - "position": { - "start": { "line": 4887, "column": 13, "offset": 129169 }, - "end": { "line": 4887, "column": 57, "offset": 129213 } - } - } - ], - "position": { - "start": { "line": 4885, "column": 1, "offset": 129012 }, - "end": { "line": 4887, "column": 57, "offset": 129213 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This function is also available under the ", - "position": { - "start": { "line": 4889, "column": 1, "offset": 129215 }, - "end": { "line": 4889, "column": 43, "offset": 129257 } - } - }, - { - "type": "inlineCode", - "value": "writeUintBE", - "position": { - "start": { "line": 4889, "column": 43, "offset": 129257 }, - "end": { "line": 4889, "column": 56, "offset": 129270 } - } - }, - { - "type": "text", - "value": " alias.", - "position": { - "start": { "line": 4889, "column": 56, "offset": 129270 }, - "end": { "line": 4889, "column": 63, "offset": 129277 } - } - } - ], - "position": { - "start": { "line": 4889, "column": 1, "offset": 129215 }, - "end": { "line": 4889, "column": 63, "offset": 129277 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.allocUnsafe(6);\n\nbuf.writeUIntBE(0x1234567890ab, 0, 6);\n\nconsole.log(buf);\n// Prints: ", - "position": { - "start": { "line": 4891, "column": 1, "offset": 129279 }, - "end": { "line": 4900, "column": 4, "offset": 129460 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.allocUnsafe(6);\n\nbuf.writeUIntBE(0x1234567890ab, 0, 6);\n\nconsole.log(buf);\n// Prints: ", - "position": { - "start": { "line": 4902, "column": 1, "offset": 129462 }, - "end": { "line": 4911, "column": 4, "offset": 129648 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buf.writeUIntLE(value, offset, byteLength)", - "position": { - "start": { "line": 4913, "column": 5, "offset": 129654 }, - "end": { "line": 4913, "column": 49, "offset": 129698 } - } - } - ], - "position": { - "start": { "line": 4913, "column": 1, "offset": 129650 }, - "end": { "line": 4913, "column": 49, "offset": 129698 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 4915, "column": 1, "offset": 129700 }, - "end": { "line": 4927, "column": 4, "offset": 130110 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4929, "column": 3, "offset": 130114 }, - "end": { "line": 4929, "column": 10, "offset": 130121 } - } - }, - { - "type": "text", - "value": " {integer} Number to be written to ", - "position": { - "start": { "line": 4929, "column": 10, "offset": 130121 }, - "end": { "line": 4929, "column": 45, "offset": 130156 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 4929, "column": 45, "offset": 130156 }, - "end": { "line": 4929, "column": 50, "offset": 130161 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 4929, "column": 50, "offset": 130161 }, - "end": { "line": 4929, "column": 51, "offset": 130162 } - } - } - ], - "position": { - "start": { "line": 4929, "column": 3, "offset": 130114 }, - "end": { "line": 4929, "column": 51, "offset": 130162 } - } - } - ], - "position": { - "start": { "line": 4929, "column": 1, "offset": 130112 }, - "end": { "line": 4929, "column": 51, "offset": 130162 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 4930, "column": 3, "offset": 130165 }, - "end": { "line": 4930, "column": 11, "offset": 130173 } - } - }, - { - "type": "text", - "value": " {integer} Number of bytes to skip before starting to write. Must\nsatisfy ", - "position": { - "start": { "line": 4930, "column": 11, "offset": 130173 }, - "end": { "line": 4931, "column": 11, "offset": 130249 } - } - }, - { - "type": "inlineCode", - "value": "0 <= offset <= buf.length - byteLength", - "position": { - "start": { "line": 4931, "column": 11, "offset": 130249 }, - "end": { "line": 4931, "column": 51, "offset": 130289 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 4931, "column": 51, "offset": 130289 }, - "end": { "line": 4931, "column": 52, "offset": 130290 } - } - } - ], - "position": { - "start": { "line": 4930, "column": 3, "offset": 130165 }, - "end": { "line": 4931, "column": 52, "offset": 130290 } - } - } - ], - "position": { - "start": { "line": 4930, "column": 1, "offset": 130163 }, - "end": { "line": 4931, "column": 52, "offset": 130290 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "byteLength", - "position": { - "start": { "line": 4932, "column": 3, "offset": 130293 }, - "end": { "line": 4932, "column": 15, "offset": 130305 } - } - }, - { - "type": "text", - "value": " {integer} Number of bytes to write. Must satisfy\n", - "position": { - "start": { "line": 4932, "column": 15, "offset": 130305 }, - "end": { "line": 4933, "column": 1, "offset": 130355 } - } - }, - { - "type": "inlineCode", - "value": "0 < byteLength <= 6", - "position": { - "start": { "line": 4933, "column": 3, "offset": 130357 }, - "end": { "line": 4933, "column": 24, "offset": 130378 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 4933, "column": 24, "offset": 130378 }, - "end": { "line": 4933, "column": 25, "offset": 130379 } - } - } - ], - "position": { - "start": { "line": 4932, "column": 3, "offset": 130293 }, - "end": { "line": 4933, "column": 25, "offset": 130379 } - } - } - ], - "position": { - "start": { "line": 4932, "column": 1, "offset": 130291 }, - "end": { "line": 4933, "column": 25, "offset": 130379 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {integer} ", - "position": { - "start": { "line": 4934, "column": 3, "offset": 130382 }, - "end": { "line": 4934, "column": 22, "offset": 130401 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 4934, "column": 22, "offset": 130401 }, - "end": { "line": 4934, "column": 30, "offset": 130409 } - } - }, - { - "type": "text", - "value": " plus the number of bytes written.", - "position": { - "start": { "line": 4934, "column": 30, "offset": 130409 }, - "end": { "line": 4934, "column": 64, "offset": 130443 } - } - } - ], - "position": { - "start": { "line": 4934, "column": 3, "offset": 130382 }, - "end": { "line": 4934, "column": 64, "offset": 130443 } - } - } - ], - "position": { - "start": { "line": 4934, "column": 1, "offset": 130380 }, - "end": { "line": 4934, "column": 64, "offset": 130443 } - } - } - ], - "position": { - "start": { "line": 4929, "column": 1, "offset": 130112 }, - "end": { "line": 4934, "column": 64, "offset": 130443 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Writes ", - "position": { - "start": { "line": 4936, "column": 1, "offset": 130445 }, - "end": { "line": 4936, "column": 8, "offset": 130452 } - } - }, - { - "type": "inlineCode", - "value": "byteLength", - "position": { - "start": { "line": 4936, "column": 8, "offset": 130452 }, - "end": { "line": 4936, "column": 20, "offset": 130464 } - } - }, - { - "type": "text", - "value": " bytes of ", - "position": { - "start": { "line": 4936, "column": 20, "offset": 130464 }, - "end": { "line": 4936, "column": 30, "offset": 130474 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4936, "column": 30, "offset": 130474 }, - "end": { "line": 4936, "column": 37, "offset": 130481 } - } - }, - { - "type": "text", - "value": " to ", - "position": { - "start": { "line": 4936, "column": 37, "offset": 130481 }, - "end": { "line": 4936, "column": 41, "offset": 130485 } - } - }, - { - "type": "inlineCode", - "value": "buf", - "position": { - "start": { "line": 4936, "column": 41, "offset": 130485 }, - "end": { "line": 4936, "column": 46, "offset": 130490 } - } - }, - { - "type": "text", - "value": " at the specified ", - "position": { - "start": { "line": 4936, "column": 46, "offset": 130490 }, - "end": { "line": 4936, "column": 64, "offset": 130508 } - } - }, - { - "type": "inlineCode", - "value": "offset", - "position": { - "start": { "line": 4936, "column": 64, "offset": 130508 }, - "end": { "line": 4936, "column": 72, "offset": 130516 } - } - }, - { - "type": "text", - "value": "\nas little-endian. Supports up to 48 bits of accuracy. Behavior is undefined\nwhen ", - "position": { - "start": { "line": 4936, "column": 72, "offset": 130516 }, - "end": { "line": 4938, "column": 6, "offset": 130598 } - } - }, - { - "type": "inlineCode", - "value": "value", - "position": { - "start": { "line": 4938, "column": 6, "offset": 130598 }, - "end": { "line": 4938, "column": 13, "offset": 130605 } - } - }, - { - "type": "text", - "value": " is anything other than an unsigned integer.", - "position": { - "start": { "line": 4938, "column": 13, "offset": 130605 }, - "end": { "line": 4938, "column": 57, "offset": 130649 } - } - } - ], - "position": { - "start": { "line": 4936, "column": 1, "offset": 130445 }, - "end": { "line": 4938, "column": 57, "offset": 130649 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This function is also available under the ", - "position": { - "start": { "line": 4940, "column": 1, "offset": 130651 }, - "end": { "line": 4940, "column": 43, "offset": 130693 } - } - }, - { - "type": "inlineCode", - "value": "writeUintLE", - "position": { - "start": { "line": 4940, "column": 43, "offset": 130693 }, - "end": { "line": 4940, "column": 56, "offset": 130706 } - } - }, - { - "type": "text", - "value": " alias.", - "position": { - "start": { "line": 4940, "column": 56, "offset": 130706 }, - "end": { "line": 4940, "column": 63, "offset": 130713 } - } - } - ], - "position": { - "start": { "line": 4940, "column": 1, "offset": 130651 }, - "end": { "line": 4940, "column": 63, "offset": 130713 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer } from 'node:buffer';\n\nconst buf = Buffer.allocUnsafe(6);\n\nbuf.writeUIntLE(0x1234567890ab, 0, 6);\n\nconsole.log(buf);\n// Prints: ", - "position": { - "start": { "line": 4942, "column": 1, "offset": 130715 }, - "end": { "line": 4951, "column": 4, "offset": 130896 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer } = require('node:buffer');\n\nconst buf = Buffer.allocUnsafe(6);\n\nbuf.writeUIntLE(0x1234567890ab, 0, 6);\n\nconsole.log(buf);\n// Prints: ", - "position": { - "start": { "line": 4953, "column": 1, "offset": 130898 }, - "end": { "line": 4962, "column": 4, "offset": 131084 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "new Buffer(array)", - "position": { - "start": { "line": 4964, "column": 5, "offset": 131090 }, - "end": { "line": 4964, "column": 24, "offset": 131109 } - } - } - ], - "position": { - "start": { "line": 4964, "column": 1, "offset": 131086 }, - "end": { "line": 4964, "column": 24, "offset": 131109 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 4966, "column": 1, "offset": 131111 }, - "end": { "line": 4979, "column": 4, "offset": 131673 } - } - }, - { - "type": "blockquote", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Stability: 0 - Deprecated: Use ", - "position": { - "start": { "line": 4981, "column": 3, "offset": 131677 }, - "end": { "line": 4981, "column": 34, "offset": 131708 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "Buffer.from(array)", - "position": { - "start": { "line": 4981, "column": 35, "offset": 131709 }, - "end": { "line": 4981, "column": 55, "offset": 131729 } - } - } - ], - "position": { - "start": { "line": 4981, "column": 34, "offset": 131708 }, - "end": { "line": 4981, "column": 58, "offset": 131732 } - }, - "label": "`Buffer.from(array)`", - "identifier": "`buffer.from(array)`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": " instead.", - "position": { - "start": { "line": 4981, "column": 58, "offset": 131732 }, - "end": { "line": 4981, "column": 67, "offset": 131741 } - } - } - ], - "position": { - "start": { "line": 4981, "column": 3, "offset": 131677 }, - "end": { "line": 4981, "column": 67, "offset": 131741 } - } - } - ], - "position": { - "start": { "line": 4981, "column": 1, "offset": 131675 }, - "end": { "line": 4981, "column": 67, "offset": 131741 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "array", - "position": { - "start": { "line": 4983, "column": 3, "offset": 131745 }, - "end": { "line": 4983, "column": 10, "offset": 131752 } - } - }, - { - "type": "text", - "value": " {integer[]} An array of bytes to copy from.", - "position": { - "start": { "line": 4983, "column": 10, "offset": 131752 }, - "end": { "line": 4983, "column": 55, "offset": 131797 } - } - } - ], - "position": { - "start": { "line": 4983, "column": 3, "offset": 131745 }, - "end": { "line": 4983, "column": 55, "offset": 131797 } - } - } - ], - "position": { - "start": { "line": 4983, "column": 1, "offset": 131743 }, - "end": { "line": 4983, "column": 55, "offset": 131797 } - } - } - ], - "position": { - "start": { "line": 4983, "column": 1, "offset": 131743 }, - "end": { "line": 4983, "column": 55, "offset": 131797 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "See ", - "position": { - "start": { "line": 4985, "column": 1, "offset": 131799 }, - "end": { "line": 4985, "column": 5, "offset": 131803 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "Buffer.from(array)", - "position": { - "start": { "line": 4985, "column": 6, "offset": 131804 }, - "end": { "line": 4985, "column": 26, "offset": 131824 } - } - } - ], - "position": { - "start": { "line": 4985, "column": 5, "offset": 131803 }, - "end": { "line": 4985, "column": 29, "offset": 131827 } - }, - "label": "`Buffer.from(array)`", - "identifier": "`buffer.from(array)`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 4985, "column": 29, "offset": 131827 }, - "end": { "line": 4985, "column": 30, "offset": 131828 } - } - } - ], - "position": { - "start": { "line": 4985, "column": 1, "offset": 131799 }, - "end": { "line": 4985, "column": 30, "offset": 131828 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "new Buffer(arrayBuffer[, byteOffset[, length]])", - "position": { - "start": { "line": 4987, "column": 5, "offset": 131834 }, - "end": { "line": 4987, "column": 54, "offset": 131883 } - } - } - ], - "position": { - "start": { "line": 4987, "column": 1, "offset": 131830 }, - "end": { "line": 4987, "column": 54, "offset": 131883 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 4989, "column": 1, "offset": 131885 }, - "end": { "line": 5006, "column": 4, "offset": 132611 } - } - }, - { - "type": "blockquote", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Stability: 0 - Deprecated: Use\n", - "position": { - "start": { "line": 5008, "column": 3, "offset": 132615 }, - "end": { "line": 5009, "column": 1, "offset": 132646 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "Buffer.from(arrayBuffer[, byteOffset[, length]])", - "position": { - "start": { "line": 5009, "column": 4, "offset": 132649 }, - "end": { "line": 5009, "column": 54, "offset": 132699 } - } - } - ], - "position": { - "start": { "line": 5009, "column": 3, "offset": 132648 }, - "end": { "line": 5009, "column": 80, "offset": 132725 } - }, - "label": "`Buffer.from(arrayBuf)`", - "identifier": "`buffer.from(arraybuf)`", - "referenceType": "full" - }, - { - "type": "text", - "value": "\ninstead.", - "position": { - "start": { "line": 5009, "column": 80, "offset": 132725 }, - "end": { "line": 5010, "column": 11, "offset": 132736 } - } - } - ], - "position": { - "start": { "line": 5008, "column": 3, "offset": 132615 }, - "end": { "line": 5010, "column": 11, "offset": 132736 } - } - } - ], - "position": { - "start": { "line": 5008, "column": 1, "offset": 132613 }, - "end": { "line": 5010, "column": 11, "offset": 132736 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "arrayBuffer", - "position": { - "start": { "line": 5012, "column": 3, "offset": 132740 }, - "end": { "line": 5012, "column": 16, "offset": 132753 } - } - }, - { - "type": "text", - "value": " {ArrayBuffer|SharedArrayBuffer} An {ArrayBuffer},\n{SharedArrayBuffer} or the ", - "position": { - "start": { "line": 5012, "column": 16, "offset": 132753 }, - "end": { "line": 5013, "column": 30, "offset": 132833 } - } - }, - { - "type": "inlineCode", - "value": ".buffer", - "position": { - "start": { "line": 5013, "column": 30, "offset": 132833 }, - "end": { "line": 5013, "column": 39, "offset": 132842 } - } - }, - { - "type": "text", - "value": " property of a {TypedArray}.", - "position": { - "start": { "line": 5013, "column": 39, "offset": 132842 }, - "end": { "line": 5013, "column": 67, "offset": 132870 } - } - } - ], - "position": { - "start": { "line": 5012, "column": 3, "offset": 132740 }, - "end": { "line": 5013, "column": 67, "offset": 132870 } - } - } - ], - "position": { - "start": { "line": 5012, "column": 1, "offset": 132738 }, - "end": { "line": 5013, "column": 67, "offset": 132870 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "byteOffset", - "position": { - "start": { "line": 5014, "column": 3, "offset": 132873 }, - "end": { "line": 5014, "column": 15, "offset": 132885 } - } - }, - { - "type": "text", - "value": " {integer} Index of first byte to expose. ", - "position": { - "start": { "line": 5014, "column": 15, "offset": 132885 }, - "end": { "line": 5014, "column": 57, "offset": 132927 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { - "line": 5014, - "column": 59, - "offset": 132929 - }, - "end": { "line": 5014, "column": 67, "offset": 132937 } - } - } - ], - "position": { - "start": { "line": 5014, "column": 57, "offset": 132927 }, - "end": { "line": 5014, "column": 69, "offset": 132939 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 5014, "column": 69, "offset": 132939 }, - "end": { "line": 5014, "column": 70, "offset": 132940 } - } - }, - { - "type": "inlineCode", - "value": "0", - "position": { - "start": { "line": 5014, "column": 70, "offset": 132940 }, - "end": { "line": 5014, "column": 73, "offset": 132943 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 5014, "column": 73, "offset": 132943 }, - "end": { "line": 5014, "column": 74, "offset": 132944 } - } - } - ], - "position": { - "start": { "line": 5014, "column": 3, "offset": 132873 }, - "end": { "line": 5014, "column": 74, "offset": 132944 } - } - } - ], - "position": { - "start": { "line": 5014, "column": 1, "offset": 132871 }, - "end": { "line": 5014, "column": 74, "offset": 132944 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "length", - "position": { - "start": { "line": 5015, "column": 3, "offset": 132947 }, - "end": { "line": 5015, "column": 11, "offset": 132955 } - } - }, - { - "type": "text", - "value": " {integer} Number of bytes to expose.\n", - "position": { - "start": { "line": 5015, "column": 11, "offset": 132955 }, - "end": { "line": 5016, "column": 1, "offset": 132993 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { - "line": 5016, - "column": 5, - "offset": 132997 - }, - "end": { "line": 5016, "column": 13, "offset": 133005 } - } - } - ], - "position": { - "start": { "line": 5016, "column": 3, "offset": 132995 }, - "end": { "line": 5016, "column": 15, "offset": 133007 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 5016, "column": 15, "offset": 133007 }, - "end": { "line": 5016, "column": 16, "offset": 133008 } - } - }, - { - "type": "inlineCode", - "value": "arrayBuffer.byteLength - byteOffset", - "position": { - "start": { "line": 5016, "column": 16, "offset": 133008 }, - "end": { "line": 5016, "column": 53, "offset": 133045 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 5016, "column": 53, "offset": 133045 }, - "end": { "line": 5016, "column": 54, "offset": 133046 } - } - } - ], - "position": { - "start": { "line": 5015, "column": 3, "offset": 132947 }, - "end": { "line": 5016, "column": 54, "offset": 133046 } - } - } - ], - "position": { - "start": { "line": 5015, "column": 1, "offset": 132945 }, - "end": { "line": 5016, "column": 54, "offset": 133046 } - } - } - ], - "position": { - "start": { "line": 5012, "column": 1, "offset": 132738 }, - "end": { "line": 5016, "column": 54, "offset": 133046 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "See\n", - "position": { - "start": { "line": 5018, "column": 1, "offset": 133048 }, - "end": { "line": 5019, "column": 1, "offset": 133052 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "Buffer.from(arrayBuffer[, byteOffset[, length]])", - "position": { - "start": { "line": 5019, "column": 2, "offset": 133053 }, - "end": { "line": 5019, "column": 52, "offset": 133103 } - } - } - ], - "position": { - "start": { "line": 5019, "column": 1, "offset": 133052 }, - "end": { "line": 5019, "column": 78, "offset": 133129 } - }, - "label": "`Buffer.from(arrayBuf)`", - "identifier": "`buffer.from(arraybuf)`", - "referenceType": "full" - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 5019, "column": 78, "offset": 133129 }, - "end": { "line": 5019, "column": 79, "offset": 133130 } - } - } - ], - "position": { - "start": { "line": 5018, "column": 1, "offset": 133048 }, - "end": { "line": 5019, "column": 79, "offset": 133130 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "new Buffer(buffer)", - "position": { - "start": { "line": 5021, "column": 5, "offset": 133136 }, - "end": { "line": 5021, "column": 25, "offset": 133156 } - } - } - ], - "position": { - "start": { "line": 5021, "column": 1, "offset": 133132 }, - "end": { "line": 5021, "column": 25, "offset": 133156 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 5023, "column": 1, "offset": 133158 }, - "end": { "line": 5036, "column": 4, "offset": 133720 } - } - }, - { - "type": "blockquote", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Stability: 0 - Deprecated: Use ", - "position": { - "start": { "line": 5038, "column": 3, "offset": 133724 }, - "end": { "line": 5038, "column": 34, "offset": 133755 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "Buffer.from(buffer)", - "position": { - "start": { "line": 5038, "column": 35, "offset": 133756 }, - "end": { "line": 5038, "column": 56, "offset": 133777 } - } - } - ], - "position": { - "start": { "line": 5038, "column": 34, "offset": 133755 }, - "end": { "line": 5038, "column": 59, "offset": 133780 } - }, - "label": "`Buffer.from(buffer)`", - "identifier": "`buffer.from(buffer)`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": " instead.", - "position": { - "start": { "line": 5038, "column": 59, "offset": 133780 }, - "end": { "line": 5038, "column": 68, "offset": 133789 } - } - } - ], - "position": { - "start": { "line": 5038, "column": 3, "offset": 133724 }, - "end": { "line": 5038, "column": 68, "offset": 133789 } - } - } - ], - "position": { - "start": { "line": 5038, "column": 1, "offset": 133722 }, - "end": { "line": 5038, "column": 68, "offset": 133789 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "buffer", - "position": { - "start": { "line": 5040, "column": 3, "offset": 133793 }, - "end": { "line": 5040, "column": 11, "offset": 133801 } - } - }, - { - "type": "text", - "value": " {Buffer|Uint8Array} An existing ", - "position": { - "start": { "line": 5040, "column": 11, "offset": 133801 }, - "end": { "line": 5040, "column": 44, "offset": 133834 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 5040, "column": 44, "offset": 133834 }, - "end": { "line": 5040, "column": 52, "offset": 133842 } - } - }, - { - "type": "text", - "value": " or {Uint8Array} from\nwhich to copy data.", - "position": { - "start": { "line": 5040, "column": 52, "offset": 133842 }, - "end": { "line": 5041, "column": 22, "offset": 133885 } - } - } - ], - "position": { - "start": { "line": 5040, "column": 3, "offset": 133793 }, - "end": { "line": 5041, "column": 22, "offset": 133885 } - } - } - ], - "position": { - "start": { "line": 5040, "column": 1, "offset": 133791 }, - "end": { "line": 5041, "column": 22, "offset": 133885 } - } - } - ], - "position": { - "start": { "line": 5040, "column": 1, "offset": 133791 }, - "end": { "line": 5041, "column": 22, "offset": 133885 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "See ", - "position": { - "start": { "line": 5043, "column": 1, "offset": 133887 }, - "end": { "line": 5043, "column": 5, "offset": 133891 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "Buffer.from(buffer)", - "position": { - "start": { "line": 5043, "column": 6, "offset": 133892 }, - "end": { "line": 5043, "column": 27, "offset": 133913 } - } - } - ], - "position": { - "start": { "line": 5043, "column": 5, "offset": 133891 }, - "end": { "line": 5043, "column": 30, "offset": 133916 } - }, - "label": "`Buffer.from(buffer)`", - "identifier": "`buffer.from(buffer)`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 5043, "column": 30, "offset": 133916 }, - "end": { "line": 5043, "column": 31, "offset": 133917 } - } - } - ], - "position": { - "start": { "line": 5043, "column": 1, "offset": 133887 }, - "end": { "line": 5043, "column": 31, "offset": 133917 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "new Buffer(size)", - "position": { - "start": { "line": 5045, "column": 5, "offset": 133923 }, - "end": { "line": 5045, "column": 23, "offset": 133941 } - } - } - ], - "position": { - "start": { "line": 5045, "column": 1, "offset": 133919 }, - "end": { "line": 5045, "column": 23, "offset": 133941 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 5047, "column": 1, "offset": 133943 }, - "end": { "line": 5064, "column": 4, "offset": 134679 } - } - }, - { - "type": "blockquote", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Stability: 0 - Deprecated: Use ", - "position": { - "start": { "line": 5066, "column": 3, "offset": 134683 }, - "end": { "line": 5066, "column": 34, "offset": 134714 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "Buffer.alloc()", - "position": { - "start": { "line": 5066, "column": 35, "offset": 134715 }, - "end": { "line": 5066, "column": 51, "offset": 134731 } - } - } - ], - "position": { - "start": { "line": 5066, "column": 34, "offset": 134714 }, - "end": { "line": 5066, "column": 54, "offset": 134734 } - }, - "label": "`Buffer.alloc()`", - "identifier": "`buffer.alloc()`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": " instead (also see\n", - "position": { - "start": { "line": 5066, "column": 54, "offset": 134734 }, - "end": { "line": 5067, "column": 1, "offset": 134753 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "Buffer.allocUnsafe()", - "position": { - "start": { "line": 5067, "column": 4, "offset": 134756 }, - "end": { "line": 5067, "column": 26, "offset": 134778 } - } - } - ], - "position": { - "start": { "line": 5067, "column": 3, "offset": 134755 }, - "end": { "line": 5067, "column": 29, "offset": 134781 } - }, - "label": "`Buffer.allocUnsafe()`", - "identifier": "`buffer.allocunsafe()`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": ").", - "position": { - "start": { "line": 5067, "column": 29, "offset": 134781 }, - "end": { "line": 5067, "column": 31, "offset": 134783 } - } - } - ], - "position": { - "start": { "line": 5066, "column": 3, "offset": 134683 }, - "end": { "line": 5067, "column": 31, "offset": 134783 } - } - } - ], - "position": { - "start": { "line": 5066, "column": 1, "offset": 134681 }, - "end": { "line": 5067, "column": 31, "offset": 134783 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "size", - "position": { - "start": { "line": 5069, "column": 3, "offset": 134787 }, - "end": { "line": 5069, "column": 9, "offset": 134793 } - } - }, - { - "type": "text", - "value": " {integer} The desired length of the new ", - "position": { - "start": { "line": 5069, "column": 9, "offset": 134793 }, - "end": { "line": 5069, "column": 50, "offset": 134834 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 5069, "column": 50, "offset": 134834 }, - "end": { "line": 5069, "column": 58, "offset": 134842 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 5069, "column": 58, "offset": 134842 }, - "end": { "line": 5069, "column": 59, "offset": 134843 } - } - } - ], - "position": { - "start": { "line": 5069, "column": 3, "offset": 134787 }, - "end": { "line": 5069, "column": 59, "offset": 134843 } - } - } - ], - "position": { - "start": { "line": 5069, "column": 1, "offset": 134785 }, - "end": { "line": 5069, "column": 59, "offset": 134843 } - } - } - ], - "position": { - "start": { "line": 5069, "column": 1, "offset": 134785 }, - "end": { "line": 5069, "column": 59, "offset": 134843 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "See ", - "position": { - "start": { "line": 5071, "column": 1, "offset": 134845 }, - "end": { "line": 5071, "column": 5, "offset": 134849 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "Buffer.alloc()", - "position": { - "start": { "line": 5071, "column": 6, "offset": 134850 }, - "end": { "line": 5071, "column": 22, "offset": 134866 } - } - } - ], - "position": { - "start": { "line": 5071, "column": 5, "offset": 134849 }, - "end": { "line": 5071, "column": 25, "offset": 134869 } - }, - "label": "`Buffer.alloc()`", - "identifier": "`buffer.alloc()`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": " and ", - "position": { - "start": { "line": 5071, "column": 25, "offset": 134869 }, - "end": { "line": 5071, "column": 30, "offset": 134874 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "Buffer.allocUnsafe()", - "position": { - "start": { "line": 5071, "column": 31, "offset": 134875 }, - "end": { "line": 5071, "column": 53, "offset": 134897 } - } - } - ], - "position": { - "start": { "line": 5071, "column": 30, "offset": 134874 }, - "end": { "line": 5071, "column": 56, "offset": 134900 } - }, - "label": "`Buffer.allocUnsafe()`", - "identifier": "`buffer.allocunsafe()`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": ". This variant of the\nconstructor is equivalent to ", - "position": { - "start": { "line": 5071, "column": 56, "offset": 134900 }, - "end": { "line": 5072, "column": 30, "offset": 134951 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "Buffer.alloc()", - "position": { - "start": { "line": 5072, "column": 31, "offset": 134952 }, - "end": { "line": 5072, "column": 47, "offset": 134968 } - } - } - ], - "position": { - "start": { "line": 5072, "column": 30, "offset": 134951 }, - "end": { "line": 5072, "column": 50, "offset": 134971 } - }, - "label": "`Buffer.alloc()`", - "identifier": "`buffer.alloc()`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 5072, "column": 50, "offset": 134971 }, - "end": { "line": 5072, "column": 51, "offset": 134972 } - } - } - ], - "position": { - "start": { "line": 5071, "column": 1, "offset": 134845 }, - "end": { "line": 5072, "column": 51, "offset": 134972 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "new Buffer(string[, encoding])", - "position": { - "start": { "line": 5074, "column": 5, "offset": 134978 }, - "end": { "line": 5074, "column": 37, "offset": 135010 } - } - } - ], - "position": { - "start": { "line": 5074, "column": 1, "offset": 134974 }, - "end": { "line": 5074, "column": 37, "offset": 135010 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 5076, "column": 1, "offset": 135012 }, - "end": { "line": 5089, "column": 4, "offset": 135574 } - } - }, - { - "type": "blockquote", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Stability: 0 - Deprecated:\nUse ", - "position": { - "start": { "line": 5091, "column": 3, "offset": 135578 }, - "end": { "line": 5092, "column": 7, "offset": 135611 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "Buffer.from(string[, encoding])", - "position": { - "start": { "line": 5092, "column": 8, "offset": 135612 }, - "end": { "line": 5092, "column": 41, "offset": 135645 } - } - } - ], - "position": { - "start": { "line": 5092, "column": 7, "offset": 135611 }, - "end": { "line": 5092, "column": 65, "offset": 135669 } - }, - "label": "`Buffer.from(string)`", - "identifier": "`buffer.from(string)`", - "referenceType": "full" - }, - { - "type": "text", - "value": " instead.", - "position": { - "start": { "line": 5092, "column": 65, "offset": 135669 }, - "end": { "line": 5092, "column": 74, "offset": 135678 } - } - } - ], - "position": { - "start": { "line": 5091, "column": 3, "offset": 135578 }, - "end": { "line": 5092, "column": 74, "offset": 135678 } - } - } - ], - "position": { - "start": { "line": 5091, "column": 1, "offset": 135576 }, - "end": { "line": 5092, "column": 74, "offset": 135678 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "string", - "position": { - "start": { "line": 5094, "column": 3, "offset": 135682 }, - "end": { "line": 5094, "column": 11, "offset": 135690 } - } - }, - { - "type": "text", - "value": " {string} String to encode.", - "position": { - "start": { "line": 5094, "column": 11, "offset": 135690 }, - "end": { "line": 5094, "column": 38, "offset": 135717 } - } - } - ], - "position": { - "start": { "line": 5094, "column": 3, "offset": 135682 }, - "end": { "line": 5094, "column": 38, "offset": 135717 } - } - } - ], - "position": { - "start": { "line": 5094, "column": 1, "offset": 135680 }, - "end": { "line": 5094, "column": 38, "offset": 135717 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "encoding", - "position": { - "start": { "line": 5095, "column": 3, "offset": 135720 }, - "end": { "line": 5095, "column": 13, "offset": 135730 } - } - }, - { - "type": "text", - "value": " {string} The encoding of ", - "position": { - "start": { "line": 5095, "column": 13, "offset": 135730 }, - "end": { "line": 5095, "column": 39, "offset": 135756 } - } - }, - { - "type": "inlineCode", - "value": "string", - "position": { - "start": { "line": 5095, "column": 39, "offset": 135756 }, - "end": { "line": 5095, "column": 47, "offset": 135764 } - } - }, - { - "type": "text", - "value": ". ", - "position": { - "start": { "line": 5095, "column": 47, "offset": 135764 }, - "end": { "line": 5095, "column": 49, "offset": 135766 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { - "line": 5095, - "column": 51, - "offset": 135768 - }, - "end": { "line": 5095, "column": 59, "offset": 135776 } - } - } - ], - "position": { - "start": { "line": 5095, "column": 49, "offset": 135766 }, - "end": { "line": 5095, "column": 61, "offset": 135778 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 5095, "column": 61, "offset": 135778 }, - "end": { "line": 5095, "column": 62, "offset": 135779 } - } - }, - { - "type": "inlineCode", - "value": "'utf8'", - "position": { - "start": { "line": 5095, "column": 62, "offset": 135779 }, - "end": { "line": 5095, "column": 70, "offset": 135787 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 5095, "column": 70, "offset": 135787 }, - "end": { "line": 5095, "column": 71, "offset": 135788 } - } - } - ], - "position": { - "start": { "line": 5095, "column": 3, "offset": 135720 }, - "end": { "line": 5095, "column": 71, "offset": 135788 } - } - } - ], - "position": { - "start": { "line": 5095, "column": 1, "offset": 135718 }, - "end": { "line": 5095, "column": 71, "offset": 135788 } - } - } - ], - "position": { - "start": { "line": 5094, "column": 1, "offset": 135680 }, - "end": { "line": 5095, "column": 71, "offset": 135788 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "See ", - "position": { - "start": { "line": 5097, "column": 1, "offset": 135790 }, - "end": { "line": 5097, "column": 5, "offset": 135794 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "Buffer.from(string[, encoding])", - "position": { - "start": { "line": 5097, "column": 6, "offset": 135795 }, - "end": { "line": 5097, "column": 39, "offset": 135828 } - } - } - ], - "position": { - "start": { "line": 5097, "column": 5, "offset": 135794 }, - "end": { "line": 5097, "column": 63, "offset": 135852 } - }, - "label": "`Buffer.from(string)`", - "identifier": "`buffer.from(string)`", - "referenceType": "full" - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 5097, "column": 63, "offset": 135852 }, - "end": { "line": 5097, "column": 64, "offset": 135853 } - } - } - ], - "position": { - "start": { "line": 5097, "column": 1, "offset": 135790 }, - "end": { "line": 5097, "column": 64, "offset": 135853 } - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "Class: ", - "position": { - "start": { "line": 5099, "column": 4, "offset": 135858 }, - "end": { "line": 5099, "column": 11, "offset": 135865 } - } - }, - { - "type": "inlineCode", - "value": "File", - "position": { - "start": { "line": 5099, "column": 11, "offset": 135865 }, - "end": { "line": 5099, "column": 17, "offset": 135871 } - } - } - ], - "position": { - "start": { "line": 5099, "column": 1, "offset": 135855 }, - "end": { "line": 5099, "column": 17, "offset": 135871 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 5101, "column": 1, "offset": 135873 }, - "end": { "line": 5112, "column": 4, "offset": 136167 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Extends: {Blob}", - "position": { - "start": { "line": 5114, "column": 3, "offset": 136171 }, - "end": { "line": 5114, "column": 18, "offset": 136186 } - } - } - ], - "position": { - "start": { "line": 5114, "column": 3, "offset": 136171 }, - "end": { "line": 5114, "column": 18, "offset": 136186 } - } - } - ], - "position": { - "start": { "line": 5114, "column": 1, "offset": 136169 }, - "end": { "line": 5114, "column": 18, "offset": 136186 } - } - } - ], - "position": { - "start": { "line": 5114, "column": 1, "offset": 136169 }, - "end": { "line": 5114, "column": 18, "offset": 136186 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A {File} provides information about files.", - "position": { - "start": { "line": 5116, "column": 1, "offset": 136188 }, - "end": { "line": 5116, "column": 43, "offset": 136230 } - } - } - ], - "position": { - "start": { "line": 5116, "column": 1, "offset": 136188 }, - "end": { "line": 5116, "column": 43, "offset": 136230 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "new buffer.File(sources, fileName[, options])", - "position": { - "start": { "line": 5118, "column": 5, "offset": 136236 }, - "end": { "line": 5118, "column": 52, "offset": 136283 } - } - } - ], - "position": { - "start": { "line": 5118, "column": 1, "offset": 136232 }, - "end": { "line": 5118, "column": 52, "offset": 136283 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 5120, "column": 1, "offset": 136285 }, - "end": { "line": 5124, "column": 4, "offset": 136330 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "sources", - "position": { - "start": { "line": 5126, "column": 3, "offset": 136334 }, - "end": { "line": 5126, "column": 12, "offset": 136343 } - } - }, - { - "type": "text", - "value": " {string[]|ArrayBuffer[]|TypedArray[]|DataView[]|Blob[]|File[]}\nAn array of string, {ArrayBuffer}, {TypedArray}, {DataView}, {File}, or {Blob}\nobjects, or any mix of such objects, that will be stored within the ", - "position": { - "start": { "line": 5126, "column": 12, "offset": 136343 }, - "end": { "line": 5128, "column": 71, "offset": 136564 } - } - }, - { - "type": "inlineCode", - "value": "File", - "position": { - "start": { "line": 5128, "column": 71, "offset": 136564 }, - "end": { "line": 5128, "column": 77, "offset": 136570 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 5128, "column": 77, "offset": 136570 }, - "end": { "line": 5128, "column": 78, "offset": 136571 } - } - } - ], - "position": { - "start": { "line": 5126, "column": 3, "offset": 136334 }, - "end": { "line": 5128, "column": 78, "offset": 136571 } - } - } - ], - "position": { - "start": { "line": 5126, "column": 1, "offset": 136332 }, - "end": { "line": 5128, "column": 78, "offset": 136571 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "fileName", - "position": { - "start": { "line": 5129, "column": 3, "offset": 136574 }, - "end": { "line": 5129, "column": 13, "offset": 136584 } - } - }, - { - "type": "text", - "value": " {string} The name of the file.", - "position": { - "start": { "line": 5129, "column": 13, "offset": 136584 }, - "end": { "line": 5129, "column": 44, "offset": 136615 } - } - } - ], - "position": { - "start": { "line": 5129, "column": 3, "offset": 136574 }, - "end": { "line": 5129, "column": 44, "offset": 136615 } - } - } - ], - "position": { - "start": { "line": 5129, "column": 1, "offset": 136572 }, - "end": { "line": 5129, "column": 44, "offset": 136615 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "options", - "position": { - "start": { "line": 5130, "column": 3, "offset": 136618 }, - "end": { "line": 5130, "column": 12, "offset": 136627 } - } - }, - { - "type": "text", - "value": " {Object}", - "position": { - "start": { "line": 5130, "column": 12, "offset": 136627 }, - "end": { "line": 5130, "column": 21, "offset": 136636 } - } - } - ], - "position": { - "start": { "line": 5130, "column": 3, "offset": 136618 }, - "end": { "line": 5130, "column": 21, "offset": 136636 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "endings", - "position": { - "start": { - "line": 5131, - "column": 5, - "offset": 136641 - }, - "end": { - "line": 5131, - "column": 14, - "offset": 136650 - } - } - }, - { - "type": "text", - "value": " {string} One of either ", - "position": { - "start": { - "line": 5131, - "column": 14, - "offset": 136650 - }, - "end": { - "line": 5131, - "column": 38, - "offset": 136674 - } - } - }, - { - "type": "inlineCode", - "value": "'transparent'", - "position": { - "start": { - "line": 5131, - "column": 38, - "offset": 136674 - }, - "end": { - "line": 5131, - "column": 53, - "offset": 136689 - } - } - }, - { - "type": "text", - "value": " or ", - "position": { - "start": { - "line": 5131, - "column": 53, - "offset": 136689 - }, - "end": { - "line": 5131, - "column": 57, - "offset": 136693 - } - } - }, - { - "type": "inlineCode", - "value": "'native'", - "position": { - "start": { - "line": 5131, - "column": 57, - "offset": 136693 - }, - "end": { - "line": 5131, - "column": 67, - "offset": 136703 - } - } - }, - { - "type": "text", - "value": ". When set\nto ", - "position": { - "start": { - "line": 5131, - "column": 67, - "offset": 136703 - }, - "end": { - "line": 5132, - "column": 8, - "offset": 136721 - } - } - }, - { - "type": "inlineCode", - "value": "'native'", - "position": { - "start": { - "line": 5132, - "column": 8, - "offset": 136721 - }, - "end": { - "line": 5132, - "column": 18, - "offset": 136731 - } - } - }, - { - "type": "text", - "value": ", line endings in string source parts will be converted to\nthe platform native line-ending as specified by ", - "position": { - "start": { - "line": 5132, - "column": 18, - "offset": 136731 - }, - "end": { - "line": 5133, - "column": 53, - "offset": 136842 - } - } - }, - { - "type": "inlineCode", - "value": "require('node:os').EOL", - "position": { - "start": { - "line": 5133, - "column": 53, - "offset": 136842 - }, - "end": { - "line": 5133, - "column": 77, - "offset": 136866 - } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { - "line": 5133, - "column": 77, - "offset": 136866 - }, - "end": { - "line": 5133, - "column": 78, - "offset": 136867 - } - } - } - ], - "position": { - "start": { - "line": 5131, - "column": 5, - "offset": 136641 - }, - "end": { "line": 5133, "column": 78, "offset": 136867 } - } - } - ], - "position": { - "start": { "line": 5131, "column": 3, "offset": 136639 }, - "end": { "line": 5133, "column": 78, "offset": 136867 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "type", - "position": { - "start": { - "line": 5134, - "column": 5, - "offset": 136872 - }, - "end": { - "line": 5134, - "column": 11, - "offset": 136878 - } - } - }, - { - "type": "text", - "value": " {string} The File content-type.", - "position": { - "start": { - "line": 5134, - "column": 11, - "offset": 136878 - }, - "end": { - "line": 5134, - "column": 43, - "offset": 136910 - } - } - } - ], - "position": { - "start": { - "line": 5134, - "column": 5, - "offset": 136872 - }, - "end": { "line": 5134, "column": 43, "offset": 136910 } - } - } - ], - "position": { - "start": { "line": 5134, "column": 3, "offset": 136870 }, - "end": { "line": 5134, "column": 43, "offset": 136910 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "lastModified", - "position": { - "start": { - "line": 5135, - "column": 5, - "offset": 136915 - }, - "end": { - "line": 5135, - "column": 19, - "offset": 136929 - } - } - }, - { - "type": "text", - "value": " {number} The last modified date of the file.\n", - "position": { - "start": { - "line": 5135, - "column": 19, - "offset": 136929 - }, - "end": { - "line": 5136, - "column": 1, - "offset": 136975 - } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { - "line": 5136, - "column": 7, - "offset": 136981 - }, - "end": { - "line": 5136, - "column": 15, - "offset": 136989 - } - } - } - ], - "position": { - "start": { - "line": 5136, - "column": 5, - "offset": 136979 - }, - "end": { - "line": 5136, - "column": 17, - "offset": 136991 - } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { - "line": 5136, - "column": 17, - "offset": 136991 - }, - "end": { - "line": 5136, - "column": 18, - "offset": 136992 - } - } - }, - { - "type": "inlineCode", - "value": "Date.now()", - "position": { - "start": { - "line": 5136, - "column": 18, - "offset": 136992 - }, - "end": { - "line": 5136, - "column": 30, - "offset": 137004 - } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { - "line": 5136, - "column": 30, - "offset": 137004 - }, - "end": { - "line": 5136, - "column": 31, - "offset": 137005 - } - } - } - ], - "position": { - "start": { - "line": 5135, - "column": 5, - "offset": 136915 - }, - "end": { "line": 5136, "column": 31, "offset": 137005 } - } - } - ], - "position": { - "start": { "line": 5135, "column": 3, "offset": 136913 }, - "end": { "line": 5136, "column": 31, "offset": 137005 } - } - } - ], - "position": { - "start": { "line": 5131, "column": 3, "offset": 136639 }, - "end": { "line": 5136, "column": 31, "offset": 137005 } - } - } - ], - "position": { - "start": { "line": 5130, "column": 1, "offset": 136616 }, - "end": { "line": 5136, "column": 31, "offset": 137005 } - } - } - ], - "position": { - "start": { "line": 5126, "column": 1, "offset": 136332 }, - "end": { "line": 5136, "column": 31, "offset": 137005 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "file.name", - "position": { - "start": { "line": 5138, "column": 5, "offset": 137011 }, - "end": { "line": 5138, "column": 16, "offset": 137022 } - } - } - ], - "position": { - "start": { "line": 5138, "column": 1, "offset": 137007 }, - "end": { "line": 5138, "column": 16, "offset": 137022 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 5140, "column": 1, "offset": 137024 }, - "end": { "line": 5144, "column": 4, "offset": 137069 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Type: {string}", - "position": { - "start": { "line": 5146, "column": 3, "offset": 137073 }, - "end": { "line": 5146, "column": 17, "offset": 137087 } - } - } - ], - "position": { - "start": { "line": 5146, "column": 3, "offset": 137073 }, - "end": { "line": 5146, "column": 17, "offset": 137087 } - } - } - ], - "position": { - "start": { "line": 5146, "column": 1, "offset": 137071 }, - "end": { "line": 5146, "column": 17, "offset": 137087 } - } - } - ], - "position": { - "start": { "line": 5146, "column": 1, "offset": 137071 }, - "end": { "line": 5146, "column": 17, "offset": 137087 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The name of the ", - "position": { - "start": { "line": 5148, "column": 1, "offset": 137089 }, - "end": { "line": 5148, "column": 17, "offset": 137105 } - } - }, - { - "type": "inlineCode", - "value": "File", - "position": { - "start": { "line": 5148, "column": 17, "offset": 137105 }, - "end": { "line": 5148, "column": 23, "offset": 137111 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 5148, "column": 23, "offset": 137111 }, - "end": { "line": 5148, "column": 24, "offset": 137112 } - } - } - ], - "position": { - "start": { "line": 5148, "column": 1, "offset": 137089 }, - "end": { "line": 5148, "column": 24, "offset": 137112 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "file.lastModified", - "position": { - "start": { "line": 5150, "column": 5, "offset": 137118 }, - "end": { "line": 5150, "column": 24, "offset": 137137 } - } - } - ], - "position": { - "start": { "line": 5150, "column": 1, "offset": 137114 }, - "end": { "line": 5150, "column": 24, "offset": 137137 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 5152, "column": 1, "offset": 137139 }, - "end": { "line": 5156, "column": 4, "offset": 137184 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Type: {number}", - "position": { - "start": { "line": 5158, "column": 3, "offset": 137188 }, - "end": { "line": 5158, "column": 17, "offset": 137202 } - } - } - ], - "position": { - "start": { "line": 5158, "column": 3, "offset": 137188 }, - "end": { "line": 5158, "column": 17, "offset": 137202 } - } - } - ], - "position": { - "start": { "line": 5158, "column": 1, "offset": 137186 }, - "end": { "line": 5158, "column": 17, "offset": 137202 } - } - } - ], - "position": { - "start": { "line": 5158, "column": 1, "offset": 137186 }, - "end": { "line": 5158, "column": 17, "offset": 137202 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The last modified date of the ", - "position": { - "start": { "line": 5160, "column": 1, "offset": 137204 }, - "end": { "line": 5160, "column": 31, "offset": 137234 } - } - }, - { - "type": "inlineCode", - "value": "File", - "position": { - "start": { "line": 5160, "column": 31, "offset": 137234 }, - "end": { "line": 5160, "column": 37, "offset": 137240 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 5160, "column": 37, "offset": 137240 }, - "end": { "line": 5160, "column": 38, "offset": 137241 } - } - } - ], - "position": { - "start": { "line": 5160, "column": 1, "offset": 137204 }, - "end": { "line": 5160, "column": 38, "offset": 137241 } - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "inlineCode", - "value": "node:buffer", - "position": { - "start": { "line": 5162, "column": 4, "offset": 137246 }, - "end": { "line": 5162, "column": 17, "offset": 137259 } - } - }, - { - "type": "text", - "value": " module APIs", - "position": { - "start": { "line": 5162, "column": 17, "offset": 137259 }, - "end": { "line": 5162, "column": 29, "offset": 137271 } - } - } - ], - "position": { - "start": { "line": 5162, "column": 1, "offset": 137243 }, - "end": { "line": 5162, "column": 29, "offset": 137271 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "While, the ", - "position": { - "start": { "line": 5164, "column": 1, "offset": 137273 }, - "end": { "line": 5164, "column": 12, "offset": 137284 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 5164, "column": 12, "offset": 137284 }, - "end": { "line": 5164, "column": 20, "offset": 137292 } - } - }, - { - "type": "text", - "value": " object is available as a global, there are additional\n", - "position": { - "start": { "line": 5164, "column": 20, "offset": 137292 }, - "end": { "line": 5165, "column": 1, "offset": 137347 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 5165, "column": 1, "offset": 137347 }, - "end": { "line": 5165, "column": 9, "offset": 137355 } - } - }, - { - "type": "text", - "value": "-related APIs that are available only via the ", - "position": { - "start": { "line": 5165, "column": 9, "offset": 137355 }, - "end": { "line": 5165, "column": 55, "offset": 137401 } - } - }, - { - "type": "inlineCode", - "value": "node:buffer", - "position": { - "start": { "line": 5165, "column": 55, "offset": 137401 }, - "end": { "line": 5165, "column": 68, "offset": 137414 } - } - }, - { - "type": "text", - "value": " module\naccessed using ", - "position": { - "start": { "line": 5165, "column": 68, "offset": 137414 }, - "end": { "line": 5166, "column": 16, "offset": 137437 } - } - }, - { - "type": "inlineCode", - "value": "require('node:buffer')", - "position": { - "start": { "line": 5166, "column": 16, "offset": 137437 }, - "end": { "line": 5166, "column": 40, "offset": 137461 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 5166, "column": 40, "offset": 137461 }, - "end": { "line": 5166, "column": 41, "offset": 137462 } - } - } - ], - "position": { - "start": { "line": 5164, "column": 1, "offset": 137273 }, - "end": { "line": 5166, "column": 41, "offset": 137462 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buffer.atob(data)", - "position": { - "start": { "line": 5168, "column": 5, "offset": 137468 }, - "end": { "line": 5168, "column": 24, "offset": 137487 } - } - } - ], - "position": { - "start": { "line": 5168, "column": 1, "offset": 137464 }, - "end": { "line": 5168, "column": 24, "offset": 137487 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 5170, "column": 1, "offset": 137489 }, - "end": { "line": 5174, "column": 4, "offset": 137535 } - } - }, - { - "type": "blockquote", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Stability: 3 - Legacy. Use ", - "position": { - "start": { "line": 5176, "column": 3, "offset": 137539 }, - "end": { "line": 5176, "column": 30, "offset": 137566 } - } - }, - { - "type": "inlineCode", - "value": "Buffer.from(data, 'base64')", - "position": { - "start": { "line": 5176, "column": 30, "offset": 137566 }, - "end": { "line": 5176, "column": 59, "offset": 137595 } - } - }, - { - "type": "text", - "value": " instead.", - "position": { - "start": { "line": 5176, "column": 59, "offset": 137595 }, - "end": { "line": 5176, "column": 68, "offset": 137604 } - } - } - ], - "position": { - "start": { "line": 5176, "column": 3, "offset": 137539 }, - "end": { "line": 5176, "column": 68, "offset": 137604 } - } - } - ], - "position": { - "start": { "line": 5176, "column": 1, "offset": 137537 }, - "end": { "line": 5176, "column": 68, "offset": 137604 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "data", - "position": { - "start": { "line": 5178, "column": 3, "offset": 137608 }, - "end": { "line": 5178, "column": 9, "offset": 137614 } - } - }, - { - "type": "text", - "value": " {any} The Base64-encoded input string.", - "position": { - "start": { "line": 5178, "column": 9, "offset": 137614 }, - "end": { "line": 5178, "column": 48, "offset": 137653 } - } - } - ], - "position": { - "start": { "line": 5178, "column": 3, "offset": 137608 }, - "end": { "line": 5178, "column": 48, "offset": 137653 } - } - } - ], - "position": { - "start": { "line": 5178, "column": 1, "offset": 137606 }, - "end": { "line": 5178, "column": 48, "offset": 137653 } - } - } - ], - "position": { - "start": { "line": 5178, "column": 1, "offset": 137606 }, - "end": { "line": 5178, "column": 48, "offset": 137653 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Decodes a string of Base64-encoded data into bytes, and encodes those bytes\ninto a string using Latin-1 (ISO-8859-1).", - "position": { - "start": { "line": 5180, "column": 1, "offset": 137655 }, - "end": { "line": 5181, "column": 42, "offset": 137772 } - } - } - ], - "position": { - "start": { "line": 5180, "column": 1, "offset": 137655 }, - "end": { "line": 5181, "column": 42, "offset": 137772 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The ", - "position": { - "start": { "line": 5183, "column": 1, "offset": 137774 }, - "end": { "line": 5183, "column": 5, "offset": 137778 } - } - }, - { - "type": "inlineCode", - "value": "data", - "position": { - "start": { "line": 5183, "column": 5, "offset": 137778 }, - "end": { "line": 5183, "column": 11, "offset": 137784 } - } - }, - { - "type": "text", - "value": " may be any JavaScript-value that can be coerced into a string.", - "position": { - "start": { "line": 5183, "column": 11, "offset": 137784 }, - "end": { "line": 5183, "column": 74, "offset": 137847 } - } - } - ], - "position": { - "start": { "line": 5183, "column": 1, "offset": 137774 }, - "end": { "line": 5183, "column": 74, "offset": 137847 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "This function is only provided for compatibility with legacy web platform APIs\nand should never be used in new code, because they use strings to represent\nbinary data and predate the introduction of typed arrays in JavaScript.\nFor code running using Node.js APIs, converting between base64-encoded strings\nand binary data should be performed using ", - "position": { - "start": { "line": 5185, "column": 3, "offset": 137851 }, - "end": { "line": 5189, "column": 43, "offset": 138199 } - } - }, - { - "type": "inlineCode", - "value": "Buffer.from(str, 'base64')", - "position": { - "start": { "line": 5189, "column": 43, "offset": 138199 }, - "end": { "line": 5189, "column": 71, "offset": 138227 } - } - }, - { - "type": "text", - "value": " and\n", - "position": { - "start": { "line": 5189, "column": 71, "offset": 138227 }, - "end": { "line": 5190, "column": 1, "offset": 138232 } - } - }, - { - "type": "inlineCode", - "value": "buf.toString('base64')", - "position": { - "start": { "line": 5190, "column": 1, "offset": 138232 }, - "end": { "line": 5190, "column": 25, "offset": 138256 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 5190, "column": 25, "offset": 138256 }, - "end": { "line": 5190, "column": 26, "offset": 138257 } - } - } - ], - "position": { - "start": { "line": 5185, "column": 1, "offset": 137849 }, - "end": { "line": 5190, "column": 28, "offset": 138259 } - } - } - ], - "position": { - "start": { "line": 5185, "column": 1, "offset": 137849 }, - "end": { "line": 5190, "column": 28, "offset": 138259 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buffer.btoa(data)", - "position": { - "start": { "line": 5192, "column": 5, "offset": 138265 }, - "end": { "line": 5192, "column": 24, "offset": 138284 } - } - } - ], - "position": { - "start": { "line": 5192, "column": 1, "offset": 138261 }, - "end": { "line": 5192, "column": 24, "offset": 138284 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 5194, "column": 1, "offset": 138286 }, - "end": { "line": 5198, "column": 4, "offset": 138332 } - } - }, - { - "type": "blockquote", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Stability: 3 - Legacy. Use ", - "position": { - "start": { "line": 5200, "column": 3, "offset": 138336 }, - "end": { "line": 5200, "column": 30, "offset": 138363 } - } - }, - { - "type": "inlineCode", - "value": "buf.toString('base64')", - "position": { - "start": { "line": 5200, "column": 30, "offset": 138363 }, - "end": { "line": 5200, "column": 54, "offset": 138387 } - } - }, - { - "type": "text", - "value": " instead.", - "position": { - "start": { "line": 5200, "column": 54, "offset": 138387 }, - "end": { "line": 5200, "column": 63, "offset": 138396 } - } - } - ], - "position": { - "start": { "line": 5200, "column": 3, "offset": 138336 }, - "end": { "line": 5200, "column": 63, "offset": 138396 } - } - } - ], - "position": { - "start": { "line": 5200, "column": 1, "offset": 138334 }, - "end": { "line": 5200, "column": 63, "offset": 138396 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "data", - "position": { - "start": { "line": 5202, "column": 3, "offset": 138400 }, - "end": { "line": 5202, "column": 9, "offset": 138406 } - } - }, - { - "type": "text", - "value": " {any} An ASCII (Latin1) string.", - "position": { - "start": { "line": 5202, "column": 9, "offset": 138406 }, - "end": { "line": 5202, "column": 41, "offset": 138438 } - } - } - ], - "position": { - "start": { "line": 5202, "column": 3, "offset": 138400 }, - "end": { "line": 5202, "column": 41, "offset": 138438 } - } - } - ], - "position": { - "start": { "line": 5202, "column": 1, "offset": 138398 }, - "end": { "line": 5202, "column": 41, "offset": 138438 } - } - } - ], - "position": { - "start": { "line": 5202, "column": 1, "offset": 138398 }, - "end": { "line": 5202, "column": 41, "offset": 138438 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Decodes a string into bytes using Latin-1 (ISO-8859), and encodes those bytes\ninto a string using Base64.", - "position": { - "start": { "line": 5204, "column": 1, "offset": 138440 }, - "end": { "line": 5205, "column": 28, "offset": 138545 } - } - } - ], - "position": { - "start": { "line": 5204, "column": 1, "offset": 138440 }, - "end": { "line": 5205, "column": 28, "offset": 138545 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The ", - "position": { - "start": { "line": 5207, "column": 1, "offset": 138547 }, - "end": { "line": 5207, "column": 5, "offset": 138551 } - } - }, - { - "type": "inlineCode", - "value": "data", - "position": { - "start": { "line": 5207, "column": 5, "offset": 138551 }, - "end": { "line": 5207, "column": 11, "offset": 138557 } - } - }, - { - "type": "text", - "value": " may be any JavaScript-value that can be coerced into a string.", - "position": { - "start": { "line": 5207, "column": 11, "offset": 138557 }, - "end": { "line": 5207, "column": 74, "offset": 138620 } - } - } - ], - "position": { - "start": { "line": 5207, "column": 1, "offset": 138547 }, - "end": { "line": 5207, "column": 74, "offset": 138620 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "This function is only provided for compatibility with legacy web platform APIs\nand should never be used in new code, because they use strings to represent\nbinary data and predate the introduction of typed arrays in JavaScript.\nFor code running using Node.js APIs, converting between base64-encoded strings\nand binary data should be performed using ", - "position": { - "start": { "line": 5209, "column": 3, "offset": 138624 }, - "end": { "line": 5213, "column": 43, "offset": 138972 } - } - }, - { - "type": "inlineCode", - "value": "Buffer.from(str, 'base64')", - "position": { - "start": { "line": 5213, "column": 43, "offset": 138972 }, - "end": { "line": 5213, "column": 71, "offset": 139000 } - } - }, - { - "type": "text", - "value": " and\n", - "position": { - "start": { "line": 5213, "column": 71, "offset": 139000 }, - "end": { "line": 5214, "column": 1, "offset": 139005 } - } - }, - { - "type": "inlineCode", - "value": "buf.toString('base64')", - "position": { - "start": { "line": 5214, "column": 1, "offset": 139005 }, - "end": { "line": 5214, "column": 25, "offset": 139029 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 5214, "column": 25, "offset": 139029 }, - "end": { "line": 5214, "column": 26, "offset": 139030 } - } - } - ], - "position": { - "start": { "line": 5209, "column": 1, "offset": 138622 }, - "end": { "line": 5214, "column": 28, "offset": 139032 } - } - } - ], - "position": { - "start": { "line": 5209, "column": 1, "offset": 138622 }, - "end": { "line": 5214, "column": 28, "offset": 139032 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buffer.isAscii(input)", - "position": { - "start": { "line": 5216, "column": 5, "offset": 139038 }, - "end": { "line": 5216, "column": 28, "offset": 139061 } - } - } - ], - "position": { - "start": { "line": 5216, "column": 1, "offset": 139034 }, - "end": { "line": 5216, "column": 28, "offset": 139061 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 5218, "column": 1, "offset": 139063 }, - "end": { "line": 5222, "column": 4, "offset": 139108 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "input {Buffer | ArrayBuffer | TypedArray} The input to validate.", - "position": { - "start": { "line": 5224, "column": 3, "offset": 139112 }, - "end": { "line": 5224, "column": 67, "offset": 139176 } - } - } - ], - "position": { - "start": { "line": 5224, "column": 3, "offset": 139112 }, - "end": { "line": 5224, "column": 67, "offset": 139176 } - } - } - ], - "position": { - "start": { "line": 5224, "column": 1, "offset": 139110 }, - "end": { "line": 5224, "column": 67, "offset": 139176 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {boolean}", - "position": { - "start": { "line": 5225, "column": 3, "offset": 139179 }, - "end": { "line": 5225, "column": 21, "offset": 139197 } - } - } - ], - "position": { - "start": { "line": 5225, "column": 3, "offset": 139179 }, - "end": { "line": 5225, "column": 21, "offset": 139197 } - } - } - ], - "position": { - "start": { "line": 5225, "column": 1, "offset": 139177 }, - "end": { "line": 5225, "column": 21, "offset": 139197 } - } - } - ], - "position": { - "start": { "line": 5224, "column": 1, "offset": 139110 }, - "end": { "line": 5225, "column": 21, "offset": 139197 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This function returns ", - "position": { - "start": { "line": 5227, "column": 1, "offset": 139199 }, - "end": { "line": 5227, "column": 23, "offset": 139221 } - } - }, - { - "type": "inlineCode", - "value": "true", - "position": { - "start": { "line": 5227, "column": 23, "offset": 139221 }, - "end": { "line": 5227, "column": 29, "offset": 139227 } - } - }, - { - "type": "text", - "value": " if ", - "position": { - "start": { "line": 5227, "column": 29, "offset": 139227 }, - "end": { "line": 5227, "column": 33, "offset": 139231 } - } - }, - { - "type": "inlineCode", - "value": "input", - "position": { - "start": { "line": 5227, "column": 33, "offset": 139231 }, - "end": { "line": 5227, "column": 40, "offset": 139238 } - } - }, - { - "type": "text", - "value": " contains only valid ASCII-encoded data,\nincluding the case in which ", - "position": { - "start": { "line": 5227, "column": 40, "offset": 139238 }, - "end": { "line": 5228, "column": 29, "offset": 139307 } - } - }, - { - "type": "inlineCode", - "value": "input", - "position": { - "start": { "line": 5228, "column": 29, "offset": 139307 }, - "end": { "line": 5228, "column": 36, "offset": 139314 } - } - }, - { - "type": "text", - "value": " is empty.", - "position": { - "start": { "line": 5228, "column": 36, "offset": 139314 }, - "end": { "line": 5228, "column": 46, "offset": 139324 } - } - } - ], - "position": { - "start": { "line": 5227, "column": 1, "offset": 139199 }, - "end": { "line": 5228, "column": 46, "offset": 139324 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Throws if the ", - "position": { - "start": { "line": 5230, "column": 1, "offset": 139326 }, - "end": { "line": 5230, "column": 15, "offset": 139340 } - } - }, - { - "type": "inlineCode", - "value": "input", - "position": { - "start": { "line": 5230, "column": 15, "offset": 139340 }, - "end": { "line": 5230, "column": 22, "offset": 139347 } - } - }, - { - "type": "text", - "value": " is a detached array buffer.", - "position": { - "start": { "line": 5230, "column": 22, "offset": 139347 }, - "end": { "line": 5230, "column": 50, "offset": 139375 } - } - } - ], - "position": { - "start": { "line": 5230, "column": 1, "offset": 139326 }, - "end": { "line": 5230, "column": 50, "offset": 139375 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buffer.isUtf8(input)", - "position": { - "start": { "line": 5232, "column": 5, "offset": 139381 }, - "end": { "line": 5232, "column": 27, "offset": 139403 } - } - } - ], - "position": { - "start": { "line": 5232, "column": 1, "offset": 139377 }, - "end": { "line": 5232, "column": 27, "offset": 139403 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 5234, "column": 1, "offset": 139405 }, - "end": { "line": 5238, "column": 4, "offset": 139450 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "input {Buffer | ArrayBuffer | TypedArray} The input to validate.", - "position": { - "start": { "line": 5240, "column": 3, "offset": 139454 }, - "end": { "line": 5240, "column": 67, "offset": 139518 } - } - } - ], - "position": { - "start": { "line": 5240, "column": 3, "offset": 139454 }, - "end": { "line": 5240, "column": 67, "offset": 139518 } - } - } - ], - "position": { - "start": { "line": 5240, "column": 1, "offset": 139452 }, - "end": { "line": 5240, "column": 67, "offset": 139518 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {boolean}", - "position": { - "start": { "line": 5241, "column": 3, "offset": 139521 }, - "end": { "line": 5241, "column": 21, "offset": 139539 } - } - } - ], - "position": { - "start": { "line": 5241, "column": 3, "offset": 139521 }, - "end": { "line": 5241, "column": 21, "offset": 139539 } - } - } - ], - "position": { - "start": { "line": 5241, "column": 1, "offset": 139519 }, - "end": { "line": 5241, "column": 21, "offset": 139539 } - } - } - ], - "position": { - "start": { "line": 5240, "column": 1, "offset": 139452 }, - "end": { "line": 5241, "column": 21, "offset": 139539 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This function returns ", - "position": { - "start": { "line": 5243, "column": 1, "offset": 139541 }, - "end": { "line": 5243, "column": 23, "offset": 139563 } - } - }, - { - "type": "inlineCode", - "value": "true", - "position": { - "start": { "line": 5243, "column": 23, "offset": 139563 }, - "end": { "line": 5243, "column": 29, "offset": 139569 } - } - }, - { - "type": "text", - "value": " if ", - "position": { - "start": { "line": 5243, "column": 29, "offset": 139569 }, - "end": { "line": 5243, "column": 33, "offset": 139573 } - } - }, - { - "type": "inlineCode", - "value": "input", - "position": { - "start": { "line": 5243, "column": 33, "offset": 139573 }, - "end": { "line": 5243, "column": 40, "offset": 139580 } - } - }, - { - "type": "text", - "value": " contains only valid UTF-8-encoded data,\nincluding the case in which ", - "position": { - "start": { "line": 5243, "column": 40, "offset": 139580 }, - "end": { "line": 5244, "column": 29, "offset": 139649 } - } - }, - { - "type": "inlineCode", - "value": "input", - "position": { - "start": { "line": 5244, "column": 29, "offset": 139649 }, - "end": { "line": 5244, "column": 36, "offset": 139656 } - } - }, - { - "type": "text", - "value": " is empty.", - "position": { - "start": { "line": 5244, "column": 36, "offset": 139656 }, - "end": { "line": 5244, "column": 46, "offset": 139666 } - } - } - ], - "position": { - "start": { "line": 5243, "column": 1, "offset": 139541 }, - "end": { "line": 5244, "column": 46, "offset": 139666 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Throws if the ", - "position": { - "start": { "line": 5246, "column": 1, "offset": 139668 }, - "end": { "line": 5246, "column": 15, "offset": 139682 } - } - }, - { - "type": "inlineCode", - "value": "input", - "position": { - "start": { "line": 5246, "column": 15, "offset": 139682 }, - "end": { "line": 5246, "column": 22, "offset": 139689 } - } - }, - { - "type": "text", - "value": " is a detached array buffer.", - "position": { - "start": { "line": 5246, "column": 22, "offset": 139689 }, - "end": { "line": 5246, "column": 50, "offset": 139717 } - } - } - ], - "position": { - "start": { "line": 5246, "column": 1, "offset": 139668 }, - "end": { "line": 5246, "column": 50, "offset": 139717 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buffer.INSPECT_MAX_BYTES", - "position": { - "start": { "line": 5248, "column": 5, "offset": 139723 }, - "end": { "line": 5248, "column": 31, "offset": 139749 } - } - } - ], - "position": { - "start": { "line": 5248, "column": 1, "offset": 139719 }, - "end": { "line": 5248, "column": 31, "offset": 139749 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 5250, "column": 1, "offset": 139751 }, - "end": { "line": 5252, "column": 4, "offset": 139778 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "{integer} ", - "position": { - "start": { "line": 5254, "column": 3, "offset": 139782 }, - "end": { "line": 5254, "column": 13, "offset": 139792 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Default:", - "position": { - "start": { - "line": 5254, - "column": 15, - "offset": 139794 - }, - "end": { "line": 5254, "column": 23, "offset": 139802 } - } - } - ], - "position": { - "start": { "line": 5254, "column": 13, "offset": 139792 }, - "end": { "line": 5254, "column": 25, "offset": 139804 } - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 5254, "column": 25, "offset": 139804 }, - "end": { "line": 5254, "column": 26, "offset": 139805 } - } - }, - { - "type": "inlineCode", - "value": "50", - "position": { - "start": { "line": 5254, "column": 26, "offset": 139805 }, - "end": { "line": 5254, "column": 30, "offset": 139809 } - } - } - ], - "position": { - "start": { "line": 5254, "column": 3, "offset": 139782 }, - "end": { "line": 5254, "column": 30, "offset": 139809 } - } - } - ], - "position": { - "start": { "line": 5254, "column": 1, "offset": 139780 }, - "end": { "line": 5254, "column": 30, "offset": 139809 } - } - } - ], - "position": { - "start": { "line": 5254, "column": 1, "offset": 139780 }, - "end": { "line": 5254, "column": 30, "offset": 139809 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns the maximum number of bytes that will be returned when\n", - "position": { - "start": { "line": 5256, "column": 1, "offset": 139811 }, - "end": { "line": 5257, "column": 1, "offset": 139874 } - } - }, - { - "type": "inlineCode", - "value": "buf.inspect()", - "position": { - "start": { "line": 5257, "column": 1, "offset": 139874 }, - "end": { "line": 5257, "column": 16, "offset": 139889 } - } - }, - { - "type": "text", - "value": " is called. This can be overridden by user modules. See\n", - "position": { - "start": { "line": 5257, "column": 16, "offset": 139889 }, - "end": { "line": 5258, "column": 1, "offset": 139945 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "util.inspect()", - "position": { - "start": { "line": 5258, "column": 2, "offset": 139946 }, - "end": { "line": 5258, "column": 18, "offset": 139962 } - } - } - ], - "position": { - "start": { "line": 5258, "column": 1, "offset": 139945 }, - "end": { "line": 5258, "column": 21, "offset": 139965 } - }, - "label": "`util.inspect()`", - "identifier": "`util.inspect()`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": " for more details on ", - "position": { - "start": { "line": 5258, "column": 21, "offset": 139965 }, - "end": { "line": 5258, "column": 42, "offset": 139986 } - } - }, - { - "type": "inlineCode", - "value": "buf.inspect()", - "position": { - "start": { "line": 5258, "column": 42, "offset": 139986 }, - "end": { "line": 5258, "column": 57, "offset": 140001 } - } - }, - { - "type": "text", - "value": " behavior.", - "position": { - "start": { "line": 5258, "column": 57, "offset": 140001 }, - "end": { "line": 5258, "column": 67, "offset": 140011 } - } - } - ], - "position": { - "start": { "line": 5256, "column": 1, "offset": 139811 }, - "end": { "line": 5258, "column": 67, "offset": 140011 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buffer.kMaxLength", - "position": { - "start": { "line": 5260, "column": 5, "offset": 140017 }, - "end": { "line": 5260, "column": 24, "offset": 140036 } - } - } - ], - "position": { - "start": { "line": 5260, "column": 1, "offset": 140013 }, - "end": { "line": 5260, "column": 24, "offset": 140036 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 5262, "column": 1, "offset": 140038 }, - "end": { "line": 5264, "column": 4, "offset": 140065 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "{integer} The largest size allowed for a single ", - "position": { - "start": { "line": 5266, "column": 3, "offset": 140069 }, - "end": { "line": 5266, "column": 51, "offset": 140117 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 5266, "column": 51, "offset": 140117 }, - "end": { "line": 5266, "column": 59, "offset": 140125 } - } - }, - { - "type": "text", - "value": " instance.", - "position": { - "start": { "line": 5266, "column": 59, "offset": 140125 }, - "end": { "line": 5266, "column": 69, "offset": 140135 } - } - } - ], - "position": { - "start": { "line": 5266, "column": 3, "offset": 140069 }, - "end": { "line": 5266, "column": 69, "offset": 140135 } - } - } - ], - "position": { - "start": { "line": 5266, "column": 1, "offset": 140067 }, - "end": { "line": 5266, "column": 69, "offset": 140135 } - } - } - ], - "position": { - "start": { "line": 5266, "column": 1, "offset": 140067 }, - "end": { "line": 5266, "column": 69, "offset": 140135 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "An alias for ", - "position": { - "start": { "line": 5268, "column": 1, "offset": 140137 }, - "end": { "line": 5268, "column": 14, "offset": 140150 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "buffer.constants.MAX_LENGTH", - "position": { - "start": { "line": 5268, "column": 15, "offset": 140151 }, - "end": { "line": 5268, "column": 44, "offset": 140180 } - } - } - ], - "position": { - "start": { "line": 5268, "column": 14, "offset": 140150 }, - "end": { "line": 5268, "column": 47, "offset": 140183 } - }, - "label": "`buffer.constants.MAX_LENGTH`", - "identifier": "`buffer.constants.max_length`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 5268, "column": 47, "offset": 140183 }, - "end": { "line": 5268, "column": 48, "offset": 140184 } - } - } - ], - "position": { - "start": { "line": 5268, "column": 1, "offset": 140137 }, - "end": { "line": 5268, "column": 48, "offset": 140184 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buffer.kStringMaxLength", - "position": { - "start": { "line": 5270, "column": 5, "offset": 140190 }, - "end": { "line": 5270, "column": 30, "offset": 140215 } - } - } - ], - "position": { - "start": { "line": 5270, "column": 1, "offset": 140186 }, - "end": { "line": 5270, "column": 30, "offset": 140215 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 5272, "column": 1, "offset": 140217 }, - "end": { "line": 5274, "column": 4, "offset": 140244 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "{integer} The largest length allowed for a single ", - "position": { - "start": { "line": 5276, "column": 3, "offset": 140248 }, - "end": { "line": 5276, "column": 53, "offset": 140298 } - } - }, - { - "type": "inlineCode", - "value": "string", - "position": { - "start": { "line": 5276, "column": 53, "offset": 140298 }, - "end": { "line": 5276, "column": 61, "offset": 140306 } - } - }, - { - "type": "text", - "value": " instance.", - "position": { - "start": { "line": 5276, "column": 61, "offset": 140306 }, - "end": { "line": 5276, "column": 71, "offset": 140316 } - } - } - ], - "position": { - "start": { "line": 5276, "column": 3, "offset": 140248 }, - "end": { "line": 5276, "column": 71, "offset": 140316 } - } - } - ], - "position": { - "start": { "line": 5276, "column": 1, "offset": 140246 }, - "end": { "line": 5276, "column": 71, "offset": 140316 } - } - } - ], - "position": { - "start": { "line": 5276, "column": 1, "offset": 140246 }, - "end": { "line": 5276, "column": 71, "offset": 140316 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "An alias for ", - "position": { - "start": { "line": 5278, "column": 1, "offset": 140318 }, - "end": { "line": 5278, "column": 14, "offset": 140331 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "buffer.constants.MAX_STRING_LENGTH", - "position": { - "start": { "line": 5278, "column": 15, "offset": 140332 }, - "end": { "line": 5278, "column": 51, "offset": 140368 } - } - } - ], - "position": { - "start": { "line": 5278, "column": 14, "offset": 140331 }, - "end": { "line": 5278, "column": 54, "offset": 140371 } - }, - "label": "`buffer.constants.MAX_STRING_LENGTH`", - "identifier": "`buffer.constants.max_string_length`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 5278, "column": 54, "offset": 140371 }, - "end": { "line": 5278, "column": 55, "offset": 140372 } - } - } - ], - "position": { - "start": { "line": 5278, "column": 1, "offset": 140318 }, - "end": { "line": 5278, "column": 55, "offset": 140372 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buffer.resolveObjectURL(id)", - "position": { - "start": { "line": 5280, "column": 5, "offset": 140378 }, - "end": { "line": 5280, "column": 34, "offset": 140407 } - } - } - ], - "position": { - "start": { "line": 5280, "column": 1, "offset": 140374 }, - "end": { "line": 5280, "column": 34, "offset": 140407 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 5282, "column": 1, "offset": 140409 }, - "end": { "line": 5288, "column": 4, "offset": 140559 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "id", - "position": { - "start": { "line": 5290, "column": 3, "offset": 140563 }, - "end": { "line": 5290, "column": 7, "offset": 140567 } - } - }, - { - "type": "text", - "value": " {string} A ", - "position": { - "start": { "line": 5290, "column": 7, "offset": 140567 }, - "end": { "line": 5290, "column": 19, "offset": 140579 } - } - }, - { - "type": "inlineCode", - "value": "'blob:nodedata:...", - "position": { - "start": { "line": 5290, "column": 19, "offset": 140579 }, - "end": { "line": 5290, "column": 39, "offset": 140599 } - } - }, - { - "type": "text", - "value": " URL string returned by a prior call to\n", - "position": { - "start": { "line": 5290, "column": 39, "offset": 140599 }, - "end": { "line": 5291, "column": 1, "offset": 140639 } - } - }, - { - "type": "inlineCode", - "value": "URL.createObjectURL()", - "position": { - "start": { "line": 5291, "column": 3, "offset": 140641 }, - "end": { "line": 5291, "column": 26, "offset": 140664 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 5291, "column": 26, "offset": 140664 }, - "end": { "line": 5291, "column": 27, "offset": 140665 } - } - } - ], - "position": { - "start": { "line": 5290, "column": 3, "offset": 140563 }, - "end": { "line": 5291, "column": 27, "offset": 140665 } - } - } - ], - "position": { - "start": { "line": 5290, "column": 1, "offset": 140561 }, - "end": { "line": 5291, "column": 27, "offset": 140665 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {Blob}", - "position": { - "start": { "line": 5292, "column": 3, "offset": 140668 }, - "end": { "line": 5292, "column": 18, "offset": 140683 } - } - } - ], - "position": { - "start": { "line": 5292, "column": 3, "offset": 140668 }, - "end": { "line": 5292, "column": 18, "offset": 140683 } - } - } - ], - "position": { - "start": { "line": 5292, "column": 1, "offset": 140666 }, - "end": { "line": 5292, "column": 18, "offset": 140683 } - } - } - ], - "position": { - "start": { "line": 5290, "column": 1, "offset": 140561 }, - "end": { "line": 5292, "column": 18, "offset": 140683 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Resolves a ", - "position": { - "start": { "line": 5294, "column": 1, "offset": 140685 }, - "end": { "line": 5294, "column": 12, "offset": 140696 } - } - }, - { - "type": "inlineCode", - "value": "'blob:nodedata:...'", - "position": { - "start": { "line": 5294, "column": 12, "offset": 140696 }, - "end": { "line": 5294, "column": 33, "offset": 140717 } - } - }, - { - "type": "text", - "value": " an associated {Blob} object registered using\na prior call to ", - "position": { - "start": { "line": 5294, "column": 33, "offset": 140717 }, - "end": { "line": 5295, "column": 17, "offset": 140779 } - } - }, - { - "type": "inlineCode", - "value": "URL.createObjectURL()", - "position": { - "start": { "line": 5295, "column": 17, "offset": 140779 }, - "end": { "line": 5295, "column": 40, "offset": 140802 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 5295, "column": 40, "offset": 140802 }, - "end": { "line": 5295, "column": 41, "offset": 140803 } - } - } - ], - "position": { - "start": { "line": 5294, "column": 1, "offset": 140685 }, - "end": { "line": 5295, "column": 41, "offset": 140803 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "inlineCode", - "value": "buffer.transcode(source, fromEnc, toEnc)", - "position": { - "start": { "line": 5297, "column": 5, "offset": 140809 }, - "end": { "line": 5297, "column": 47, "offset": 140851 } - } - } - ], - "position": { - "start": { "line": 5297, "column": 1, "offset": 140805 }, - "end": { "line": 5297, "column": 47, "offset": 140851 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 5299, "column": 1, "offset": 140853 }, - "end": { "line": 5305, "column": 4, "offset": 141030 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "source", - "position": { - "start": { "line": 5307, "column": 3, "offset": 141034 }, - "end": { "line": 5307, "column": 11, "offset": 141042 } - } - }, - { - "type": "text", - "value": " {Buffer|Uint8Array} A ", - "position": { - "start": { "line": 5307, "column": 11, "offset": 141042 }, - "end": { "line": 5307, "column": 34, "offset": 141065 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 5307, "column": 34, "offset": 141065 }, - "end": { "line": 5307, "column": 42, "offset": 141073 } - } - }, - { - "type": "text", - "value": " or ", - "position": { - "start": { "line": 5307, "column": 42, "offset": 141073 }, - "end": { "line": 5307, "column": 46, "offset": 141077 } - } - }, - { - "type": "inlineCode", - "value": "Uint8Array", - "position": { - "start": { "line": 5307, "column": 46, "offset": 141077 }, - "end": { "line": 5307, "column": 58, "offset": 141089 } - } - }, - { - "type": "text", - "value": " instance.", - "position": { - "start": { "line": 5307, "column": 58, "offset": 141089 }, - "end": { "line": 5307, "column": 68, "offset": 141099 } - } - } - ], - "position": { - "start": { "line": 5307, "column": 3, "offset": 141034 }, - "end": { "line": 5307, "column": 68, "offset": 141099 } - } - } - ], - "position": { - "start": { "line": 5307, "column": 1, "offset": 141032 }, - "end": { "line": 5307, "column": 68, "offset": 141099 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "fromEnc", - "position": { - "start": { "line": 5308, "column": 3, "offset": 141102 }, - "end": { "line": 5308, "column": 12, "offset": 141111 } - } - }, - { - "type": "text", - "value": " {string} The current encoding.", - "position": { - "start": { "line": 5308, "column": 12, "offset": 141111 }, - "end": { "line": 5308, "column": 43, "offset": 141142 } - } - } - ], - "position": { - "start": { "line": 5308, "column": 3, "offset": 141102 }, - "end": { "line": 5308, "column": 43, "offset": 141142 } - } - } - ], - "position": { - "start": { "line": 5308, "column": 1, "offset": 141100 }, - "end": { "line": 5308, "column": 43, "offset": 141142 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "toEnc", - "position": { - "start": { "line": 5309, "column": 3, "offset": 141145 }, - "end": { "line": 5309, "column": 10, "offset": 141152 } - } - }, - { - "type": "text", - "value": " {string} To target encoding.", - "position": { - "start": { "line": 5309, "column": 10, "offset": 141152 }, - "end": { "line": 5309, "column": 39, "offset": 141181 } - } - } - ], - "position": { - "start": { "line": 5309, "column": 3, "offset": 141145 }, - "end": { "line": 5309, "column": 39, "offset": 141181 } - } - } - ], - "position": { - "start": { "line": 5309, "column": 1, "offset": 141143 }, - "end": { "line": 5309, "column": 39, "offset": 141181 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns: {Buffer}", - "position": { - "start": { "line": 5310, "column": 3, "offset": 141184 }, - "end": { "line": 5310, "column": 20, "offset": 141201 } - } - } - ], - "position": { - "start": { "line": 5310, "column": 3, "offset": 141184 }, - "end": { "line": 5310, "column": 20, "offset": 141201 } - } - } - ], - "position": { - "start": { "line": 5310, "column": 1, "offset": 141182 }, - "end": { "line": 5310, "column": 20, "offset": 141201 } - } - } - ], - "position": { - "start": { "line": 5307, "column": 1, "offset": 141032 }, - "end": { "line": 5310, "column": 20, "offset": 141201 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Re-encodes the given ", - "position": { - "start": { "line": 5312, "column": 1, "offset": 141203 }, - "end": { "line": 5312, "column": 22, "offset": 141224 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 5312, "column": 22, "offset": 141224 }, - "end": { "line": 5312, "column": 30, "offset": 141232 } - } - }, - { - "type": "text", - "value": " or ", - "position": { - "start": { "line": 5312, "column": 30, "offset": 141232 }, - "end": { "line": 5312, "column": 34, "offset": 141236 } - } - }, - { - "type": "inlineCode", - "value": "Uint8Array", - "position": { - "start": { "line": 5312, "column": 34, "offset": 141236 }, - "end": { "line": 5312, "column": 46, "offset": 141248 } - } - }, - { - "type": "text", - "value": " instance from one character\nencoding to another. Returns a new ", - "position": { - "start": { "line": 5312, "column": 46, "offset": 141248 }, - "end": { "line": 5313, "column": 36, "offset": 141312 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 5313, "column": 36, "offset": 141312 }, - "end": { "line": 5313, "column": 44, "offset": 141320 } - } - }, - { - "type": "text", - "value": " instance.", - "position": { - "start": { "line": 5313, "column": 44, "offset": 141320 }, - "end": { "line": 5313, "column": 54, "offset": 141330 } - } - } - ], - "position": { - "start": { "line": 5312, "column": 1, "offset": 141203 }, - "end": { "line": 5313, "column": 54, "offset": 141330 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Throws if the ", - "position": { - "start": { "line": 5315, "column": 1, "offset": 141332 }, - "end": { "line": 5315, "column": 15, "offset": 141346 } - } - }, - { - "type": "inlineCode", - "value": "fromEnc", - "position": { - "start": { "line": 5315, "column": 15, "offset": 141346 }, - "end": { "line": 5315, "column": 24, "offset": 141355 } - } - }, - { - "type": "text", - "value": " or ", - "position": { - "start": { "line": 5315, "column": 24, "offset": 141355 }, - "end": { "line": 5315, "column": 28, "offset": 141359 } - } - }, - { - "type": "inlineCode", - "value": "toEnc", - "position": { - "start": { "line": 5315, "column": 28, "offset": 141359 }, - "end": { "line": 5315, "column": 35, "offset": 141366 } - } - }, - { - "type": "text", - "value": " specify invalid character encodings or if\nconversion from ", - "position": { - "start": { "line": 5315, "column": 35, "offset": 141366 }, - "end": { "line": 5316, "column": 17, "offset": 141425 } - } - }, - { - "type": "inlineCode", - "value": "fromEnc", - "position": { - "start": { "line": 5316, "column": 17, "offset": 141425 }, - "end": { "line": 5316, "column": 26, "offset": 141434 } - } - }, - { - "type": "text", - "value": " to ", - "position": { - "start": { "line": 5316, "column": 26, "offset": 141434 }, - "end": { "line": 5316, "column": 30, "offset": 141438 } - } - }, - { - "type": "inlineCode", - "value": "toEnc", - "position": { - "start": { "line": 5316, "column": 30, "offset": 141438 }, - "end": { "line": 5316, "column": 37, "offset": 141445 } - } - }, - { - "type": "text", - "value": " is not permitted.", - "position": { - "start": { "line": 5316, "column": 37, "offset": 141445 }, - "end": { "line": 5316, "column": 55, "offset": 141463 } - } - } - ], - "position": { - "start": { "line": 5315, "column": 1, "offset": 141332 }, - "end": { "line": 5316, "column": 55, "offset": 141463 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Encodings supported by ", - "position": { - "start": { "line": 5318, "column": 1, "offset": 141465 }, - "end": { "line": 5318, "column": 24, "offset": 141488 } - } - }, - { - "type": "inlineCode", - "value": "buffer.transcode()", - "position": { - "start": { "line": 5318, "column": 24, "offset": 141488 }, - "end": { "line": 5318, "column": 44, "offset": 141508 } - } - }, - { - "type": "text", - "value": " are: ", - "position": { - "start": { "line": 5318, "column": 44, "offset": 141508 }, - "end": { "line": 5318, "column": 50, "offset": 141514 } - } - }, - { - "type": "inlineCode", - "value": "'ascii'", - "position": { - "start": { "line": 5318, "column": 50, "offset": 141514 }, - "end": { "line": 5318, "column": 59, "offset": 141523 } - } - }, - { - "type": "text", - "value": ", ", - "position": { - "start": { "line": 5318, "column": 59, "offset": 141523 }, - "end": { "line": 5318, "column": 61, "offset": 141525 } - } - }, - { - "type": "inlineCode", - "value": "'utf8'", - "position": { - "start": { "line": 5318, "column": 61, "offset": 141525 }, - "end": { "line": 5318, "column": 69, "offset": 141533 } - } - }, - { - "type": "text", - "value": ",\n", - "position": { - "start": { "line": 5318, "column": 69, "offset": 141533 }, - "end": { "line": 5319, "column": 1, "offset": 141535 } - } - }, - { - "type": "inlineCode", - "value": "'utf16le'", - "position": { - "start": { "line": 5319, "column": 1, "offset": 141535 }, - "end": { "line": 5319, "column": 12, "offset": 141546 } - } - }, - { - "type": "text", - "value": ", ", - "position": { - "start": { "line": 5319, "column": 12, "offset": 141546 }, - "end": { "line": 5319, "column": 14, "offset": 141548 } - } - }, - { - "type": "inlineCode", - "value": "'ucs2'", - "position": { - "start": { "line": 5319, "column": 14, "offset": 141548 }, - "end": { "line": 5319, "column": 22, "offset": 141556 } - } - }, - { - "type": "text", - "value": ", ", - "position": { - "start": { "line": 5319, "column": 22, "offset": 141556 }, - "end": { "line": 5319, "column": 24, "offset": 141558 } - } - }, - { - "type": "inlineCode", - "value": "'latin1'", - "position": { - "start": { "line": 5319, "column": 24, "offset": 141558 }, - "end": { "line": 5319, "column": 34, "offset": 141568 } - } - }, - { - "type": "text", - "value": ", and ", - "position": { - "start": { "line": 5319, "column": 34, "offset": 141568 }, - "end": { "line": 5319, "column": 40, "offset": 141574 } - } - }, - { - "type": "inlineCode", - "value": "'binary'", - "position": { - "start": { "line": 5319, "column": 40, "offset": 141574 }, - "end": { "line": 5319, "column": 50, "offset": 141584 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 5319, "column": 50, "offset": 141584 }, - "end": { "line": 5319, "column": 51, "offset": 141585 } - } - } - ], - "position": { - "start": { "line": 5318, "column": 1, "offset": 141465 }, - "end": { "line": 5319, "column": 51, "offset": 141585 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The transcoding process will use substitution characters if a given byte\nsequence cannot be adequately represented in the target encoding. For instance:", - "position": { - "start": { "line": 5321, "column": 1, "offset": 141587 }, - "end": { "line": 5322, "column": 80, "offset": 141739 } - } - } - ], - "position": { - "start": { "line": 5321, "column": 1, "offset": 141587 }, - "end": { "line": 5322, "column": 80, "offset": 141739 } - } - }, - { - "type": "code", - "lang": "mjs", - "meta": null, - "value": "import { Buffer, transcode } from 'node:buffer';\n\nconst newBuf = transcode(Buffer.from('€'), 'utf8', 'ascii');\nconsole.log(newBuf.toString('ascii'));\n// Prints: '?'", - "position": { - "start": { "line": 5324, "column": 1, "offset": 141741 }, - "end": { "line": 5330, "column": 4, "offset": 141916 } - } - }, - { - "type": "code", - "lang": "cjs", - "meta": null, - "value": "const { Buffer, transcode } = require('node:buffer');\n\nconst newBuf = transcode(Buffer.from('€'), 'utf8', 'ascii');\nconsole.log(newBuf.toString('ascii'));\n// Prints: '?'", - "position": { - "start": { "line": 5332, "column": 1, "offset": 141918 }, - "end": { "line": 5338, "column": 4, "offset": 142098 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Because the Euro (", - "position": { - "start": { "line": 5340, "column": 1, "offset": 142100 }, - "end": { "line": 5340, "column": 19, "offset": 142118 } - } - }, - { - "type": "inlineCode", - "value": "€", - "position": { - "start": { "line": 5340, "column": 19, "offset": 142118 }, - "end": { "line": 5340, "column": 22, "offset": 142121 } - } - }, - { - "type": "text", - "value": ") sign is not representable in US-ASCII, it is replaced\nwith ", - "position": { - "start": { "line": 5340, "column": 22, "offset": 142121 }, - "end": { "line": 5341, "column": 6, "offset": 142182 } - } - }, - { - "type": "inlineCode", - "value": "?", - "position": { - "start": { "line": 5341, "column": 6, "offset": 142182 }, - "end": { "line": 5341, "column": 9, "offset": 142185 } - } - }, - { - "type": "text", - "value": " in the transcoded ", - "position": { - "start": { "line": 5341, "column": 9, "offset": 142185 }, - "end": { "line": 5341, "column": 28, "offset": 142204 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 5341, "column": 28, "offset": 142204 }, - "end": { "line": 5341, "column": 36, "offset": 142212 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 5341, "column": 36, "offset": 142212 }, - "end": { "line": 5341, "column": 37, "offset": 142213 } - } - } - ], - "position": { - "start": { "line": 5340, "column": 1, "offset": 142100 }, - "end": { "line": 5341, "column": 37, "offset": 142213 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "text", - "value": "Buffer constants", - "position": { - "start": { "line": 5343, "column": 5, "offset": 142219 }, - "end": { "line": 5343, "column": 21, "offset": 142235 } - } - } - ], - "position": { - "start": { "line": 5343, "column": 1, "offset": 142215 }, - "end": { "line": 5343, "column": 21, "offset": 142235 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 5345, "column": 1, "offset": 142237 }, - "end": { "line": 5347, "column": 4, "offset": 142264 } - } - }, - { - "type": "heading", - "depth": 4, - "children": [ - { - "type": "inlineCode", - "value": "buffer.constants.MAX_LENGTH", - "position": { - "start": { "line": 5349, "column": 6, "offset": 142271 }, - "end": { "line": 5349, "column": 35, "offset": 142300 } - } - } - ], - "position": { - "start": { "line": 5349, "column": 1, "offset": 142266 }, - "end": { "line": 5349, "column": 35, "offset": 142300 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 5351, "column": 1, "offset": 142302 }, - "end": { "line": 5366, "column": 4, "offset": 142844 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "{integer} The largest size allowed for a single ", - "position": { - "start": { "line": 5368, "column": 3, "offset": 142848 }, - "end": { "line": 5368, "column": 51, "offset": 142896 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 5368, "column": 51, "offset": 142896 }, - "end": { "line": 5368, "column": 59, "offset": 142904 } - } - }, - { - "type": "text", - "value": " instance.", - "position": { - "start": { "line": 5368, "column": 59, "offset": 142904 }, - "end": { "line": 5368, "column": 69, "offset": 142914 } - } - } - ], - "position": { - "start": { "line": 5368, "column": 3, "offset": 142848 }, - "end": { "line": 5368, "column": 69, "offset": 142914 } - } - } - ], - "position": { - "start": { "line": 5368, "column": 1, "offset": 142846 }, - "end": { "line": 5368, "column": 69, "offset": 142914 } - } - } - ], - "position": { - "start": { "line": 5368, "column": 1, "offset": 142846 }, - "end": { "line": 5368, "column": 69, "offset": 142914 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "On 32-bit architectures, this value currently is 2", - "position": { - "start": { "line": 5370, "column": 1, "offset": 142916 }, - "end": { "line": 5370, "column": 51, "offset": 142966 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 5370, "column": 51, "offset": 142966 }, - "end": { "line": 5370, "column": 56, "offset": 142971 } - } - }, - { - "type": "text", - "value": "30", - "position": { - "start": { "line": 5370, "column": 56, "offset": 142971 }, - "end": { "line": 5370, "column": 58, "offset": 142973 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 5370, "column": 58, "offset": 142973 }, - "end": { "line": 5370, "column": 64, "offset": 142979 } - } - }, - { - "type": "text", - "value": " - 1 (about 1\nGiB).", - "position": { - "start": { "line": 5370, "column": 64, "offset": 142979 }, - "end": { "line": 5371, "column": 6, "offset": 142998 } - } - } - ], - "position": { - "start": { "line": 5370, "column": 1, "offset": 142916 }, - "end": { "line": 5371, "column": 6, "offset": 142998 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "On 64-bit architectures, this value currently is 2", - "position": { - "start": { "line": 5373, "column": 1, "offset": 143000 }, - "end": { "line": 5373, "column": 51, "offset": 143050 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 5373, "column": 51, "offset": 143050 }, - "end": { "line": 5373, "column": 56, "offset": 143055 } - } - }, - { - "type": "text", - "value": "53", - "position": { - "start": { "line": 5373, "column": 56, "offset": 143055 }, - "end": { "line": 5373, "column": 58, "offset": 143057 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 5373, "column": 58, "offset": 143057 }, - "end": { "line": 5373, "column": 64, "offset": 143063 } - } - }, - { - "type": "text", - "value": " - 1 (about 8 PiB).", - "position": { - "start": { "line": 5373, "column": 64, "offset": 143063 }, - "end": { "line": 5373, "column": 83, "offset": 143082 } - } - } - ], - "position": { - "start": { "line": 5373, "column": 1, "offset": 143000 }, - "end": { "line": 5373, "column": 83, "offset": 143082 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "It reflects ", - "position": { - "start": { "line": 5375, "column": 1, "offset": 143084 }, - "end": { "line": 5375, "column": 13, "offset": 143096 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "v8::TypedArray::kMaxLength", - "position": { - "start": { "line": 5375, "column": 14, "offset": 143097 }, - "end": { "line": 5375, "column": 42, "offset": 143125 } - } - } - ], - "position": { - "start": { "line": 5375, "column": 13, "offset": 143096 }, - "end": { "line": 5375, "column": 45, "offset": 143128 } - }, - "label": "`v8::TypedArray::kMaxLength`", - "identifier": "`v8::typedarray::kmaxlength`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": " under the hood.", - "position": { - "start": { "line": 5375, "column": 45, "offset": 143128 }, - "end": { "line": 5375, "column": 61, "offset": 143144 } - } - } - ], - "position": { - "start": { "line": 5375, "column": 1, "offset": 143084 }, - "end": { "line": 5375, "column": 61, "offset": 143144 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This value is also available as ", - "position": { - "start": { "line": 5377, "column": 1, "offset": 143146 }, - "end": { "line": 5377, "column": 33, "offset": 143178 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "buffer.kMaxLength", - "position": { - "start": { "line": 5377, "column": 34, "offset": 143179 }, - "end": { "line": 5377, "column": 53, "offset": 143198 } - } - } - ], - "position": { - "start": { "line": 5377, "column": 33, "offset": 143178 }, - "end": { "line": 5377, "column": 56, "offset": 143201 } - }, - "label": "`buffer.kMaxLength`", - "identifier": "`buffer.kmaxlength`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 5377, "column": 56, "offset": 143201 }, - "end": { "line": 5377, "column": 57, "offset": 143202 } - } - } - ], - "position": { - "start": { "line": 5377, "column": 1, "offset": 143146 }, - "end": { "line": 5377, "column": 57, "offset": 143202 } - } - }, - { - "type": "heading", - "depth": 4, - "children": [ - { - "type": "inlineCode", - "value": "buffer.constants.MAX_STRING_LENGTH", - "position": { - "start": { "line": 5379, "column": 6, "offset": 143209 }, - "end": { "line": 5379, "column": 42, "offset": 143245 } - } - } - ], - "position": { - "start": { "line": 5379, "column": 1, "offset": 143204 }, - "end": { "line": 5379, "column": 42, "offset": 143245 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 5381, "column": 1, "offset": 143247 }, - "end": { "line": 5383, "column": 4, "offset": 143274 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "{integer} The largest length allowed for a single ", - "position": { - "start": { "line": 5385, "column": 3, "offset": 143278 }, - "end": { "line": 5385, "column": 53, "offset": 143328 } - } - }, - { - "type": "inlineCode", - "value": "string", - "position": { - "start": { "line": 5385, "column": 53, "offset": 143328 }, - "end": { "line": 5385, "column": 61, "offset": 143336 } - } - }, - { - "type": "text", - "value": " instance.", - "position": { - "start": { "line": 5385, "column": 61, "offset": 143336 }, - "end": { "line": 5385, "column": 71, "offset": 143346 } - } - } - ], - "position": { - "start": { "line": 5385, "column": 3, "offset": 143278 }, - "end": { "line": 5385, "column": 71, "offset": 143346 } - } - } - ], - "position": { - "start": { "line": 5385, "column": 1, "offset": 143276 }, - "end": { "line": 5385, "column": 71, "offset": 143346 } - } - } - ], - "position": { - "start": { "line": 5385, "column": 1, "offset": 143276 }, - "end": { "line": 5385, "column": 71, "offset": 143346 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Represents the largest ", - "position": { - "start": { "line": 5387, "column": 1, "offset": 143348 }, - "end": { "line": 5387, "column": 24, "offset": 143371 } - } - }, - { - "type": "inlineCode", - "value": "length", - "position": { - "start": { "line": 5387, "column": 24, "offset": 143371 }, - "end": { "line": 5387, "column": 32, "offset": 143379 } - } - }, - { - "type": "text", - "value": " that a ", - "position": { - "start": { "line": 5387, "column": 32, "offset": 143379 }, - "end": { "line": 5387, "column": 40, "offset": 143387 } - } - }, - { - "type": "inlineCode", - "value": "string", - "position": { - "start": { "line": 5387, "column": 40, "offset": 143387 }, - "end": { "line": 5387, "column": 48, "offset": 143395 } - } - }, - { - "type": "text", - "value": " primitive can have, counted\nin UTF-16 code units.", - "position": { - "start": { "line": 5387, "column": 48, "offset": 143395 }, - "end": { "line": 5388, "column": 22, "offset": 143445 } - } - } - ], - "position": { - "start": { "line": 5387, "column": 1, "offset": 143348 }, - "end": { "line": 5388, "column": 22, "offset": 143445 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This value may depend on the JS engine that is being used.", - "position": { - "start": { "line": 5390, "column": 1, "offset": 143447 }, - "end": { "line": 5390, "column": 59, "offset": 143505 } - } - } - ], - "position": { - "start": { "line": 5390, "column": 1, "offset": 143447 }, - "end": { "line": 5390, "column": 59, "offset": 143505 } - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "inlineCode", - "value": "Buffer.from()", - "position": { - "start": { "line": 5392, "column": 4, "offset": 143510 }, - "end": { "line": 5392, "column": 19, "offset": 143525 } - } - }, - { - "type": "text", - "value": ", ", - "position": { - "start": { "line": 5392, "column": 19, "offset": 143525 }, - "end": { "line": 5392, "column": 21, "offset": 143527 } - } - }, - { - "type": "inlineCode", - "value": "Buffer.alloc()", - "position": { - "start": { "line": 5392, "column": 21, "offset": 143527 }, - "end": { "line": 5392, "column": 37, "offset": 143543 } - } - }, - { - "type": "text", - "value": ", and ", - "position": { - "start": { "line": 5392, "column": 37, "offset": 143543 }, - "end": { "line": 5392, "column": 43, "offset": 143549 } - } - }, - { - "type": "inlineCode", - "value": "Buffer.allocUnsafe()", - "position": { - "start": { "line": 5392, "column": 43, "offset": 143549 }, - "end": { "line": 5392, "column": 65, "offset": 143571 } - } - } - ], - "position": { - "start": { "line": 5392, "column": 1, "offset": 143507 }, - "end": { "line": 5392, "column": 65, "offset": 143571 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "In versions of Node.js prior to 6.0.0, ", - "position": { - "start": { "line": 5394, "column": 1, "offset": 143573 }, - "end": { "line": 5394, "column": 40, "offset": 143612 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 5394, "column": 40, "offset": 143612 }, - "end": { "line": 5394, "column": 48, "offset": 143620 } - } - }, - { - "type": "text", - "value": " instances were created using the\n", - "position": { - "start": { "line": 5394, "column": 48, "offset": 143620 }, - "end": { "line": 5395, "column": 1, "offset": 143654 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 5395, "column": 1, "offset": 143654 }, - "end": { "line": 5395, "column": 9, "offset": 143662 } - } - }, - { - "type": "text", - "value": " constructor function, which allocates the returned ", - "position": { - "start": { "line": 5395, "column": 9, "offset": 143662 }, - "end": { "line": 5395, "column": 61, "offset": 143714 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 5395, "column": 61, "offset": 143714 }, - "end": { "line": 5395, "column": 69, "offset": 143722 } - } - }, - { - "type": "text", - "value": "\ndifferently based on what arguments are provided:", - "position": { - "start": { "line": 5395, "column": 69, "offset": 143722 }, - "end": { "line": 5396, "column": 50, "offset": 143772 } - } - } - ], - "position": { - "start": { "line": 5394, "column": 1, "offset": 143573 }, - "end": { "line": 5396, "column": 50, "offset": 143772 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Passing a number as the first argument to ", - "position": { - "start": { "line": 5398, "column": 3, "offset": 143776 }, - "end": { "line": 5398, "column": 45, "offset": 143818 } - } - }, - { - "type": "inlineCode", - "value": "Buffer()", - "position": { - "start": { "line": 5398, "column": 45, "offset": 143818 }, - "end": { "line": 5398, "column": 55, "offset": 143828 } - } - }, - { - "type": "text", - "value": " (e.g. ", - "position": { - "start": { "line": 5398, "column": 55, "offset": 143828 }, - "end": { "line": 5398, "column": 62, "offset": 143835 } - } - }, - { - "type": "inlineCode", - "value": "new Buffer(10)", - "position": { - "start": { "line": 5398, "column": 62, "offset": 143835 }, - "end": { "line": 5398, "column": 78, "offset": 143851 } - } - }, - { - "type": "text", - "value": ")\nallocates a new ", - "position": { - "start": { "line": 5398, "column": 78, "offset": 143851 }, - "end": { "line": 5399, "column": 19, "offset": 143871 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 5399, "column": 19, "offset": 143871 }, - "end": { "line": 5399, "column": 27, "offset": 143879 } - } - }, - { - "type": "text", - "value": " object of the specified size. Prior to Node.js 8.0.0,\nthe memory allocated for such ", - "position": { - "start": { "line": 5399, "column": 27, "offset": 143879 }, - "end": { "line": 5400, "column": 33, "offset": 143966 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 5400, "column": 33, "offset": 143966 }, - "end": { "line": 5400, "column": 41, "offset": 143974 } - } - }, - { - "type": "text", - "value": " instances is ", - "position": { - "start": { "line": 5400, "column": 41, "offset": 143974 }, - "end": { "line": 5400, "column": 55, "offset": 143988 } - } - }, - { - "type": "emphasis", - "children": [ - { - "type": "text", - "value": "not", - "position": { - "start": { - "line": 5400, - "column": 56, - "offset": 143989 - }, - "end": { "line": 5400, "column": 59, "offset": 143992 } - } - } - ], - "position": { - "start": { "line": 5400, "column": 55, "offset": 143988 }, - "end": { "line": 5400, "column": 60, "offset": 143993 } - } - }, - { - "type": "text", - "value": " initialized and\n", - "position": { - "start": { "line": 5400, "column": 60, "offset": 143993 }, - "end": { "line": 5401, "column": 1, "offset": 144010 } - } - }, - { - "type": "emphasis", - "children": [ - { - "type": "text", - "value": "can contain sensitive data", - "position": { - "start": { - "line": 5401, - "column": 4, - "offset": 144013 - }, - "end": { "line": 5401, "column": 30, "offset": 144039 } - } - } - ], - "position": { - "start": { "line": 5401, "column": 3, "offset": 144012 }, - "end": { "line": 5401, "column": 31, "offset": 144040 } - } - }, - { - "type": "text", - "value": ". Such ", - "position": { - "start": { "line": 5401, "column": 31, "offset": 144040 }, - "end": { "line": 5401, "column": 38, "offset": 144047 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 5401, "column": 38, "offset": 144047 }, - "end": { "line": 5401, "column": 46, "offset": 144055 } - } - }, - { - "type": "text", - "value": " instances ", - "position": { - "start": { "line": 5401, "column": 46, "offset": 144055 }, - "end": { "line": 5401, "column": 57, "offset": 144066 } - } - }, - { - "type": "emphasis", - "children": [ - { - "type": "text", - "value": "must", - "position": { - "start": { - "line": 5401, - "column": 58, - "offset": 144067 - }, - "end": { "line": 5401, "column": 62, "offset": 144071 } - } - } - ], - "position": { - "start": { "line": 5401, "column": 57, "offset": 144066 }, - "end": { "line": 5401, "column": 63, "offset": 144072 } - } - }, - { - "type": "text", - "value": " be subsequently\ninitialized by using either ", - "position": { - "start": { "line": 5401, "column": 63, "offset": 144072 }, - "end": { "line": 5402, "column": 31, "offset": 144119 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "buf.fill(0)", - "position": { - "start": { - "line": 5402, - "column": 32, - "offset": 144120 - }, - "end": { "line": 5402, "column": 45, "offset": 144133 } - } - } - ], - "position": { - "start": { "line": 5402, "column": 31, "offset": 144119 }, - "end": { "line": 5402, "column": 60, "offset": 144148 } - }, - "label": "`buf.fill()`", - "identifier": "`buf.fill()`", - "referenceType": "full" - }, - { - "type": "text", - "value": " or by writing to the\nentire ", - "position": { - "start": { "line": 5402, "column": 60, "offset": 144148 }, - "end": { "line": 5403, "column": 10, "offset": 144179 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 5403, "column": 10, "offset": 144179 }, - "end": { "line": 5403, "column": 18, "offset": 144187 } - } - }, - { - "type": "text", - "value": " before reading data from the ", - "position": { - "start": { "line": 5403, "column": 18, "offset": 144187 }, - "end": { "line": 5403, "column": 48, "offset": 144217 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 5403, "column": 48, "offset": 144217 }, - "end": { "line": 5403, "column": 56, "offset": 144225 } - } - }, - { - "type": "text", - "value": ".\nWhile this behavior is ", - "position": { - "start": { "line": 5403, "column": 56, "offset": 144225 }, - "end": { "line": 5404, "column": 26, "offset": 144252 } - } - }, - { - "type": "emphasis", - "children": [ - { - "type": "text", - "value": "intentional", - "position": { - "start": { - "line": 5404, - "column": 27, - "offset": 144253 - }, - "end": { "line": 5404, "column": 38, "offset": 144264 } - } - } - ], - "position": { - "start": { "line": 5404, "column": 26, "offset": 144252 }, - "end": { "line": 5404, "column": 39, "offset": 144265 } - } - }, - { - "type": "text", - "value": " to improve performance,\ndevelopment experience has demonstrated that a more explicit distinction is\nrequired between creating a fast-but-uninitialized ", - "position": { - "start": { "line": 5404, "column": 39, "offset": 144265 }, - "end": { "line": 5406, "column": 54, "offset": 144421 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 5406, "column": 54, "offset": 144421 }, - "end": { "line": 5406, "column": 62, "offset": 144429 } - } - }, - { - "type": "text", - "value": " versus creating a\nslower-but-safer ", - "position": { - "start": { "line": 5406, "column": 62, "offset": 144429 }, - "end": { "line": 5407, "column": 20, "offset": 144467 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 5407, "column": 20, "offset": 144467 }, - "end": { "line": 5407, "column": 28, "offset": 144475 } - } - }, - { - "type": "text", - "value": ". Since Node.js 8.0.0, ", - "position": { - "start": { "line": 5407, "column": 28, "offset": 144475 }, - "end": { "line": 5407, "column": 51, "offset": 144498 } - } - }, - { - "type": "inlineCode", - "value": "Buffer(num)", - "position": { - "start": { "line": 5407, "column": 51, "offset": 144498 }, - "end": { "line": 5407, "column": 64, "offset": 144511 } - } - }, - { - "type": "text", - "value": " and ", - "position": { - "start": { "line": 5407, "column": 64, "offset": 144511 }, - "end": { "line": 5407, "column": 69, "offset": 144516 } - } - }, - { - "type": "inlineCode", - "value": "new\nBuffer(num)", - "position": { - "start": { "line": 5407, "column": 69, "offset": 144516 }, - "end": { "line": 5408, "column": 15, "offset": 144535 } - } - }, - { - "type": "text", - "value": " return a ", - "position": { - "start": { "line": 5408, "column": 15, "offset": 144535 }, - "end": { "line": 5408, "column": 25, "offset": 144545 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 5408, "column": 25, "offset": 144545 }, - "end": { "line": 5408, "column": 33, "offset": 144553 } - } - }, - { - "type": "text", - "value": " with initialized memory.", - "position": { - "start": { "line": 5408, "column": 33, "offset": 144553 }, - "end": { "line": 5408, "column": 58, "offset": 144578 } - } - } - ], - "position": { - "start": { "line": 5398, "column": 3, "offset": 143776 }, - "end": { "line": 5408, "column": 58, "offset": 144578 } - } - } - ], - "position": { - "start": { "line": 5398, "column": 1, "offset": 143774 }, - "end": { "line": 5408, "column": 58, "offset": 144578 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Passing a string, array, or ", - "position": { - "start": { "line": 5409, "column": 3, "offset": 144581 }, - "end": { "line": 5409, "column": 31, "offset": 144609 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 5409, "column": 31, "offset": 144609 }, - "end": { "line": 5409, "column": 39, "offset": 144617 } - } - }, - { - "type": "text", - "value": " as the first argument copies the\npassed object's data into the ", - "position": { - "start": { "line": 5409, "column": 39, "offset": 144617 }, - "end": { "line": 5410, "column": 33, "offset": 144683 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 5410, "column": 33, "offset": 144683 }, - "end": { "line": 5410, "column": 41, "offset": 144691 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 5410, "column": 41, "offset": 144691 }, - "end": { "line": 5410, "column": 42, "offset": 144692 } - } - } - ], - "position": { - "start": { "line": 5409, "column": 3, "offset": 144581 }, - "end": { "line": 5410, "column": 42, "offset": 144692 } - } - } - ], - "position": { - "start": { "line": 5409, "column": 1, "offset": 144579 }, - "end": { "line": 5410, "column": 42, "offset": 144692 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Passing an {ArrayBuffer} or a {SharedArrayBuffer} returns a ", - "position": { - "start": { "line": 5411, "column": 3, "offset": 144695 }, - "end": { "line": 5411, "column": 63, "offset": 144755 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 5411, "column": 63, "offset": 144755 }, - "end": { "line": 5411, "column": 71, "offset": 144763 } - } - }, - { - "type": "text", - "value": "\nthat shares allocated memory with the given array buffer.", - "position": { - "start": { "line": 5411, "column": 71, "offset": 144763 }, - "end": { "line": 5412, "column": 60, "offset": 144823 } - } - } - ], - "position": { - "start": { "line": 5411, "column": 3, "offset": 144695 }, - "end": { "line": 5412, "column": 60, "offset": 144823 } - } - } - ], - "position": { - "start": { "line": 5411, "column": 1, "offset": 144693 }, - "end": { "line": 5412, "column": 60, "offset": 144823 } - } - } - ], - "position": { - "start": { "line": 5398, "column": 1, "offset": 143774 }, - "end": { "line": 5412, "column": 60, "offset": 144823 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Because the behavior of ", - "position": { - "start": { "line": 5414, "column": 1, "offset": 144825 }, - "end": { "line": 5414, "column": 25, "offset": 144849 } - } - }, - { - "type": "inlineCode", - "value": "new Buffer()", - "position": { - "start": { "line": 5414, "column": 25, "offset": 144849 }, - "end": { "line": 5414, "column": 39, "offset": 144863 } - } - }, - { - "type": "text", - "value": " is different depending on the type of the\nfirst argument, security and reliability issues can be inadvertently introduced\ninto applications when argument validation or ", - "position": { - "start": { "line": 5414, "column": 39, "offset": 144863 }, - "end": { "line": 5416, "column": 47, "offset": 145032 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 5416, "column": 47, "offset": 145032 }, - "end": { "line": 5416, "column": 55, "offset": 145040 } - } - }, - { - "type": "text", - "value": " initialization is not\nperformed.", - "position": { - "start": { "line": 5416, "column": 55, "offset": 145040 }, - "end": { "line": 5417, "column": 11, "offset": 145073 } - } - } - ], - "position": { - "start": { "line": 5414, "column": 1, "offset": 144825 }, - "end": { "line": 5417, "column": 11, "offset": 145073 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "For example, if an attacker can cause an application to receive a number where\na string is expected, the application may call ", - "position": { - "start": { "line": 5419, "column": 1, "offset": 145075 }, - "end": { "line": 5420, "column": 48, "offset": 145201 } - } - }, - { - "type": "inlineCode", - "value": "new Buffer(100)", - "position": { - "start": { "line": 5420, "column": 48, "offset": 145201 }, - "end": { "line": 5420, "column": 65, "offset": 145218 } - } - }, - { - "type": "text", - "value": "\ninstead of ", - "position": { - "start": { "line": 5420, "column": 65, "offset": 145218 }, - "end": { "line": 5421, "column": 12, "offset": 145230 } - } - }, - { - "type": "inlineCode", - "value": "new Buffer(\"100\")", - "position": { - "start": { "line": 5421, "column": 12, "offset": 145230 }, - "end": { "line": 5421, "column": 31, "offset": 145249 } - } - }, - { - "type": "text", - "value": ", leading it to allocate a 100 byte buffer instead\nof allocating a 3 byte buffer with content ", - "position": { - "start": { "line": 5421, "column": 31, "offset": 145249 }, - "end": { "line": 5422, "column": 44, "offset": 145343 } - } - }, - { - "type": "inlineCode", - "value": "\"100\"", - "position": { - "start": { "line": 5422, "column": 44, "offset": 145343 }, - "end": { "line": 5422, "column": 51, "offset": 145350 } - } - }, - { - "type": "text", - "value": ". This is commonly possible\nusing JSON API calls. Since JSON distinguishes between numeric and string types,\nit allows injection of numbers where a naively written application that does not\nvalidate its input sufficiently might expect to always receive a string.\nBefore Node.js 8.0.0, the 100 byte buffer might contain\narbitrary pre-existing in-memory data, so may be used to expose in-memory\nsecrets to a remote attacker. Since Node.js 8.0.0, exposure of memory cannot\noccur because the data is zero-filled. However, other attacks are still\npossible, such as causing very large buffers to be allocated by the server,\nleading to performance degradation or crashing on memory exhaustion.", - "position": { - "start": { "line": 5422, "column": 51, "offset": 145350 }, - "end": { "line": 5431, "column": 69, "offset": 146036 } - } - } - ], - "position": { - "start": { "line": 5419, "column": 1, "offset": 145075 }, - "end": { "line": 5431, "column": 69, "offset": 146036 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "To make the creation of ", - "position": { - "start": { "line": 5433, "column": 1, "offset": 146038 }, - "end": { "line": 5433, "column": 25, "offset": 146062 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 5433, "column": 25, "offset": 146062 }, - "end": { "line": 5433, "column": 33, "offset": 146070 } - } - }, - { - "type": "text", - "value": " instances more reliable and less error-prone,\nthe various forms of the ", - "position": { - "start": { "line": 5433, "column": 33, "offset": 146070 }, - "end": { "line": 5434, "column": 26, "offset": 146142 } - } - }, - { - "type": "inlineCode", - "value": "new Buffer()", - "position": { - "start": { "line": 5434, "column": 26, "offset": 146142 }, - "end": { "line": 5434, "column": 40, "offset": 146156 } - } - }, - { - "type": "text", - "value": " constructor have been ", - "position": { - "start": { "line": 5434, "column": 40, "offset": 146156 }, - "end": { "line": 5434, "column": 63, "offset": 146179 } - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "deprecated", - "position": { - "start": { "line": 5434, "column": 65, "offset": 146181 }, - "end": { "line": 5434, "column": 75, "offset": 146191 } - } - } - ], - "position": { - "start": { "line": 5434, "column": 63, "offset": 146179 }, - "end": { "line": 5434, "column": 77, "offset": 146193 } - } - }, - { - "type": "text", - "value": "\nand replaced by separate ", - "position": { - "start": { "line": 5434, "column": 77, "offset": 146193 }, - "end": { "line": 5435, "column": 26, "offset": 146219 } - } - }, - { - "type": "inlineCode", - "value": "Buffer.from()", - "position": { - "start": { "line": 5435, "column": 26, "offset": 146219 }, - "end": { "line": 5435, "column": 41, "offset": 146234 } - } - }, - { - "type": "text", - "value": ", ", - "position": { - "start": { "line": 5435, "column": 41, "offset": 146234 }, - "end": { "line": 5435, "column": 43, "offset": 146236 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "Buffer.alloc()", - "position": { - "start": { "line": 5435, "column": 44, "offset": 146237 }, - "end": { "line": 5435, "column": 60, "offset": 146253 } - } - } - ], - "position": { - "start": { "line": 5435, "column": 43, "offset": 146236 }, - "end": { "line": 5435, "column": 63, "offset": 146256 } - }, - "label": "`Buffer.alloc()`", - "identifier": "`buffer.alloc()`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": ", and\n", - "position": { - "start": { "line": 5435, "column": 63, "offset": 146256 }, - "end": { "line": 5436, "column": 1, "offset": 146262 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "Buffer.allocUnsafe()", - "position": { - "start": { "line": 5436, "column": 2, "offset": 146263 }, - "end": { "line": 5436, "column": 24, "offset": 146285 } - } - } - ], - "position": { - "start": { "line": 5436, "column": 1, "offset": 146262 }, - "end": { "line": 5436, "column": 27, "offset": 146288 } - }, - "label": "`Buffer.allocUnsafe()`", - "identifier": "`buffer.allocunsafe()`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": " methods.", - "position": { - "start": { "line": 5436, "column": 27, "offset": 146288 }, - "end": { "line": 5436, "column": 36, "offset": 146297 } - } - } - ], - "position": { - "start": { "line": 5433, "column": 1, "offset": 146038 }, - "end": { "line": 5436, "column": 36, "offset": 146297 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "emphasis", - "children": [ - { - "type": "text", - "value": "Developers should migrate all existing uses of the ", - "position": { - "start": { "line": 5438, "column": 2, "offset": 146300 }, - "end": { "line": 5438, "column": 53, "offset": 146351 } - } - }, - { - "type": "inlineCode", - "value": "new Buffer()", - "position": { - "start": { "line": 5438, "column": 53, "offset": 146351 }, - "end": { "line": 5438, "column": 67, "offset": 146365 } - } - }, - { - "type": "text", - "value": " constructors\nto one of these new APIs.", - "position": { - "start": { "line": 5438, "column": 67, "offset": 146365 }, - "end": { "line": 5439, "column": 26, "offset": 146404 } - } - } - ], - "position": { - "start": { "line": 5438, "column": 1, "offset": 146299 }, - "end": { "line": 5439, "column": 27, "offset": 146405 } - } - } - ], - "position": { - "start": { "line": 5438, "column": 1, "offset": 146299 }, - "end": { "line": 5439, "column": 27, "offset": 146405 } - } - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "Buffer.from(array)", - "position": { - "start": { - "line": 5441, - "column": 4, - "offset": 146410 - }, - "end": { "line": 5441, "column": 24, "offset": 146430 } - } - } - ], - "position": { - "start": { "line": 5441, "column": 3, "offset": 146409 }, - "end": { "line": 5441, "column": 27, "offset": 146433 } - }, - "label": "`Buffer.from(array)`", - "identifier": "`buffer.from(array)`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": " returns a new ", - "position": { - "start": { "line": 5441, "column": 27, "offset": 146433 }, - "end": { "line": 5441, "column": 42, "offset": 146448 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 5441, "column": 42, "offset": 146448 }, - "end": { "line": 5441, "column": 50, "offset": 146456 } - } - }, - { - "type": "text", - "value": " that ", - "position": { - "start": { "line": 5441, "column": 50, "offset": 146456 }, - "end": { "line": 5441, "column": 56, "offset": 146462 } - } - }, - { - "type": "emphasis", - "children": [ - { - "type": "text", - "value": "contains a copy", - "position": { - "start": { - "line": 5441, - "column": 57, - "offset": 146463 - }, - "end": { "line": 5441, "column": 72, "offset": 146478 } - } - } - ], - "position": { - "start": { "line": 5441, "column": 56, "offset": 146462 }, - "end": { "line": 5441, "column": 73, "offset": 146479 } - } - }, - { - "type": "text", - "value": " of the\nprovided octets.", - "position": { - "start": { "line": 5441, "column": 73, "offset": 146479 }, - "end": { "line": 5442, "column": 19, "offset": 146505 } - } - } - ], - "position": { - "start": { "line": 5441, "column": 3, "offset": 146409 }, - "end": { "line": 5442, "column": 19, "offset": 146505 } - } - } - ], - "position": { - "start": { "line": 5441, "column": 1, "offset": 146407 }, - "end": { "line": 5442, "column": 19, "offset": 146505 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "Buffer.from(arrayBuffer[, byteOffset[, length]])", - "position": { - "start": { - "line": 5443, - "column": 4, - "offset": 146509 - }, - "end": { "line": 5443, "column": 54, "offset": 146559 } - } - } - ], - "position": { - "start": { "line": 5443, "column": 3, "offset": 146508 }, - "end": { "line": 5443, "column": 80, "offset": 146585 } - }, - "label": "`Buffer.from(arrayBuf)`", - "identifier": "`buffer.from(arraybuf)`", - "referenceType": "full" - }, - { - "type": "text", - "value": "\nreturns a new ", - "position": { - "start": { "line": 5443, "column": 80, "offset": 146585 }, - "end": { "line": 5444, "column": 17, "offset": 146602 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 5444, "column": 17, "offset": 146602 }, - "end": { "line": 5444, "column": 25, "offset": 146610 } - } - }, - { - "type": "text", - "value": " that ", - "position": { - "start": { "line": 5444, "column": 25, "offset": 146610 }, - "end": { "line": 5444, "column": 31, "offset": 146616 } - } - }, - { - "type": "emphasis", - "children": [ - { - "type": "text", - "value": "shares the same allocated memory", - "position": { - "start": { - "line": 5444, - "column": 32, - "offset": 146617 - }, - "end": { "line": 5444, "column": 64, "offset": 146649 } - } - } - ], - "position": { - "start": { "line": 5444, "column": 31, "offset": 146616 }, - "end": { "line": 5444, "column": 65, "offset": 146650 } - } - }, - { - "type": "text", - "value": " as the given\n{ArrayBuffer}.", - "position": { - "start": { "line": 5444, "column": 65, "offset": 146650 }, - "end": { "line": 5445, "column": 17, "offset": 146680 } - } - } - ], - "position": { - "start": { "line": 5443, "column": 3, "offset": 146508 }, - "end": { "line": 5445, "column": 17, "offset": 146680 } - } - } - ], - "position": { - "start": { "line": 5443, "column": 1, "offset": 146506 }, - "end": { "line": 5445, "column": 17, "offset": 146680 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "Buffer.from(buffer)", - "position": { - "start": { - "line": 5446, - "column": 4, - "offset": 146684 - }, - "end": { "line": 5446, "column": 25, "offset": 146705 } - } - } - ], - "position": { - "start": { "line": 5446, "column": 3, "offset": 146683 }, - "end": { "line": 5446, "column": 28, "offset": 146708 } - }, - "label": "`Buffer.from(buffer)`", - "identifier": "`buffer.from(buffer)`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": " returns a new ", - "position": { - "start": { "line": 5446, "column": 28, "offset": 146708 }, - "end": { "line": 5446, "column": 43, "offset": 146723 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 5446, "column": 43, "offset": 146723 }, - "end": { "line": 5446, "column": 51, "offset": 146731 } - } - }, - { - "type": "text", - "value": " that ", - "position": { - "start": { "line": 5446, "column": 51, "offset": 146731 }, - "end": { "line": 5446, "column": 57, "offset": 146737 } - } - }, - { - "type": "emphasis", - "children": [ - { - "type": "text", - "value": "contains a copy", - "position": { - "start": { - "line": 5446, - "column": 58, - "offset": 146738 - }, - "end": { "line": 5446, "column": 73, "offset": 146753 } - } - } - ], - "position": { - "start": { "line": 5446, "column": 57, "offset": 146737 }, - "end": { "line": 5446, "column": 74, "offset": 146754 } - } - }, - { - "type": "text", - "value": " of the\ncontents of the given ", - "position": { - "start": { "line": 5446, "column": 74, "offset": 146754 }, - "end": { "line": 5447, "column": 25, "offset": 146786 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 5447, "column": 25, "offset": 146786 }, - "end": { "line": 5447, "column": 33, "offset": 146794 } - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 5447, "column": 33, "offset": 146794 }, - "end": { "line": 5447, "column": 34, "offset": 146795 } - } - } - ], - "position": { - "start": { "line": 5446, "column": 3, "offset": 146683 }, - "end": { "line": 5447, "column": 34, "offset": 146795 } - } - } - ], - "position": { - "start": { "line": 5446, "column": 1, "offset": 146681 }, - "end": { "line": 5447, "column": 34, "offset": 146795 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "Buffer.from(string[, encoding])", - "position": { - "start": { - "line": 5448, - "column": 4, - "offset": 146799 - }, - "end": { "line": 5448, "column": 37, "offset": 146832 } - } - } - ], - "position": { - "start": { "line": 5448, "column": 3, "offset": 146798 }, - "end": { "line": 5448, "column": 61, "offset": 146856 } - }, - "label": "`Buffer.from(string)`", - "identifier": "`buffer.from(string)`", - "referenceType": "full" - }, - { - "type": "text", - "value": " returns a new\n", - "position": { - "start": { "line": 5448, "column": 61, "offset": 146856 }, - "end": { "line": 5449, "column": 1, "offset": 146871 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 5449, "column": 3, "offset": 146873 }, - "end": { "line": 5449, "column": 11, "offset": 146881 } - } - }, - { - "type": "text", - "value": " that ", - "position": { - "start": { "line": 5449, "column": 11, "offset": 146881 }, - "end": { "line": 5449, "column": 17, "offset": 146887 } - } - }, - { - "type": "emphasis", - "children": [ - { - "type": "text", - "value": "contains a copy", - "position": { - "start": { - "line": 5449, - "column": 18, - "offset": 146888 - }, - "end": { "line": 5449, "column": 33, "offset": 146903 } - } - } - ], - "position": { - "start": { "line": 5449, "column": 17, "offset": 146887 }, - "end": { "line": 5449, "column": 34, "offset": 146904 } - } - }, - { - "type": "text", - "value": " of the provided string.", - "position": { - "start": { "line": 5449, "column": 34, "offset": 146904 }, - "end": { "line": 5449, "column": 58, "offset": 146928 } - } - } - ], - "position": { - "start": { "line": 5448, "column": 3, "offset": 146798 }, - "end": { "line": 5449, "column": 58, "offset": 146928 } - } - } - ], - "position": { - "start": { "line": 5448, "column": 1, "offset": 146796 }, - "end": { "line": 5449, "column": 58, "offset": 146928 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "Buffer.alloc(size[, fill[, encoding]])", - "position": { - "start": { - "line": 5450, - "column": 4, - "offset": 146932 - }, - "end": { "line": 5450, "column": 44, "offset": 146972 } - } - } - ], - "position": { - "start": { "line": 5450, "column": 3, "offset": 146931 }, - "end": { "line": 5450, "column": 63, "offset": 146991 } - }, - "label": "`Buffer.alloc()`", - "identifier": "`buffer.alloc()`", - "referenceType": "full" - }, - { - "type": "text", - "value": " returns a new\ninitialized ", - "position": { - "start": { "line": 5450, "column": 63, "offset": 146991 }, - "end": { "line": 5451, "column": 15, "offset": 147020 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 5451, "column": 15, "offset": 147020 }, - "end": { "line": 5451, "column": 23, "offset": 147028 } - } - }, - { - "type": "text", - "value": " of the specified size. This method is slower than\n", - "position": { - "start": { "line": 5451, "column": 23, "offset": 147028 }, - "end": { "line": 5452, "column": 1, "offset": 147079 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "Buffer.allocUnsafe(size)", - "position": { - "start": { - "line": 5452, - "column": 4, - "offset": 147082 - }, - "end": { "line": 5452, "column": 30, "offset": 147108 } - } - } - ], - "position": { - "start": { "line": 5452, "column": 3, "offset": 147081 }, - "end": { "line": 5452, "column": 55, "offset": 147133 } - }, - "label": "`Buffer.allocUnsafe()`", - "identifier": "`buffer.allocunsafe()`", - "referenceType": "full" - }, - { - "type": "text", - "value": " but guarantees that newly\ncreated ", - "position": { - "start": { "line": 5452, "column": 55, "offset": 147133 }, - "end": { "line": 5453, "column": 11, "offset": 147170 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 5453, "column": 11, "offset": 147170 }, - "end": { "line": 5453, "column": 19, "offset": 147178 } - } - }, - { - "type": "text", - "value": " instances never contain old data that is potentially\nsensitive. A ", - "position": { - "start": { "line": 5453, "column": 19, "offset": 147178 }, - "end": { "line": 5454, "column": 16, "offset": 147247 } - } - }, - { - "type": "inlineCode", - "value": "TypeError", - "position": { - "start": { "line": 5454, "column": 16, "offset": 147247 }, - "end": { "line": 5454, "column": 27, "offset": 147258 } - } - }, - { - "type": "text", - "value": " will be thrown if ", - "position": { - "start": { "line": 5454, "column": 27, "offset": 147258 }, - "end": { "line": 5454, "column": 46, "offset": 147277 } - } - }, - { - "type": "inlineCode", - "value": "size", - "position": { - "start": { "line": 5454, "column": 46, "offset": 147277 }, - "end": { "line": 5454, "column": 52, "offset": 147283 } - } - }, - { - "type": "text", - "value": " is not a number.", - "position": { - "start": { "line": 5454, "column": 52, "offset": 147283 }, - "end": { "line": 5454, "column": 69, "offset": 147300 } - } - } - ], - "position": { - "start": { "line": 5450, "column": 3, "offset": 146931 }, - "end": { "line": 5454, "column": 69, "offset": 147300 } - } - } - ], - "position": { - "start": { "line": 5450, "column": 1, "offset": 146929 }, - "end": { "line": 5454, "column": 69, "offset": 147300 } - } - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "Buffer.allocUnsafe(size)", - "position": { - "start": { - "line": 5455, - "column": 4, - "offset": 147304 - }, - "end": { "line": 5455, "column": 30, "offset": 147330 } - } - } - ], - "position": { - "start": { "line": 5455, "column": 3, "offset": 147303 }, - "end": { "line": 5455, "column": 55, "offset": 147355 } - }, - "label": "`Buffer.allocUnsafe()`", - "identifier": "`buffer.allocunsafe()`", - "referenceType": "full" - }, - { - "type": "text", - "value": " and\n", - "position": { - "start": { "line": 5455, "column": 55, "offset": 147355 }, - "end": { "line": 5456, "column": 1, "offset": 147360 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "Buffer.allocUnsafeSlow(size)", - "position": { - "start": { - "line": 5456, - "column": 4, - "offset": 147363 - }, - "end": { "line": 5456, "column": 34, "offset": 147393 } - } - } - ], - "position": { - "start": { "line": 5456, "column": 3, "offset": 147362 }, - "end": { "line": 5456, "column": 63, "offset": 147422 } - }, - "label": "`Buffer.allocUnsafeSlow()`", - "identifier": "`buffer.allocunsafeslow()`", - "referenceType": "full" - }, - { - "type": "text", - "value": " each return a\nnew uninitialized ", - "position": { - "start": { "line": 5456, "column": 63, "offset": 147422 }, - "end": { "line": 5457, "column": 21, "offset": 147457 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 5457, "column": 21, "offset": 147457 }, - "end": { "line": 5457, "column": 29, "offset": 147465 } - } - }, - { - "type": "text", - "value": " of the specified ", - "position": { - "start": { "line": 5457, "column": 29, "offset": 147465 }, - "end": { "line": 5457, "column": 47, "offset": 147483 } - } - }, - { - "type": "inlineCode", - "value": "size", - "position": { - "start": { "line": 5457, "column": 47, "offset": 147483 }, - "end": { "line": 5457, "column": 53, "offset": 147489 } - } - }, - { - "type": "text", - "value": ". Because the ", - "position": { - "start": { "line": 5457, "column": 53, "offset": 147489 }, - "end": { "line": 5457, "column": 67, "offset": 147503 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 5457, "column": 67, "offset": 147503 }, - "end": { "line": 5457, "column": 75, "offset": 147511 } - } - }, - { - "type": "text", - "value": " is\nuninitialized, the allocated segment of memory might contain old data that is\npotentially sensitive.", - "position": { - "start": { "line": 5457, "column": 75, "offset": 147511 }, - "end": { "line": 5459, "column": 25, "offset": 147619 } - } - } - ], - "position": { - "start": { "line": 5455, "column": 3, "offset": 147303 }, - "end": { "line": 5459, "column": 25, "offset": 147619 } - } - } - ], - "position": { - "start": { "line": 5455, "column": 1, "offset": 147301 }, - "end": { "line": 5459, "column": 25, "offset": 147619 } - } - } - ], - "position": { - "start": { "line": 5441, "column": 1, "offset": 146407 }, - "end": { "line": 5459, "column": 25, "offset": 147619 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 5461, "column": 1, "offset": 147621 }, - "end": { "line": 5461, "column": 9, "offset": 147629 } - } - }, - { - "type": "text", - "value": " instances returned by ", - "position": { - "start": { "line": 5461, "column": 9, "offset": 147629 }, - "end": { "line": 5461, "column": 32, "offset": 147652 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "Buffer.allocUnsafe()", - "position": { - "start": { "line": 5461, "column": 33, "offset": 147653 }, - "end": { "line": 5461, "column": 55, "offset": 147675 } - } - } - ], - "position": { - "start": { "line": 5461, "column": 32, "offset": 147652 }, - "end": { "line": 5461, "column": 58, "offset": 147678 } - }, - "label": "`Buffer.allocUnsafe()`", - "identifier": "`buffer.allocunsafe()`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": ", ", - "position": { - "start": { "line": 5461, "column": 58, "offset": 147678 }, - "end": { "line": 5461, "column": 60, "offset": 147680 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "Buffer.from(string)", - "position": { - "start": { "line": 5461, "column": 61, "offset": 147681 }, - "end": { "line": 5461, "column": 82, "offset": 147702 } - } - } - ], - "position": { - "start": { "line": 5461, "column": 60, "offset": 147680 }, - "end": { "line": 5461, "column": 85, "offset": 147705 } - }, - "label": "`Buffer.from(string)`", - "identifier": "`buffer.from(string)`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": ",\n", - "position": { - "start": { "line": 5461, "column": 85, "offset": 147705 }, - "end": { "line": 5462, "column": 1, "offset": 147707 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "Buffer.concat()", - "position": { - "start": { "line": 5462, "column": 2, "offset": 147708 }, - "end": { "line": 5462, "column": 19, "offset": 147725 } - } - } - ], - "position": { - "start": { "line": 5462, "column": 1, "offset": 147707 }, - "end": { "line": 5462, "column": 22, "offset": 147728 } - }, - "label": "`Buffer.concat()`", - "identifier": "`buffer.concat()`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": " and ", - "position": { - "start": { "line": 5462, "column": 22, "offset": 147728 }, - "end": { "line": 5462, "column": 27, "offset": 147733 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "Buffer.from(array)", - "position": { - "start": { "line": 5462, "column": 28, "offset": 147734 }, - "end": { "line": 5462, "column": 48, "offset": 147754 } - } - } - ], - "position": { - "start": { "line": 5462, "column": 27, "offset": 147733 }, - "end": { "line": 5462, "column": 51, "offset": 147757 } - }, - "label": "`Buffer.from(array)`", - "identifier": "`buffer.from(array)`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 5462, "column": 51, "offset": 147757 }, - "end": { "line": 5462, "column": 52, "offset": 147758 } - } - }, - { - "type": "emphasis", - "children": [ - { - "type": "text", - "value": "may", - "position": { - "start": { "line": 5462, "column": 53, "offset": 147759 }, - "end": { "line": 5462, "column": 56, "offset": 147762 } - } - } - ], - "position": { - "start": { "line": 5462, "column": 52, "offset": 147758 }, - "end": { "line": 5462, "column": 57, "offset": 147763 } - } - }, - { - "type": "text", - "value": " be allocated off a shared\ninternal memory pool if ", - "position": { - "start": { "line": 5462, "column": 57, "offset": 147763 }, - "end": { "line": 5463, "column": 25, "offset": 147814 } - } - }, - { - "type": "inlineCode", - "value": "size", - "position": { - "start": { "line": 5463, "column": 25, "offset": 147814 }, - "end": { "line": 5463, "column": 31, "offset": 147820 } - } - }, - { - "type": "text", - "value": " is less than or equal to half ", - "position": { - "start": { "line": 5463, "column": 31, "offset": 147820 }, - "end": { "line": 5463, "column": 62, "offset": 147851 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "Buffer.poolSize", - "position": { - "start": { "line": 5463, "column": 63, "offset": 147852 }, - "end": { "line": 5463, "column": 80, "offset": 147869 } - } - } - ], - "position": { - "start": { "line": 5463, "column": 62, "offset": 147851 }, - "end": { "line": 5463, "column": 83, "offset": 147872 } - }, - "label": "`Buffer.poolSize`", - "identifier": "`buffer.poolsize`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": ".\nInstances returned by ", - "position": { - "start": { "line": 5463, "column": 83, "offset": 147872 }, - "end": { "line": 5464, "column": 23, "offset": 147896 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "Buffer.allocUnsafeSlow()", - "position": { - "start": { "line": 5464, "column": 24, "offset": 147897 }, - "end": { "line": 5464, "column": 50, "offset": 147923 } - } - } - ], - "position": { - "start": { "line": 5464, "column": 23, "offset": 147896 }, - "end": { "line": 5464, "column": 53, "offset": 147926 } - }, - "label": "`Buffer.allocUnsafeSlow()`", - "identifier": "`buffer.allocunsafeslow()`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 5464, "column": 53, "offset": 147926 }, - "end": { "line": 5464, "column": 54, "offset": 147927 } - } - }, - { - "type": "emphasis", - "children": [ - { - "type": "text", - "value": "never", - "position": { - "start": { "line": 5464, "column": 55, "offset": 147928 }, - "end": { "line": 5464, "column": 60, "offset": 147933 } - } - } - ], - "position": { - "start": { "line": 5464, "column": 54, "offset": 147927 }, - "end": { "line": 5464, "column": 61, "offset": 147934 } - } - }, - { - "type": "text", - "value": " use the shared internal\nmemory pool.", - "position": { - "start": { "line": 5464, "column": 61, "offset": 147934 }, - "end": { "line": 5465, "column": 13, "offset": 147971 } - } - } - ], - "position": { - "start": { "line": 5461, "column": 1, "offset": 147621 }, - "end": { "line": 5465, "column": 13, "offset": 147971 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "text", - "value": "The ", - "position": { - "start": { "line": 5467, "column": 5, "offset": 147977 }, - "end": { "line": 5467, "column": 9, "offset": 147981 } - } - }, - { - "type": "inlineCode", - "value": "--zero-fill-buffers", - "position": { - "start": { "line": 5467, "column": 9, "offset": 147981 }, - "end": { "line": 5467, "column": 30, "offset": 148002 } - } - }, - { - "type": "text", - "value": " command-line option", - "position": { - "start": { "line": 5467, "column": 30, "offset": 148002 }, - "end": { "line": 5467, "column": 50, "offset": 148022 } - } - } - ], - "position": { - "start": { "line": 5467, "column": 1, "offset": 147973 }, - "end": { "line": 5467, "column": 50, "offset": 148022 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 5469, "column": 1, "offset": 148024 }, - "end": { "line": 5471, "column": 4, "offset": 148052 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Node.js can be started using the ", - "position": { - "start": { "line": 5473, "column": 1, "offset": 148054 }, - "end": { "line": 5473, "column": 34, "offset": 148087 } - } - }, - { - "type": "inlineCode", - "value": "--zero-fill-buffers", - "position": { - "start": { "line": 5473, "column": 34, "offset": 148087 }, - "end": { "line": 5473, "column": 55, "offset": 148108 } - } - }, - { - "type": "text", - "value": " command-line option to\ncause all newly-allocated ", - "position": { - "start": { "line": 5473, "column": 55, "offset": 148108 }, - "end": { "line": 5474, "column": 27, "offset": 148158 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 5474, "column": 27, "offset": 148158 }, - "end": { "line": 5474, "column": 35, "offset": 148166 } - } - }, - { - "type": "text", - "value": " instances to be zero-filled upon creation by\ndefault. Without the option, buffers created with ", - "position": { - "start": { "line": 5474, "column": 35, "offset": 148166 }, - "end": { "line": 5475, "column": 51, "offset": 148262 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "Buffer.allocUnsafe()", - "position": { - "start": { "line": 5475, "column": 52, "offset": 148263 }, - "end": { "line": 5475, "column": 74, "offset": 148285 } - } - } - ], - "position": { - "start": { "line": 5475, "column": 51, "offset": 148262 }, - "end": { "line": 5475, "column": 77, "offset": 148288 } - }, - "label": "`Buffer.allocUnsafe()`", - "identifier": "`buffer.allocunsafe()`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": " and\n", - "position": { - "start": { "line": 5475, "column": 77, "offset": 148288 }, - "end": { "line": 5476, "column": 1, "offset": 148293 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "Buffer.allocUnsafeSlow()", - "position": { - "start": { "line": 5476, "column": 2, "offset": 148294 }, - "end": { "line": 5476, "column": 28, "offset": 148320 } - } - } - ], - "position": { - "start": { "line": 5476, "column": 1, "offset": 148293 }, - "end": { "line": 5476, "column": 31, "offset": 148323 } - }, - "label": "`Buffer.allocUnsafeSlow()`", - "identifier": "`buffer.allocunsafeslow()`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": " are not zero-filled. Use of this flag can have a\nmeasurable negative impact on performance. Use the ", - "position": { - "start": { "line": 5476, "column": 31, "offset": 148323 }, - "end": { "line": 5477, "column": 52, "offset": 148424 } - } - }, - { - "type": "inlineCode", - "value": "--zero-fill-buffers", - "position": { - "start": { "line": 5477, "column": 52, "offset": 148424 }, - "end": { "line": 5477, "column": 73, "offset": 148445 } - } - }, - { - "type": "text", - "value": " option\nonly when necessary to enforce that newly allocated ", - "position": { - "start": { "line": 5477, "column": 73, "offset": 148445 }, - "end": { "line": 5478, "column": 53, "offset": 148505 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 5478, "column": 53, "offset": 148505 }, - "end": { "line": 5478, "column": 61, "offset": 148513 } - } - }, - { - "type": "text", - "value": " instances cannot\ncontain old data that is potentially sensitive.", - "position": { - "start": { "line": 5478, "column": 61, "offset": 148513 }, - "end": { "line": 5479, "column": 48, "offset": 148578 } - } - } - ], - "position": { - "start": { "line": 5473, "column": 1, "offset": 148054 }, - "end": { "line": 5479, "column": 48, "offset": 148578 } - } - }, - { - "type": "code", - "lang": "console", - "meta": null, - "value": "$ node --zero-fill-buffers\n> Buffer.allocUnsafe(5);\n", - "position": { - "start": { "line": 5481, "column": 1, "offset": 148580 }, - "end": { "line": 5485, "column": 4, "offset": 148670 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "text", - "value": "What makes ", - "position": { - "start": { "line": 5487, "column": 5, "offset": 148676 }, - "end": { "line": 5487, "column": 16, "offset": 148687 } - } - }, - { - "type": "inlineCode", - "value": "Buffer.allocUnsafe()", - "position": { - "start": { "line": 5487, "column": 16, "offset": 148687 }, - "end": { "line": 5487, "column": 38, "offset": 148709 } - } - }, - { - "type": "text", - "value": " and ", - "position": { - "start": { "line": 5487, "column": 38, "offset": 148709 }, - "end": { "line": 5487, "column": 43, "offset": 148714 } - } - }, - { - "type": "inlineCode", - "value": "Buffer.allocUnsafeSlow()", - "position": { - "start": { "line": 5487, "column": 43, "offset": 148714 }, - "end": { "line": 5487, "column": 69, "offset": 148740 } - } - }, - { - "type": "text", - "value": " \"unsafe\"?", - "position": { - "start": { "line": 5487, "column": 69, "offset": 148740 }, - "end": { "line": 5487, "column": 79, "offset": 148750 } - } - } - ], - "position": { - "start": { "line": 5487, "column": 1, "offset": 148672 }, - "end": { "line": 5487, "column": 79, "offset": 148750 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "When calling ", - "position": { - "start": { "line": 5489, "column": 1, "offset": 148752 }, - "end": { "line": 5489, "column": 14, "offset": 148765 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "Buffer.allocUnsafe()", - "position": { - "start": { "line": 5489, "column": 15, "offset": 148766 }, - "end": { "line": 5489, "column": 37, "offset": 148788 } - } - } - ], - "position": { - "start": { "line": 5489, "column": 14, "offset": 148765 }, - "end": { "line": 5489, "column": 40, "offset": 148791 } - }, - "label": "`Buffer.allocUnsafe()`", - "identifier": "`buffer.allocunsafe()`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": " and ", - "position": { - "start": { "line": 5489, "column": 40, "offset": 148791 }, - "end": { "line": 5489, "column": 45, "offset": 148796 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "Buffer.allocUnsafeSlow()", - "position": { - "start": { "line": 5489, "column": 46, "offset": 148797 }, - "end": { "line": 5489, "column": 72, "offset": 148823 } - } - } - ], - "position": { - "start": { "line": 5489, "column": 45, "offset": 148796 }, - "end": { "line": 5489, "column": 75, "offset": 148826 } - }, - "label": "`Buffer.allocUnsafeSlow()`", - "identifier": "`buffer.allocunsafeslow()`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": ", the\nsegment of allocated memory is ", - "position": { - "start": { "line": 5489, "column": 75, "offset": 148826 }, - "end": { "line": 5490, "column": 32, "offset": 148863 } - } - }, - { - "type": "emphasis", - "children": [ - { - "type": "text", - "value": "uninitialized", - "position": { - "start": { "line": 5490, "column": 33, "offset": 148864 }, - "end": { "line": 5490, "column": 46, "offset": 148877 } - } - } - ], - "position": { - "start": { "line": 5490, "column": 32, "offset": 148863 }, - "end": { "line": 5490, "column": 47, "offset": 148878 } - } - }, - { - "type": "text", - "value": " (it is not zeroed-out). While\nthis design makes the allocation of memory quite fast, the allocated segment of\nmemory might contain old data that is potentially sensitive. Using a ", - "position": { - "start": { "line": 5490, "column": 47, "offset": 148878 }, - "end": { "line": 5492, "column": 70, "offset": 149058 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 5492, "column": 70, "offset": 149058 }, - "end": { "line": 5492, "column": 78, "offset": 149066 } - } - }, - { - "type": "text", - "value": "\ncreated by ", - "position": { - "start": { "line": 5492, "column": 78, "offset": 149066 }, - "end": { "line": 5493, "column": 12, "offset": 149078 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "Buffer.allocUnsafe()", - "position": { - "start": { "line": 5493, "column": 13, "offset": 149079 }, - "end": { "line": 5493, "column": 35, "offset": 149101 } - } - } - ], - "position": { - "start": { "line": 5493, "column": 12, "offset": 149078 }, - "end": { "line": 5493, "column": 38, "offset": 149104 } - }, - "label": "`Buffer.allocUnsafe()`", - "identifier": "`buffer.allocunsafe()`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": " without ", - "position": { - "start": { "line": 5493, "column": 38, "offset": 149104 }, - "end": { "line": 5493, "column": 47, "offset": 149113 } - } - }, - { - "type": "emphasis", - "children": [ - { - "type": "text", - "value": "completely", - "position": { - "start": { "line": 5493, "column": 48, "offset": 149114 }, - "end": { "line": 5493, "column": 58, "offset": 149124 } - } - } - ], - "position": { - "start": { "line": 5493, "column": 47, "offset": 149113 }, - "end": { "line": 5493, "column": 59, "offset": 149125 } - } - }, - { - "type": "text", - "value": " overwriting the\nmemory can allow this old data to be leaked when the ", - "position": { - "start": { "line": 5493, "column": 59, "offset": 149125 }, - "end": { "line": 5494, "column": 54, "offset": 149195 } - } - }, - { - "type": "inlineCode", - "value": "Buffer", - "position": { - "start": { "line": 5494, "column": 54, "offset": 149195 }, - "end": { "line": 5494, "column": 62, "offset": 149203 } - } - }, - { - "type": "text", - "value": " memory is read.", - "position": { - "start": { "line": 5494, "column": 62, "offset": 149203 }, - "end": { "line": 5494, "column": 78, "offset": 149219 } - } - } - ], - "position": { - "start": { "line": 5489, "column": 1, "offset": 148752 }, - "end": { "line": 5494, "column": 78, "offset": 149219 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "While there are clear performance advantages to using\n", - "position": { - "start": { "line": 5496, "column": 1, "offset": 149221 }, - "end": { "line": 5497, "column": 1, "offset": 149275 } - } - }, - { - "type": "linkReference", - "children": [ - { - "type": "inlineCode", - "value": "Buffer.allocUnsafe()", - "position": { - "start": { "line": 5497, "column": 2, "offset": 149276 }, - "end": { "line": 5497, "column": 24, "offset": 149298 } - } - } - ], - "position": { - "start": { "line": 5497, "column": 1, "offset": 149275 }, - "end": { "line": 5497, "column": 27, "offset": 149301 } - }, - "label": "`Buffer.allocUnsafe()`", - "identifier": "`buffer.allocunsafe()`", - "referenceType": "collapsed" - }, - { - "type": "text", - "value": ", extra care ", - "position": { - "start": { "line": 5497, "column": 27, "offset": 149301 }, - "end": { "line": 5497, "column": 40, "offset": 149314 } - } - }, - { - "type": "emphasis", - "children": [ - { - "type": "text", - "value": "must", - "position": { - "start": { "line": 5497, "column": 41, "offset": 149315 }, - "end": { "line": 5497, "column": 45, "offset": 149319 } - } - } - ], - "position": { - "start": { "line": 5497, "column": 40, "offset": 149314 }, - "end": { "line": 5497, "column": 46, "offset": 149320 } - } - }, - { - "type": "text", - "value": " be taken in order to avoid\nintroducing security vulnerabilities into an application.", - "position": { - "start": { "line": 5497, "column": 46, "offset": 149320 }, - "end": { "line": 5498, "column": 58, "offset": 149405 } - } - } - ], - "position": { - "start": { "line": 5496, "column": 1, "offset": 149221 }, - "end": { "line": 5498, "column": 58, "offset": 149405 } - } - }, - { - "type": "definition", - "identifier": "ascii", - "label": "ASCII", - "title": null, - "url": "https://en.wikipedia.org/wiki/ASCII", - "position": { - "start": { "line": 5500, "column": 1, "offset": 149407 }, - "end": { "line": 5500, "column": 45, "offset": 149451 } - } - }, - { - "type": "definition", - "identifier": "base64", - "label": "Base64", - "title": null, - "url": "https://en.wikipedia.org/wiki/Base64", - "position": { - "start": { "line": 5501, "column": 1, "offset": 149452 }, - "end": { "line": 5501, "column": 47, "offset": 149498 } - } - }, - { - "type": "definition", - "identifier": "iso-8859-1", - "label": "ISO-8859-1", - "title": null, - "url": "https://en.wikipedia.org/wiki/ISO-8859-1", - "position": { - "start": { "line": 5502, "column": 1, "offset": 149499 }, - "end": { "line": 5502, "column": 55, "offset": 149553 } - } - }, - { - "type": "definition", - "identifier": "rfc 4648, section 5", - "label": "RFC 4648, Section 5", - "title": null, - "url": "https://tools.ietf.org/html/rfc4648#section-5", - "position": { - "start": { "line": 5503, "column": 1, "offset": 149554 }, - "end": { "line": 5503, "column": 69, "offset": 149622 } - } - }, - { - "type": "definition", - "identifier": "utf-16", - "label": "UTF-16", - "title": null, - "url": "https://en.wikipedia.org/wiki/UTF-16", - "position": { - "start": { "line": 5504, "column": 1, "offset": 149623 }, - "end": { "line": 5504, "column": 47, "offset": 149669 } - } - }, - { - "type": "definition", - "identifier": "utf-8", - "label": "UTF-8", - "title": null, - "url": "https://en.wikipedia.org/wiki/UTF-8", - "position": { - "start": { "line": 5505, "column": 1, "offset": 149670 }, - "end": { "line": 5505, "column": 45, "offset": 149714 } - } - }, - { - "type": "definition", - "identifier": "whatwg encoding standard", - "label": "WHATWG Encoding Standard", - "title": null, - "url": "https://encoding.spec.whatwg.org/", - "position": { - "start": { "line": 5506, "column": 1, "offset": 149715 }, - "end": { "line": 5506, "column": 62, "offset": 149776 } - } - }, - { - "type": "definition", - "identifier": "`blob`", - "label": "`Blob`", - "title": null, - "url": "https://developer.mozilla.org/en-US/docs/Web/API/Blob", - "position": { - "start": { "line": 5507, "column": 1, "offset": 149777 }, - "end": { "line": 5507, "column": 64, "offset": 149840 } - } - }, - { - "type": "definition", - "identifier": "`buffer.alloc()`", - "label": "`Buffer.alloc()`", - "title": null, - "url": "#static-method-bufferallocsize-fill-encoding", - "position": { - "start": { "line": 5508, "column": 1, "offset": 149841 }, - "end": { "line": 5508, "column": 65, "offset": 149905 } - } - }, - { - "type": "definition", - "identifier": "`buffer.allocunsafe()`", - "label": "`Buffer.allocUnsafe()`", - "title": null, - "url": "#static-method-bufferallocunsafesize", - "position": { - "start": { "line": 5509, "column": 1, "offset": 149906 }, - "end": { "line": 5509, "column": 63, "offset": 149968 } - } - }, - { - "type": "definition", - "identifier": "`buffer.allocunsafeslow()`", - "label": "`Buffer.allocUnsafeSlow()`", - "title": null, - "url": "#static-method-bufferallocunsafeslowsize", - "position": { - "start": { "line": 5510, "column": 1, "offset": 149969 }, - "end": { "line": 5510, "column": 71, "offset": 150039 } - } - }, - { - "type": "definition", - "identifier": "`buffer.concat()`", - "label": "`Buffer.concat()`", - "title": null, - "url": "#static-method-bufferconcatlist-totallength", - "position": { - "start": { "line": 5511, "column": 1, "offset": 150040 }, - "end": { "line": 5511, "column": 65, "offset": 150104 } - } - }, - { - "type": "definition", - "identifier": "`buffer.copybytesfrom()`", - "label": "`Buffer.copyBytesFrom()`", - "title": null, - "url": "#static-method-buffercopybytesfromview-offset-length", - "position": { - "start": { "line": 5512, "column": 1, "offset": 150105 }, - "end": { "line": 5512, "column": 81, "offset": 150185 } - } - }, - { - "type": "definition", - "identifier": "`buffer.from(array)`", - "label": "`Buffer.from(array)`", - "title": null, - "url": "#static-method-bufferfromarray", - "position": { - "start": { "line": 5513, "column": 1, "offset": 150186 }, - "end": { "line": 5513, "column": 55, "offset": 150240 } - } - }, - { - "type": "definition", - "identifier": "`buffer.from(arraybuf)`", - "label": "`Buffer.from(arrayBuf)`", - "title": null, - "url": "#static-method-bufferfromarraybuffer-byteoffset-length", - "position": { - "start": { "line": 5514, "column": 1, "offset": 150241 }, - "end": { "line": 5514, "column": 82, "offset": 150322 } - } - }, - { - "type": "definition", - "identifier": "`buffer.from(buffer)`", - "label": "`Buffer.from(buffer)`", - "title": null, - "url": "#static-method-bufferfrombuffer", - "position": { - "start": { "line": 5515, "column": 1, "offset": 150323 }, - "end": { "line": 5515, "column": 57, "offset": 150379 } - } - }, - { - "type": "definition", - "identifier": "`buffer.from(string)`", - "label": "`Buffer.from(string)`", - "title": null, - "url": "#static-method-bufferfromstring-encoding", - "position": { - "start": { "line": 5516, "column": 1, "offset": 150380 }, - "end": { "line": 5516, "column": 66, "offset": 150445 } - } - }, - { - "type": "definition", - "identifier": "`buffer.poolsize`", - "label": "`Buffer.poolSize`", - "title": null, - "url": "#class-property-bufferpoolsize", - "position": { - "start": { "line": 5517, "column": 1, "offset": 150446 }, - "end": { "line": 5517, "column": 52, "offset": 150497 } - } - }, - { - "type": "definition", - "identifier": "`err_invalid_buffer_size`", - "label": "`ERR_INVALID_BUFFER_SIZE`", - "title": null, - "url": "errors.md#err_invalid_buffer_size", - "position": { - "start": { "line": 5518, "column": 1, "offset": 150498 }, - "end": { "line": 5518, "column": 63, "offset": 150560 } - } - }, - { - "type": "definition", - "identifier": "`err_out_of_range`", - "label": "`ERR_OUT_OF_RANGE`", - "title": null, - "url": "errors.md#err_out_of_range", - "position": { - "start": { "line": 5519, "column": 1, "offset": 150561 }, - "end": { "line": 5519, "column": 49, "offset": 150609 } - } - }, - { - "type": "definition", - "identifier": "`json.stringify()`", - "label": "`JSON.stringify()`", - "title": null, - "url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify", - "position": { - "start": { "line": 5520, "column": 1, "offset": 150610 }, - "end": { "line": 5520, "column": 118, "offset": 150727 } - } - }, - { - "type": "definition", - "identifier": "`string.prototype.indexof()`", - "label": "`String.prototype.indexOf()`", - "title": null, - "url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/indexOf", - "position": { - "start": { "line": 5521, "column": 1, "offset": 150728 }, - "end": { "line": 5521, "column": 128, "offset": 150855 } - } - }, - { - "type": "definition", - "identifier": "`string.prototype.lastindexof()`", - "label": "`String.prototype.lastIndexOf()`", - "title": null, - "url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/lastIndexOf", - "position": { - "start": { "line": 5522, "column": 1, "offset": 150856 }, - "end": { "line": 5522, "column": 136, "offset": 150991 } - } - }, - { - "type": "definition", - "identifier": "`string.prototype.length`", - "label": "`String.prototype.length`", - "title": null, - "url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length", - "position": { - "start": { "line": 5523, "column": 1, "offset": 150992 }, - "end": { "line": 5523, "column": 124, "offset": 151115 } - } - }, - { - "type": "definition", - "identifier": "`typedarray.from()`", - "label": "`TypedArray.from()`", - "title": null, - "url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/from", - "position": { - "start": { "line": 5524, "column": 1, "offset": 151116 }, - "end": { "line": 5524, "column": 120, "offset": 151235 } - } - }, - { - "type": "definition", - "identifier": "`typedarray.prototype.set()`", - "label": "`TypedArray.prototype.set()`", - "title": null, - "url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/set", - "position": { - "start": { "line": 5525, "column": 1, "offset": 151236 }, - "end": { "line": 5525, "column": 128, "offset": 151363 } - } - }, - { - "type": "definition", - "identifier": "`typedarray.prototype.slice()`", - "label": "`TypedArray.prototype.slice()`", - "title": null, - "url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/slice", - "position": { - "start": { "line": 5526, "column": 1, "offset": 151364 }, - "end": { "line": 5526, "column": 132, "offset": 151495 } - } - }, - { - "type": "definition", - "identifier": "`typedarray.prototype.subarray()`", - "label": "`TypedArray.prototype.subarray()`", - "title": null, - "url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/subarray", - "position": { - "start": { "line": 5527, "column": 1, "offset": 151496 }, - "end": { "line": 5527, "column": 138, "offset": 151633 } - } - }, - { - "type": "definition", - "identifier": "`buf.buffer`", - "label": "`buf.buffer`", - "title": null, - "url": "#bufbuffer", - "position": { - "start": { "line": 5528, "column": 1, "offset": 151634 }, - "end": { "line": 5528, "column": 27, "offset": 151660 } - } - }, - { - "type": "definition", - "identifier": "`buf.compare()`", - "label": "`buf.compare()`", - "title": null, - "url": "#bufcomparetarget-targetstart-targetend-sourcestart-sourceend", - "position": { - "start": { "line": 5529, "column": 1, "offset": 151661 }, - "end": { "line": 5529, "column": 81, "offset": 151741 } - } - }, - { - "type": "definition", - "identifier": "`buf.entries()`", - "label": "`buf.entries()`", - "title": null, - "url": "#bufentries", - "position": { - "start": { "line": 5530, "column": 1, "offset": 151742 }, - "end": { "line": 5530, "column": 31, "offset": 151772 } - } - }, - { - "type": "definition", - "identifier": "`buf.fill()`", - "label": "`buf.fill()`", - "title": null, - "url": "#buffillvalue-offset-end-encoding", - "position": { - "start": { "line": 5531, "column": 1, "offset": 151773 }, - "end": { "line": 5531, "column": 50, "offset": 151822 } - } - }, - { - "type": "definition", - "identifier": "`buf.indexof()`", - "label": "`buf.indexOf()`", - "title": null, - "url": "#bufindexofvalue-byteoffset-encoding", - "position": { - "start": { "line": 5532, "column": 1, "offset": 151823 }, - "end": { "line": 5532, "column": 56, "offset": 151878 } - } - }, - { - "type": "definition", - "identifier": "`buf.keys()`", - "label": "`buf.keys()`", - "title": null, - "url": "#bufkeys", - "position": { - "start": { "line": 5533, "column": 1, "offset": 151879 }, - "end": { "line": 5533, "column": 25, "offset": 151903 } - } - }, - { - "type": "definition", - "identifier": "`buf.length`", - "label": "`buf.length`", - "title": null, - "url": "#buflength", - "position": { - "start": { "line": 5534, "column": 1, "offset": 151904 }, - "end": { "line": 5534, "column": 27, "offset": 151930 } - } - }, - { - "type": "definition", - "identifier": "`buf.slice()`", - "label": "`buf.slice()`", - "title": null, - "url": "#bufslicestart-end", - "position": { - "start": { "line": 5535, "column": 1, "offset": 151931 }, - "end": { "line": 5535, "column": 36, "offset": 151966 } - } - }, - { - "type": "definition", - "identifier": "`buf.subarray`", - "label": "`buf.subarray`", - "title": null, - "url": "#bufsubarraystart-end", - "position": { - "start": { "line": 5536, "column": 1, "offset": 151967 }, - "end": { "line": 5536, "column": 40, "offset": 152006 } - } - }, - { - "type": "definition", - "identifier": "`buf.tostring()`", - "label": "`buf.toString()`", - "title": null, - "url": "#buftostringencoding-start-end", - "position": { - "start": { "line": 5537, "column": 1, "offset": 152007 }, - "end": { "line": 5537, "column": 51, "offset": 152057 } - } - }, - { - "type": "definition", - "identifier": "`buf.values()`", - "label": "`buf.values()`", - "title": null, - "url": "#bufvalues", - "position": { - "start": { "line": 5538, "column": 1, "offset": 152058 }, - "end": { "line": 5538, "column": 29, "offset": 152086 } - } - }, - { - "type": "definition", - "identifier": "`buffer.constants.max_length`", - "label": "`buffer.constants.MAX_LENGTH`", - "title": null, - "url": "#bufferconstantsmax_length", - "position": { - "start": { "line": 5539, "column": 1, "offset": 152087 }, - "end": { "line": 5539, "column": 60, "offset": 152146 } - } - }, - { - "type": "definition", - "identifier": "`buffer.constants.max_string_length`", - "label": "`buffer.constants.MAX_STRING_LENGTH`", - "title": null, - "url": "#bufferconstantsmax_string_length", - "position": { - "start": { "line": 5540, "column": 1, "offset": 152147 }, - "end": { "line": 5540, "column": 74, "offset": 152220 } - } - }, - { - "type": "definition", - "identifier": "`buffer.kmaxlength`", - "label": "`buffer.kMaxLength`", - "title": null, - "url": "#bufferkmaxlength", - "position": { - "start": { "line": 5541, "column": 1, "offset": 152221 }, - "end": { "line": 5541, "column": 41, "offset": 152261 } - } - }, - { - "type": "definition", - "identifier": "`util.inspect()`", - "label": "`util.inspect()`", - "title": null, - "url": "util.md#utilinspectobject-options", - "position": { - "start": { "line": 5542, "column": 1, "offset": 152262 }, - "end": { "line": 5542, "column": 54, "offset": 152315 } - } - }, - { - "type": "definition", - "identifier": "`v8::typedarray::kmaxlength`", - "label": "`v8::TypedArray::kMaxLength`", - "title": null, - "url": "https://v8.github.io/api/head/classv8_1_1TypedArray.html#a54a48f4373da0850663c4393d843b9b0", - "position": { - "start": { "line": 5543, "column": 1, "offset": 152316 }, - "end": { "line": 5543, "column": 123, "offset": 152438 } - } - }, - { - "type": "definition", - "identifier": "base64url", - "label": "base64url", - "title": null, - "url": "https://tools.ietf.org/html/rfc4648#section-5", - "position": { - "start": { "line": 5544, "column": 1, "offset": 152439 }, - "end": { "line": 5544, "column": 59, "offset": 152497 } - } - }, - { - "type": "definition", - "identifier": "endianness", - "label": "endianness", - "title": null, - "url": "https://en.wikipedia.org/wiki/Endianness", - "position": { - "start": { "line": 5545, "column": 1, "offset": 152498 }, - "end": { "line": 5545, "column": 55, "offset": 152552 } - } - }, - { - "type": "definition", - "identifier": "iterator", - "label": "iterator", - "title": null, - "url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols", - "position": { - "start": { "line": 5546, "column": 1, "offset": 152553 }, - "end": { "line": 5546, "column": 98, "offset": 152650 } - } - } - ], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 5547, "column": 1, "offset": 152651 } - } -} From 2c76235e3876541cb0e2678174ba8c8afba3f4b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guilherme=20Ara=C3=BAjo?= Date: Thu, 22 May 2025 11:36:53 -0300 Subject: [PATCH 12/17] test: fix info issue output --- src/linter/tests/reporters/console.test.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/linter/tests/reporters/console.test.mjs b/src/linter/tests/reporters/console.test.mjs index a14d4172..faa04235 100644 --- a/src/linter/tests/reporters/console.test.mjs +++ b/src/linter/tests/reporters/console.test.mjs @@ -7,7 +7,7 @@ const testCases = [ { issue: infoIssue, method: 'info', - expected: '\x1B[90mThis is a INFO issue at doc/api/test.md\x1B[39m', + expected: '\x1B[90mThis is a INFO issue at doc/api/test.md (1:1)\x1B[39m', }, { issue: warnIssue, From a34621877249fa4abb50cf8cf2ad8bccdc5f4d4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guilherme=20Ara=C3=BAjo?= Date: Thu, 22 May 2025 16:05:20 -0300 Subject: [PATCH 13/17] fix: cross-platform line break Co-authored-by: Aviv Keller --- src/utils/parser/index.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/parser/index.mjs b/src/utils/parser/index.mjs index 63aa6efc..5a6fc485 100644 --- a/src/utils/parser/index.mjs +++ b/src/utils/parser/index.mjs @@ -41,7 +41,7 @@ export const normalizeYamlSyntax = yamlContent => { .replace('type=', 'type: ') .replace('name=', 'name: ') .replace('llm_description=', 'llm_description: ') - .replace(/^\n+|\n+$/g, ''); // Remove initial and final line breaks + .replace(/^[\r\n]+|[\r\n]+$/g, ''); // Remove initial and final line breaks }; /** From 93b1d49c73ae6c834624d58152ea49deeec0ff1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guilherme=20Ara=C3=BAjo?= Date: Tue, 27 May 2025 15:57:09 -0300 Subject: [PATCH 14/17] test: create normalizeYamlSyntax tests --- src/utils/tests/parser.test.mjs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/utils/tests/parser.test.mjs b/src/utils/tests/parser.test.mjs index cf3a4ae2..5df829eb 100644 --- a/src/utils/tests/parser.test.mjs +++ b/src/utils/tests/parser.test.mjs @@ -5,6 +5,7 @@ import { parseYAMLIntoMetadata, transformTypeToReferenceLink, parseHeadingIntoMetadata, + normalizeYamlSyntax, } from '../parser/index.mjs'; describe('transformTypeToReferenceLink', () => { @@ -23,6 +24,35 @@ describe('transformTypeToReferenceLink', () => { }); }); +describe('normalizeYamlSyntax', () => { + it('should normalize YAML syntax by fixing noncompliant properties', () => { + const input = `introduced_in=v0.1.21 +source_link=lib/test.js +type=module +name=test_module +llm_description=This is a test module`; + + const normalizedYaml = normalizeYamlSyntax(input); + + strictEqual( + normalizedYaml, + `introduced_in: v0.1.21 +source_link: lib/test.js +type: module +name: test_module +llm_description: This is a test module` + ); + }); + + it('should remove leading and trailing newlines', () => { + const input = '\nintroduced_in=v0.1.21\n'; + + const normalizedYaml = normalizeYamlSyntax(input); + + strictEqual(normalizedYaml, 'introduced_in: v0.1.21'); + }); +}); + describe('parseYAMLIntoMetadata', () => { it('should parse a YAML string into a JavaScript object', () => { const input = 'name: test\ntype: module\nintroduced_in: v1.0.0'; From d7d38b5ccd246c0359226f8f17c4341f75841e13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guilherme=20Ara=C3=BAjo?= Date: Tue, 27 May 2025 15:58:13 -0300 Subject: [PATCH 15/17] refactor: remove ts-check --- src/linter/rules/duplicate-stability-nodes.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/linter/rules/duplicate-stability-nodes.mjs b/src/linter/rules/duplicate-stability-nodes.mjs index c49688cb..eea43613 100644 --- a/src/linter/rules/duplicate-stability-nodes.mjs +++ b/src/linter/rules/duplicate-stability-nodes.mjs @@ -1,4 +1,4 @@ -// @ts-check +'use strict'; import createQueries from '../../utils/queries/index.mjs'; import { LINT_MESSAGES } from '../constants.mjs'; From 660386d1d3e9dcd179e4bdd1997fa9e4a9bf8aa5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guilherme=20Ara=C3=BAjo?= Date: Tue, 27 May 2025 16:00:34 -0300 Subject: [PATCH 16/17] refactor: reorganize imports --- .../tests/fixtures/invalidChangeVersion-environment.mjs | 6 ++++-- src/linter/tests/rules/missing-introduced-in.test.mjs | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/linter/tests/fixtures/invalidChangeVersion-environment.mjs b/src/linter/tests/fixtures/invalidChangeVersion-environment.mjs index 2aa688bb..fb7f70be 100644 --- a/src/linter/tests/fixtures/invalidChangeVersion-environment.mjs +++ b/src/linter/tests/fixtures/invalidChangeVersion-environment.mjs @@ -1,8 +1,10 @@ -import { invalidChangeVersion } from '../../rules/invalid-change-version.mjs'; import { deepEqual } from 'node:assert'; -import dedent from 'dedent'; import { mock } from 'node:test'; +import dedent from 'dedent'; + +import { invalidChangeVersion } from '../../rules/invalid-change-version.mjs'; + const yamlContent = dedent`