Comparing version 4.1.4 to 4.1.5
@@ -52,5 +52,6 @@ 'use strict'; | ||
} | ||
const addRoot = (writer, root, { | ||
resize = false | ||
} = {}) => { | ||
const addRoot = (writer, root, options = {}) => { | ||
const { | ||
resize = false | ||
} = options; | ||
const {bytes, headerSize, byteOffset, roots} = writer; | ||
@@ -89,5 +90,6 @@ writer.roots.push(root); | ||
}; | ||
const close = (writer, { | ||
resize = false | ||
} = {}) => { | ||
const close = (writer, options = {}) => { | ||
const { | ||
resize = false | ||
} = options; | ||
const {roots, bytes, byteOffset, headerSize} = writer; | ||
@@ -146,3 +148,4 @@ const headerBytes = CBOR__namespace.encode({ | ||
const estimateHeaderLength = (rootCount, rootByteLength = 36) => calculateHeaderLength(new Array(rootCount).fill(rootByteLength)); | ||
const createWriter = (buffer, {roots = [], byteOffset = 0, byteLength = buffer.byteLength, headerSize = headerLength({ roots })} = {}) => { | ||
const createWriter = (buffer, options = {}) => { | ||
const {roots = [], byteOffset = 0, byteLength = buffer.byteLength, headerSize = headerLength({ roots })} = options; | ||
const bytes = new Uint8Array(buffer, byteOffset, byteLength); | ||
@@ -149,0 +152,0 @@ const writer = new CarBufferWriter(bytes, headerSize); |
@@ -27,5 +27,6 @@ import varint from 'varint'; | ||
} | ||
export const addRoot = (writer, root, { | ||
resize = false | ||
} = {}) => { | ||
export const addRoot = (writer, root, options = {}) => { | ||
const { | ||
resize = false | ||
} = options; | ||
const {bytes, headerSize, byteOffset, roots} = writer; | ||
@@ -64,5 +65,6 @@ writer.roots.push(root); | ||
}; | ||
export const close = (writer, { | ||
resize = false | ||
} = {}) => { | ||
export const close = (writer, options = {}) => { | ||
const { | ||
resize = false | ||
} = options; | ||
const {roots, bytes, byteOffset, headerSize} = writer; | ||
@@ -121,3 +123,4 @@ const headerBytes = CBOR.encode({ | ||
export const estimateHeaderLength = (rootCount, rootByteLength = 36) => calculateHeaderLength(new Array(rootCount).fill(rootByteLength)); | ||
export const createWriter = (buffer, {roots = [], byteOffset = 0, byteLength = buffer.byteLength, headerSize = headerLength({ roots })} = {}) => { | ||
export const createWriter = (buffer, options = {}) => { | ||
const {roots = [], byteOffset = 0, byteLength = buffer.byteLength, headerSize = headerLength({ roots })} = options; | ||
const bytes = new Uint8Array(buffer, byteOffset, byteLength); | ||
@@ -124,0 +127,0 @@ const writer = new CarBufferWriter(bytes, headerSize); |
@@ -81,3 +81,4 @@ import varint from 'varint' | ||
*/ | ||
export const addRoot = (writer, root, { resize = false } = {}) => { | ||
export const addRoot = (writer, root, options = {}) => { | ||
const { resize = false } = options | ||
const { bytes, headerSize, byteOffset, roots } = writer | ||
@@ -141,3 +142,4 @@ writer.roots.push(root) | ||
*/ | ||
export const close = (writer, { resize = false } = {}) => { | ||
export const close = (writer, options = {}) => { | ||
const { resize = false } = options | ||
const { roots, bytes, byteOffset, headerSize } = writer | ||
@@ -271,5 +273,4 @@ | ||
*/ | ||
export const createWriter = ( | ||
buffer, | ||
{ | ||
export const createWriter = (buffer, options = {}) => { | ||
const { | ||
roots = [], | ||
@@ -279,4 +280,3 @@ byteOffset = 0, | ||
headerSize = headerLength({ roots }) | ||
} = {} | ||
) => { | ||
} = options | ||
const bytes = new Uint8Array(buffer, byteOffset, byteLength) | ||
@@ -283,0 +283,0 @@ |
{ | ||
"name": "@ipld/car", | ||
"version": "4.1.4", | ||
"version": "4.1.5", | ||
"description": "Content Addressable aRchive format reader and writer", | ||
@@ -97,3 +97,3 @@ "main": "./cjs/car.js", | ||
"standard": "^17.0.0", | ||
"typescript": "~4.7.2" | ||
"typescript": "~4.8.2" | ||
}, | ||
@@ -100,0 +100,0 @@ "standard": { |
@@ -1,2 +0,2 @@ | ||
export function addRoot(writer: CarBufferWriter, root: CID, { resize }?: { | ||
export function addRoot(writer: CarBufferWriter, root: CID, options?: { | ||
resize?: boolean | undefined; | ||
@@ -6,3 +6,3 @@ } | undefined): void; | ||
export function addBlock(writer: CarBufferWriter, { cid, bytes }: Block): void; | ||
export function close(writer: CarBufferWriter, { resize }?: { | ||
export function close(writer: CarBufferWriter, options?: { | ||
resize?: boolean | undefined; | ||
@@ -16,3 +16,3 @@ } | undefined): Uint8Array; | ||
export function estimateHeaderLength(rootCount: number, rootByteLength?: number | undefined): number; | ||
export function createWriter(buffer: ArrayBuffer, { roots, byteOffset, byteLength, headerSize }?: { | ||
export function createWriter(buffer: ArrayBuffer, options?: { | ||
roots?: import("multiformats/cid").CID[] | undefined; | ||
@@ -19,0 +19,0 @@ byteOffset?: number | undefined; |
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
596931
15458
1