diff --git a/classes/ipfs_unixfs.UnixFS.html b/classes/ipfs_unixfs.UnixFS.html index f08bc122..337b3467 100644 --- a/classes/ipfs_unixfs.UnixFS.html +++ b/classes/ipfs_unixfs.UnixFS.html @@ -1,4 +1,4 @@ -UnixFS | UnixFS

Constructors

constructor +UnixFS | UnixFS

Constructors

Properties

Constructors

Properties

_mode?: number
_originalMode: number
blockSizes: bigint[]
data?: Uint8Array
fanout?: bigint
hashType?: bigint
mtime?: Mtime
type: string

Accessors

  • get mode(): undefined | number
  • Returns undefined | number

  • set mode(mode): void
  • Parameters

    • mode: undefined | number

    Returns void

Methods

  • Parameters

    • size: bigint

    Returns void

  • Returns 0n for directories or data.length + sum(blockSizes) for everything else

    -

    Returns bigint

  • Returns boolean

  • Parameters

    • index: number

    Returns void

\ No newline at end of file +

Constructors

Properties

_mode?: number
_originalMode: number
blockSizes: bigint[]
data?: Uint8Array
fanout?: bigint
hashType?: bigint
mtime?: Mtime
type: string

Accessors

  • get mode(): undefined | number
  • Returns undefined | number

  • set mode(mode): void
  • Parameters

    • mode: undefined | number

    Returns void

Methods

  • Parameters

    • size: bigint

    Returns void

  • Returns 0n for directories or data.length + sum(blockSizes) for everything else

    +

    Returns bigint

  • Returns boolean

  • Parameters

    • index: number

    Returns void

\ No newline at end of file diff --git a/functions/ipfs_unixfs_exporter.exporter.html b/functions/ipfs_unixfs_exporter.exporter.html index 8e69491c..583ad873 100644 --- a/functions/ipfs_unixfs_exporter.exporter.html +++ b/functions/ipfs_unixfs_exporter.exporter.html @@ -2,4 +2,4 @@

Returns a Promise which resolves to a UnixFSEntry.

Parameters

Returns Promise<UnixFSEntry>

Example

import { exporter } from 'ipfs-unixfs-exporter'
import { CID } from 'multiformats/cid'

const cid = CID.parse('QmFoo')

const entry = await exporter(cid, blockstore, {
signal: AbortSignal.timeout(50000)
})

if (entry.type === 'file') {
for await (const chunk of entry.content()) {
// chunk is a Uint8Array
}
}
-
\ No newline at end of file +
\ No newline at end of file diff --git a/functions/ipfs_unixfs_exporter.recursive.html b/functions/ipfs_unixfs_exporter.recursive.html index 0c29946c..306f8c25 100644 --- a/functions/ipfs_unixfs_exporter.recursive.html +++ b/functions/ipfs_unixfs_exporter.recursive.html @@ -2,4 +2,4 @@ path, as well as the containing directory.

Parameters

Returns AsyncGenerator<UnixFSEntry, void, any>

Example

import { recursive } from 'ipfs-unixfs-exporter'

const entries = []

for await (const child of recursive('Qmfoo/foo/bar', blockstore)) {
entries.push(entry)
}

// entries contains all children of the `Qmfoo/foo/bar` directory and it's children
-
\ No newline at end of file +
\ No newline at end of file diff --git a/functions/ipfs_unixfs_exporter.walkPath.html b/functions/ipfs_unixfs_exporter.walkPath.html index 026e193c..244b6370 100644 --- a/functions/ipfs_unixfs_exporter.walkPath.html +++ b/functions/ipfs_unixfs_exporter.walkPath.html @@ -1,4 +1,4 @@ walkPath | UnixFS
\ No newline at end of file +
\ No newline at end of file diff --git a/functions/ipfs_unixfs_importer.chunker.fixedSize.html b/functions/ipfs_unixfs_importer.chunker.fixedSize.html index 14eedb42..85b139dc 100644 --- a/functions/ipfs_unixfs_importer.chunker.fixedSize.html +++ b/functions/ipfs_unixfs_importer.chunker.fixedSize.html @@ -1 +1 @@ -fixedSize | UnixFS
\ No newline at end of file +fixedSize | UnixFS
\ No newline at end of file diff --git a/functions/ipfs_unixfs_importer.chunker.rabin.html b/functions/ipfs_unixfs_importer.chunker.rabin.html index 7f756d65..80548ada 100644 --- a/functions/ipfs_unixfs_importer.chunker.rabin.html +++ b/functions/ipfs_unixfs_importer.chunker.rabin.html @@ -1 +1 @@ -rabin | UnixFS
\ No newline at end of file +rabin | UnixFS
\ No newline at end of file diff --git a/functions/ipfs_unixfs_importer.index.importByteStream.html b/functions/ipfs_unixfs_importer.index.importByteStream.html index f1b774f0..2e34d6c6 100644 --- a/functions/ipfs_unixfs_importer.index.importByteStream.html +++ b/functions/ipfs_unixfs_importer.index.importByteStream.html @@ -2,4 +2,4 @@ returns a promise of a single ImportResult.

Parameters

Returns Promise<ImportResult>

Example

import { importByteStream } from 'ipfs-unixfs-importer'
import { MemoryBlockstore } from 'blockstore-core'

// store blocks in memory, other blockstores are available
const blockstore = new MemoryBlockstore()

const input = [
Uint8Array.from([0, 1, 2, 3, 4]),
Uint8Array.from([5, 6, 7, 8, 9])
]

const entry = await importByteStream(input, blockstore)
-
\ No newline at end of file +
\ No newline at end of file diff --git a/functions/ipfs_unixfs_importer.index.importBytes.html b/functions/ipfs_unixfs_importer.index.importBytes.html index 5af21c68..94d80df7 100644 --- a/functions/ipfs_unixfs_importer.index.importBytes.html +++ b/functions/ipfs_unixfs_importer.index.importBytes.html @@ -2,4 +2,4 @@ of a single ImportResult.

Parameters

Returns Promise<ImportResult>

Example

import { importBytes } from 'ipfs-unixfs-importer'
import { MemoryBlockstore } from 'blockstore-core'

// store blocks in memory, other blockstores are available
const blockstore = new MemoryBlockstore()

const input = Uint8Array.from([0, 1, 2, 3, 4])

const entry = await importBytes(input, blockstore)
-
\ No newline at end of file +
\ No newline at end of file diff --git a/functions/ipfs_unixfs_importer.index.importDirectory.html b/functions/ipfs_unixfs_importer.index.importDirectory.html index 1af73177..36273201 100644 --- a/functions/ipfs_unixfs_importer.index.importDirectory.html +++ b/functions/ipfs_unixfs_importer.index.importDirectory.html @@ -3,4 +3,4 @@ instead of a stream of results.

Parameters

Returns Promise<ImportResult>

Example

import { importDirectory } from 'ipfs-unixfs-importer'
import { MemoryBlockstore } from 'blockstore-core'

// store blocks in memory, other blockstores are available
const blockstore = new MemoryBlockstore()

const input: DirectoryCandidate = {
path: './foo.txt'
}

const entry = await importDirectory(input, blockstore)
-
\ No newline at end of file +
\ No newline at end of file diff --git a/functions/ipfs_unixfs_importer.index.importFile.html b/functions/ipfs_unixfs_importer.index.importFile.html index 384635a4..25ba5526 100644 --- a/functions/ipfs_unixfs_importer.index.importFile.html +++ b/functions/ipfs_unixfs_importer.index.importFile.html @@ -3,4 +3,4 @@ instead of a stream of results.

Parameters

Returns Promise<ImportResult>

Example

import { importFile } from 'ipfs-unixfs-importer'
import { MemoryBlockstore } from 'blockstore-core'

// store blocks in memory, other blockstores are available
const blockstore = new MemoryBlockstore()

const input: FileCandidate = {
path: './foo.txt',
content: Uint8Array.from([0, 1, 2, 3, 4])
}

const entry = await importFile(input, blockstore)
-
\ No newline at end of file +
\ No newline at end of file diff --git a/functions/ipfs_unixfs_importer.index.importer.html b/functions/ipfs_unixfs_importer.index.importer.html index 903e4660..d57e65c8 100644 --- a/functions/ipfs_unixfs_importer.index.importer.html +++ b/functions/ipfs_unixfs_importer.index.importer.html @@ -2,4 +2,4 @@ them up in the passed blockstore.

Parameters

Returns AsyncGenerator<ImportResult, void, unknown>

Example

import { importer } from 'ipfs-unixfs-importer'
import { MemoryBlockstore } from 'blockstore-core'

// store blocks in memory, other blockstores are available
const blockstore = new MemoryBlockstore()

const input = [{
path: './foo.txt',
content: Uint8Array.from([0, 1, 2, 3, 4])
}, {
path: './bar.txt',
content: Uint8Array.from([0, 1, 2, 3, 4])
}]

for await (const entry of importer(input, blockstore)) {
console.info(entry)
// { cid: CID(), ... }
}
-
\ No newline at end of file +
\ No newline at end of file diff --git a/functions/ipfs_unixfs_importer.layout.balanced.html b/functions/ipfs_unixfs_importer.layout.balanced.html index e11d0249..3e7c1bac 100644 --- a/functions/ipfs_unixfs_importer.layout.balanced.html +++ b/functions/ipfs_unixfs_importer.layout.balanced.html @@ -1 +1 @@ -balanced | UnixFS
\ No newline at end of file +balanced | UnixFS
\ No newline at end of file diff --git a/functions/ipfs_unixfs_importer.layout.flat.html b/functions/ipfs_unixfs_importer.layout.flat.html index 2efe9378..e550648d 100644 --- a/functions/ipfs_unixfs_importer.layout.flat.html +++ b/functions/ipfs_unixfs_importer.layout.flat.html @@ -1 +1 @@ -flat | UnixFS
\ No newline at end of file +flat | UnixFS
\ No newline at end of file diff --git a/functions/ipfs_unixfs_importer.layout.trickle.html b/functions/ipfs_unixfs_importer.layout.trickle.html index bc5bb040..d4dc7f2e 100644 --- a/functions/ipfs_unixfs_importer.layout.trickle.html +++ b/functions/ipfs_unixfs_importer.layout.trickle.html @@ -1,2 +1,2 @@ trickle | UnixFS
\ No newline at end of file +
\ No newline at end of file diff --git a/index.html b/index.html index bcae4fee..fb296f2f 100644 --- a/index.html +++ b/index.html @@ -5,19 +5,19 @@

JS implementation of the IPFS UnixFS

-

The UnixFS spec can be found at ipfs/specs/UNIXFS.md

Packages

+

The UnixFS spec can be found at ipfs/specs/UNIXFS.md

API Docs

License

Licensed under either of

Contribute

Contributions welcome! Please check out the issues.

Also see our contributing document for more information on how we work, and about contributing in general.

diff --git a/interfaces/ipfs_unixfs.Mtime.html b/interfaces/ipfs_unixfs.Mtime.html index 50c6d81d..50b4568d 100644 --- a/interfaces/ipfs_unixfs.Mtime.html +++ b/interfaces/ipfs_unixfs.Mtime.html @@ -1,3 +1,3 @@ -Mtime | UnixFS

Interface Mtime

interface Mtime {
    nsecs?: number;
    secs: bigint;
}

Properties

nsecs? +Mtime | UnixFS

Interface Mtime

interface Mtime {
    nsecs?: number;
    secs: bigint;
}

Properties

Properties

nsecs?: number
secs: bigint
\ No newline at end of file +

Properties

nsecs?: number
secs: bigint
\ No newline at end of file diff --git a/interfaces/ipfs_unixfs.UnixFSOptions.html b/interfaces/ipfs_unixfs.UnixFSOptions.html index c4f85f5f..a594f3a1 100644 --- a/interfaces/ipfs_unixfs.UnixFSOptions.html +++ b/interfaces/ipfs_unixfs.UnixFSOptions.html @@ -1,8 +1,8 @@ -UnixFSOptions | UnixFS

Interface UnixFSOptions

interface UnixFSOptions {
    blockSizes?: bigint[];
    data?: Uint8Array;
    fanout?: bigint;
    hashType?: bigint;
    mode?: number;
    mtime?: Mtime;
    type?: string;
}

Properties

blockSizes? +UnixFSOptions | UnixFS

Interface UnixFSOptions

interface UnixFSOptions {
    blockSizes?: bigint[];
    data?: Uint8Array;
    fanout?: bigint;
    hashType?: bigint;
    mode?: number;
    mtime?: Mtime;
    type?: string;
}

Properties

blockSizes?: bigint[]
data?: Uint8Array
fanout?: bigint
hashType?: bigint
mode?: number
mtime?: Mtime
type?: string
\ No newline at end of file +

Properties

blockSizes?: bigint[]
data?: Uint8Array
fanout?: bigint
hashType?: bigint
mode?: number
mtime?: Mtime
type?: string
\ No newline at end of file diff --git a/interfaces/ipfs_unixfs_exporter.ExportProgress.html b/interfaces/ipfs_unixfs_exporter.ExportProgress.html index 902dfd88..d708aa66 100644 --- a/interfaces/ipfs_unixfs_exporter.ExportProgress.html +++ b/interfaces/ipfs_unixfs_exporter.ExportProgress.html @@ -1,11 +1,11 @@ -ExportProgress | UnixFS
interface ExportProgress {
    bytesRead: bigint;
    fileSize: bigint;
    totalBytes: bigint;
}

Properties

bytesRead +ExportProgress | UnixFS
interface ExportProgress {
    bytesRead: bigint;
    fileSize: bigint;
    totalBytes: bigint;
}

Properties

bytesRead: bigint

How many bytes of the file have been read

-
fileSize: bigint

The size of the file being read - n.b. this may be +

fileSize: bigint

The size of the file being read - n.b. this may be larger than total if offset/length has been specified

-
totalBytes: bigint

How many bytes of the file will be read - n.b. this may be +

totalBytes: bigint

How many bytes of the file will be read - n.b. this may be smaller than fileSize if offset/length have been specified

-
\ No newline at end of file +
\ No newline at end of file diff --git a/interfaces/ipfs_unixfs_exporter.ExportWalk.html b/interfaces/ipfs_unixfs_exporter.ExportWalk.html index 5db24ce6..c55b9304 100644 --- a/interfaces/ipfs_unixfs_exporter.ExportWalk.html +++ b/interfaces/ipfs_unixfs_exporter.ExportWalk.html @@ -1,2 +1,2 @@ -ExportWalk | UnixFS
interface ExportWalk {
    cid: CID<unknown, number, number, Version>;
}

Properties

cid -

Properties

cid: CID<unknown, number, number, Version>
\ No newline at end of file +ExportWalk | UnixFS
interface ExportWalk {
    cid: CID<unknown, number, number, Version>;
}

Properties

cid +

Properties

cid: CID<unknown, number, number, Version>
\ No newline at end of file diff --git a/interfaces/ipfs_unixfs_exporter.Exportable.html b/interfaces/ipfs_unixfs_exporter.Exportable.html index a086b14b..ed0d32c1 100644 --- a/interfaces/ipfs_unixfs_exporter.Exportable.html +++ b/interfaces/ipfs_unixfs_exporter.Exportable.html @@ -1,4 +1,4 @@ -Exportable | UnixFS
interface Exportable<T> {
    cid: CID<unknown, number, number, Version>;
    depth: number;
    name: string;
    path: string;
    size: bigint;
    type: "object" | "file" | "directory" | "raw" | "identity";
    content(options?): AsyncGenerator<T, void, unknown>;
}

Type Parameters

  • T

Hierarchy (view full)

Properties

cid +Exportable | UnixFS
interface Exportable<T> {
    cid: CID<unknown, number, number, Version>;
    depth: number;
    name: string;
    path: string;
    size: bigint;
    type: "object" | "file" | "directory" | "raw" | "identity";
    content(options?): AsyncGenerator<T, void, unknown>;
}

Type Parameters

  • T

Hierarchy (view full)

Properties

cid depth name path @@ -6,17 +6,17 @@ type

Methods

Properties

cid: CID<unknown, number, number, Version>

The CID of the entry

-
depth: number

How far down the DAG the entry is

-
name: string

The name of the entry

-
path: string

The path of the entry within the DAG in which it was encountered

-
size: bigint

The size of the entry

-
type: "object" | "file" | "directory" | "raw" | "identity"

A disambiguator to allow TypeScript to work out the type of the entry.

+
depth: number

How far down the DAG the entry is

+
name: string

The name of the entry

+
path: string

The path of the entry within the DAG in which it was encountered

+
size: bigint

The size of the entry

+
type: "object" | "file" | "directory" | "raw" | "identity"

A disambiguator to allow TypeScript to work out the type of the entry.

Example

if (entry.type === 'file') {
// access UnixFSFile properties safely
}

if (entry.type === 'directory') {
// access UnixFSDirectory properties safely
}
-

Methods

Methods

  • Parameters

    Returns AsyncGenerator<T, void, unknown>

    Example: File content

    When entry is a file or a raw node, offset and/or length arguments can be passed to entry.content() to return slices of data:

    const length = 5
    const data = new Uint8Array(length)
    let offset = 0

    for await (const chunk of entry.content({
    offset: 0,
    length
    })) {
    data.set(chunk, offset)
    offset += chunk.length
    }

    // `data` contains the first 5 bytes of the file
    return data

    Example: Directory content

    If entry is a directory, passing offset and/or length to entry.content() will limit the number of files returned from the directory.

    const entries = []

    for await (const entry of dir.content({
    offset: 0,
    length: 5
    })) {
    entries.push(entry)
    }

    // `entries` contains the first 5 files/directories in the directory
    -
\ No newline at end of file +
\ No newline at end of file diff --git a/interfaces/ipfs_unixfs_exporter.ExporterOptions.html b/interfaces/ipfs_unixfs_exporter.ExporterOptions.html index 98525a21..72255723 100644 --- a/interfaces/ipfs_unixfs_exporter.ExporterOptions.html +++ b/interfaces/ipfs_unixfs_exporter.ExporterOptions.html @@ -1,4 +1,4 @@ -ExporterOptions | UnixFS
interface ExporterOptions {
    blockReadConcurrency?: number;
    length?: number;
    offset?: number;
    onProgress?: ((evt) => void);
    signal?: AbortSignal;
}

Hierarchy

Properties

blockReadConcurrency? +ExporterOptions | UnixFS
interface ExporterOptions {
    blockReadConcurrency?: number;
    length?: number;
    offset?: number;
    onProgress?: ((evt) => void);
    signal?: AbortSignal;
}

Hierarchy

Properties

blockReadConcurrency? length? offset? onProgress? @@ -10,14 +10,14 @@ value should be set to 1, otherwise the traversal order will tend to resemble a breadth-first fan-out and yield a have stable ordering. (default: undefined)

-
length?: number

An optional length to read.

+
length?: number

An optional length to read.

If the CID resolves to a file this will be the number of bytes read from the file, otherwise if it's a directory it will be the number of directory entries read from the directory listing. (default: undefined)

-
offset?: number

An optional offset to start reading at.

+
offset?: number

An optional offset to start reading at.

If the CID resolves to a file this will be a byte offset within that file, otherwise if it's a directory it will be a directory entry offset within the directory listing. (default: undefined)

-
onProgress?: ((evt) => void)

Type declaration

signal?: AbortSignal

This signal can be used to abort any long-lived operations such as fetching +

onProgress?: ((evt) => void)

Type declaration

signal?: AbortSignal

This signal can be used to abort any long-lived operations such as fetching blocks from the network. (default: undefined)

-
\ No newline at end of file +
\ No newline at end of file diff --git a/interfaces/ipfs_unixfs_exporter.IdentityNode.html b/interfaces/ipfs_unixfs_exporter.IdentityNode.html index 750afff3..ce31ad64 100644 --- a/interfaces/ipfs_unixfs_exporter.IdentityNode.html +++ b/interfaces/ipfs_unixfs_exporter.IdentityNode.html @@ -1,7 +1,7 @@ IdentityNode | UnixFS

Entries with a identity codec CID return identity entries.

These are entries where the data payload is stored in the CID itself, otherwise they are identical to RawNodes.

-
interface IdentityNode {
    cid: CID<unknown, number, number, Version>;
    depth: number;
    name: string;
    node: Uint8Array;
    path: string;
    size: bigint;
    type: "identity";
    content(options?): AsyncGenerator<Uint8Array, void, unknown>;
}

Hierarchy (view full)

Properties

cid +
interface IdentityNode {
    cid: CID<unknown, number, number, Version>;
    depth: number;
    name: string;
    node: Uint8Array;
    path: string;
    size: bigint;
    type: "identity";
    content(options?): AsyncGenerator<Uint8Array, void, unknown>;
}

Hierarchy (view full)

Properties

cid depth name node @@ -10,17 +10,17 @@ type

Methods

Properties

cid: CID<unknown, number, number, Version>

The CID of the entry

-
depth: number

How far down the DAG the entry is

-
name: string

The name of the entry

-
path: string

The path of the entry within the DAG in which it was encountered

-
size: bigint

The size of the entry

-
type: "identity"

A disambiguator to allow TypeScript to work out the type of the entry.

+
depth: number

How far down the DAG the entry is

+
name: string

The name of the entry

+
path: string

The path of the entry within the DAG in which it was encountered

+
size: bigint

The size of the entry

+
type: "identity"

A disambiguator to allow TypeScript to work out the type of the entry.

Example

if (entry.type === 'file') {
// access UnixFSFile properties safely
}

if (entry.type === 'directory') {
// access UnixFSDirectory properties safely
}
-

Methods

Methods

  • Parameters

    Returns AsyncGenerator<Uint8Array, void, unknown>

    Example: File content

    When entry is a file or a raw node, offset and/or length arguments can be passed to entry.content() to return slices of data:

    const length = 5
    const data = new Uint8Array(length)
    let offset = 0

    for await (const chunk of entry.content({
    offset: 0,
    length
    })) {
    data.set(chunk, offset)
    offset += chunk.length
    }

    // `data` contains the first 5 bytes of the file
    return data

    Example: Directory content

    If entry is a directory, passing offset and/or length to entry.content() will limit the number of files returned from the directory.

    const entries = []

    for await (const entry of dir.content({
    offset: 0,
    length: 5
    })) {
    entries.push(entry)
    }

    // `entries` contains the first 5 files/directories in the directory
    -
\ No newline at end of file +
\ No newline at end of file diff --git a/interfaces/ipfs_unixfs_exporter.NextResult.html b/interfaces/ipfs_unixfs_exporter.NextResult.html index 293faef4..c8acb39d 100644 --- a/interfaces/ipfs_unixfs_exporter.NextResult.html +++ b/interfaces/ipfs_unixfs_exporter.NextResult.html @@ -1,5 +1,5 @@ -NextResult | UnixFS
interface NextResult {
    cid: CID<unknown, number, number, Version>;
    name: string;
    path: string;
    toResolve: string[];
}

Properties

cid +NextResult | UnixFS
interface NextResult {
    cid: CID<unknown, number, number, Version>;
    name: string;
    path: string;
    toResolve: string[];
}

Properties

Properties

cid: CID<unknown, number, number, Version>
name: string
path: string
toResolve: string[]
\ No newline at end of file +

Properties

cid: CID<unknown, number, number, Version>
name: string
path: string
toResolve: string[]
\ No newline at end of file diff --git a/interfaces/ipfs_unixfs_exporter.ObjectNode.html b/interfaces/ipfs_unixfs_exporter.ObjectNode.html index d08770f5..2b299519 100644 --- a/interfaces/ipfs_unixfs_exporter.ObjectNode.html +++ b/interfaces/ipfs_unixfs_exporter.ObjectNode.html @@ -1,5 +1,5 @@ ObjectNode | UnixFS

Entries with a dag-cbor or dag-json codec CID return JavaScript object entries

-
interface ObjectNode {
    cid: CID<unknown, number, number, Version>;
    depth: number;
    name: string;
    node: Uint8Array;
    path: string;
    size: bigint;
    type: "object";
    content(options?): AsyncGenerator<any, void, unknown>;
}

Hierarchy (view full)

Properties

cid +
interface ObjectNode {
    cid: CID<unknown, number, number, Version>;
    depth: number;
    name: string;
    node: Uint8Array;
    path: string;
    size: bigint;
    type: "object";
    content(options?): AsyncGenerator<any, void, unknown>;
}

Hierarchy (view full)

Properties

cid depth name node @@ -8,17 +8,17 @@ type

Methods

Properties

cid: CID<unknown, number, number, Version>

The CID of the entry

-
depth: number

How far down the DAG the entry is

-
name: string

The name of the entry

-
path: string

The path of the entry within the DAG in which it was encountered

-
size: bigint

The size of the entry

-
type: "object"

A disambiguator to allow TypeScript to work out the type of the entry.

+
depth: number

How far down the DAG the entry is

+
name: string

The name of the entry

+
path: string

The path of the entry within the DAG in which it was encountered

+
size: bigint

The size of the entry

+
type: "object"

A disambiguator to allow TypeScript to work out the type of the entry.

Example

if (entry.type === 'file') {
// access UnixFSFile properties safely
}

if (entry.type === 'directory') {
// access UnixFSDirectory properties safely
}
-

Methods

Methods

  • Parameters

    Returns AsyncGenerator<any, void, unknown>

    Example: File content

    When entry is a file or a raw node, offset and/or length arguments can be passed to entry.content() to return slices of data:

    const length = 5
    const data = new Uint8Array(length)
    let offset = 0

    for await (const chunk of entry.content({
    offset: 0,
    length
    })) {
    data.set(chunk, offset)
    offset += chunk.length
    }

    // `data` contains the first 5 bytes of the file
    return data

    Example: Directory content

    If entry is a directory, passing offset and/or length to entry.content() will limit the number of files returned from the directory.

    const entries = []

    for await (const entry of dir.content({
    offset: 0,
    length: 5
    })) {
    entries.push(entry)
    }

    // `entries` contains the first 5 files/directories in the directory
    -
\ No newline at end of file +
\ No newline at end of file diff --git a/interfaces/ipfs_unixfs_exporter.RawNode.html b/interfaces/ipfs_unixfs_exporter.RawNode.html index 3c2bb623..d56ee5bc 100644 --- a/interfaces/ipfs_unixfs_exporter.RawNode.html +++ b/interfaces/ipfs_unixfs_exporter.RawNode.html @@ -3,7 +3,7 @@
for await (const chunk of entry.content()) {
// chunk is a Buffer
}

Unless you an options object containing offset and length keys as an argument to entry.content(), chunk will be equal to entry.node.

-
interface RawNode {
    cid: CID<unknown, number, number, Version>;
    depth: number;
    name: string;
    node: Uint8Array;
    path: string;
    size: bigint;
    type: "raw";
    content(options?): AsyncGenerator<Uint8Array, void, unknown>;
}

Hierarchy (view full)

Properties

cid +
interface RawNode {
    cid: CID<unknown, number, number, Version>;
    depth: number;
    name: string;
    node: Uint8Array;
    path: string;
    size: bigint;
    type: "raw";
    content(options?): AsyncGenerator<Uint8Array, void, unknown>;
}

Hierarchy (view full)

Properties

cid depth name node @@ -12,17 +12,17 @@ type

Methods

Properties

cid: CID<unknown, number, number, Version>

The CID of the entry

-
depth: number

How far down the DAG the entry is

-
name: string

The name of the entry

-
path: string

The path of the entry within the DAG in which it was encountered

-
size: bigint

The size of the entry

-
type: "raw"

A disambiguator to allow TypeScript to work out the type of the entry.

+
depth: number

How far down the DAG the entry is

+
name: string

The name of the entry

+
path: string

The path of the entry within the DAG in which it was encountered

+
size: bigint

The size of the entry

+
type: "raw"

A disambiguator to allow TypeScript to work out the type of the entry.

Example

if (entry.type === 'file') {
// access UnixFSFile properties safely
}

if (entry.type === 'directory') {
// access UnixFSDirectory properties safely
}
-

Methods

Methods

  • Parameters

    Returns AsyncGenerator<Uint8Array, void, unknown>

    Example: File content

    When entry is a file or a raw node, offset and/or length arguments can be passed to entry.content() to return slices of data:

    const length = 5
    const data = new Uint8Array(length)
    let offset = 0

    for await (const chunk of entry.content({
    offset: 0,
    length
    })) {
    data.set(chunk, offset)
    offset += chunk.length
    }

    // `data` contains the first 5 bytes of the file
    return data

    Example: Directory content

    If entry is a directory, passing offset and/or length to entry.content() will limit the number of files returned from the directory.

    const entries = []

    for await (const entry of dir.content({
    offset: 0,
    length: 5
    })) {
    entries.push(entry)
    }

    // `entries` contains the first 5 files/directories in the directory
    -
\ No newline at end of file +
\ No newline at end of file diff --git a/interfaces/ipfs_unixfs_exporter.Resolve.html b/interfaces/ipfs_unixfs_exporter.Resolve.html index c6c2f508..4f79cfb0 100644 --- a/interfaces/ipfs_unixfs_exporter.Resolve.html +++ b/interfaces/ipfs_unixfs_exporter.Resolve.html @@ -1 +1 @@ -Resolve | UnixFS
interface Resolve ((cid, name, path, toResolve, depth, blockstore, options) => Promise<ResolveResult>)
\ No newline at end of file +Resolve | UnixFS
interface Resolve ((cid, name, path, toResolve, depth, blockstore, options) => Promise<ResolveResult>)
\ No newline at end of file diff --git a/interfaces/ipfs_unixfs_exporter.ResolveResult.html b/interfaces/ipfs_unixfs_exporter.ResolveResult.html index cdf61e30..2c6646ae 100644 --- a/interfaces/ipfs_unixfs_exporter.ResolveResult.html +++ b/interfaces/ipfs_unixfs_exporter.ResolveResult.html @@ -1,3 +1,3 @@ -ResolveResult | UnixFS
interface ResolveResult {
    entry: UnixFSEntry;
    next?: NextResult;
}

Properties

entry +ResolveResult | UnixFS
interface ResolveResult {
    entry: UnixFSEntry;
    next?: NextResult;
}

Properties

Properties

next?: NextResult
\ No newline at end of file +

Properties

next?: NextResult
\ No newline at end of file diff --git a/interfaces/ipfs_unixfs_exporter.Resolver.html b/interfaces/ipfs_unixfs_exporter.Resolver.html index d50a66fe..9dcc73eb 100644 --- a/interfaces/ipfs_unixfs_exporter.Resolver.html +++ b/interfaces/ipfs_unixfs_exporter.Resolver.html @@ -1 +1 @@ -Resolver | UnixFS
interface Resolver ((cid, name, path, toResolve, resolve, depth, blockstore, options) => Promise<ResolveResult>)
\ No newline at end of file +Resolver | UnixFS
interface Resolver ((cid, name, path, toResolve, resolve, depth, blockstore, options) => Promise<ResolveResult>)
\ No newline at end of file diff --git a/interfaces/ipfs_unixfs_exporter.ShardTraversalContext.html b/interfaces/ipfs_unixfs_exporter.ShardTraversalContext.html index 1a59ba97..915ace04 100644 --- a/interfaces/ipfs_unixfs_exporter.ShardTraversalContext.html +++ b/interfaces/ipfs_unixfs_exporter.ShardTraversalContext.html @@ -1,4 +1,4 @@ -ShardTraversalContext | UnixFS
interface ShardTraversalContext {
    hamtDepth: number;
    lastBucket: Bucket<boolean>;
    rootBucket: Bucket<boolean>;
}

Properties

hamtDepth +ShardTraversalContext | UnixFS
interface ShardTraversalContext {
    hamtDepth: number;
    lastBucket: Bucket<boolean>;
    rootBucket: Bucket<boolean>;
}

Properties

hamtDepth: number
lastBucket: Bucket<boolean>
rootBucket: Bucket<boolean>
\ No newline at end of file +

Properties

hamtDepth: number
lastBucket: Bucket<boolean>
rootBucket: Bucket<boolean>
\ No newline at end of file diff --git a/interfaces/ipfs_unixfs_exporter.UnixFSDirectory.html b/interfaces/ipfs_unixfs_exporter.UnixFSDirectory.html index 0127fb6d..21ee3ec6 100644 --- a/interfaces/ipfs_unixfs_exporter.UnixFSDirectory.html +++ b/interfaces/ipfs_unixfs_exporter.UnixFSDirectory.html @@ -1,7 +1,7 @@ UnixFSDirectory | UnixFS

If the entry is a directory, entry.content() returns further entry objects:

if (entry.type === 'directory') {
for await (const entry of dir.content()) {
console.info(entry.name)
}
}
-
interface UnixFSDirectory {
    cid: CID<unknown, number, number, Version>;
    depth: number;
    name: string;
    node: PBNode;
    path: string;
    size: bigint;
    type: "directory";
    unixfs: UnixFS;
    content(options?): AsyncGenerator<UnixFSEntry, void, unknown>;
}

Hierarchy (view full)

Properties

cid +
interface UnixFSDirectory {
    cid: CID<unknown, number, number, Version>;
    depth: number;
    name: string;
    node: PBNode;
    path: string;
    size: bigint;
    type: "directory";
    unixfs: UnixFS;
    content(options?): AsyncGenerator<UnixFSEntry, void, unknown>;
}

Hierarchy (view full)

Properties

cid depth name node @@ -11,17 +11,17 @@ unixfs

Methods

Properties

cid: CID<unknown, number, number, Version>

The CID of the entry

-
depth: number

How far down the DAG the entry is

-
name: string

The name of the entry

-
node: PBNode
path: string

The path of the entry within the DAG in which it was encountered

-
size: bigint

The size of the entry

-
type: "directory"

A disambiguator to allow TypeScript to work out the type of the entry.

+
depth: number

How far down the DAG the entry is

+
name: string

The name of the entry

+
node: PBNode
path: string

The path of the entry within the DAG in which it was encountered

+
size: bigint

The size of the entry

+
type: "directory"

A disambiguator to allow TypeScript to work out the type of the entry.

Example

if (entry.type === 'file') {
// access UnixFSFile properties safely
}

if (entry.type === 'directory') {
// access UnixFSDirectory properties safely
}
-
unixfs: UnixFS

Methods

unixfs: UnixFS

Methods

  • Parameters

    Returns AsyncGenerator<UnixFSEntry, void, unknown>

    Example: File content

    When entry is a file or a raw node, offset and/or length arguments can be passed to entry.content() to return slices of data:

    const length = 5
    const data = new Uint8Array(length)
    let offset = 0

    for await (const chunk of entry.content({
    offset: 0,
    length
    })) {
    data.set(chunk, offset)
    offset += chunk.length
    }

    // `data` contains the first 5 bytes of the file
    return data

    Example: Directory content

    If entry is a directory, passing offset and/or length to entry.content() will limit the number of files returned from the directory.

    const entries = []

    for await (const entry of dir.content({
    offset: 0,
    length: 5
    })) {
    entries.push(entry)
    }

    // `entries` contains the first 5 files/directories in the directory
    -
\ No newline at end of file +
\ No newline at end of file diff --git a/interfaces/ipfs_unixfs_exporter.UnixFSFile.html b/interfaces/ipfs_unixfs_exporter.UnixFSFile.html index f35c241d..f1ce5aea 100644 --- a/interfaces/ipfs_unixfs_exporter.UnixFSFile.html +++ b/interfaces/ipfs_unixfs_exporter.UnixFSFile.html @@ -1,7 +1,7 @@ UnixFSFile | UnixFS

If the entry is a file, entry.content() returns an async iterator that yields one or more Uint8Arrays containing the file content:

if (entry.type === 'file') {
for await (const chunk of entry.content()) {
// chunk is a Buffer
}
}
-
interface UnixFSFile {
    cid: CID<unknown, number, number, Version>;
    depth: number;
    name: string;
    node: PBNode;
    path: string;
    size: bigint;
    type: "file";
    unixfs: UnixFS;
    content(options?): AsyncGenerator<Uint8Array, void, unknown>;
}

Hierarchy (view full)

Properties

cid +
interface UnixFSFile {
    cid: CID<unknown, number, number, Version>;
    depth: number;
    name: string;
    node: PBNode;
    path: string;
    size: bigint;
    type: "file";
    unixfs: UnixFS;
    content(options?): AsyncGenerator<Uint8Array, void, unknown>;
}

Hierarchy (view full)

Properties

cid depth name node @@ -11,17 +11,17 @@ unixfs

Methods

Properties

cid: CID<unknown, number, number, Version>

The CID of the entry

-
depth: number

How far down the DAG the entry is

-
name: string

The name of the entry

-
node: PBNode
path: string

The path of the entry within the DAG in which it was encountered

-
size: bigint

The size of the entry

-
type: "file"

A disambiguator to allow TypeScript to work out the type of the entry.

+
depth: number

How far down the DAG the entry is

+
name: string

The name of the entry

+
node: PBNode
path: string

The path of the entry within the DAG in which it was encountered

+
size: bigint

The size of the entry

+
type: "file"

A disambiguator to allow TypeScript to work out the type of the entry.

Example

if (entry.type === 'file') {
// access UnixFSFile properties safely
}

if (entry.type === 'directory') {
// access UnixFSDirectory properties safely
}
-
unixfs: UnixFS

Methods

unixfs: UnixFS

Methods

  • Parameters

    Returns AsyncGenerator<Uint8Array, void, unknown>

    Example: File content

    When entry is a file or a raw node, offset and/or length arguments can be passed to entry.content() to return slices of data:

    const length = 5
    const data = new Uint8Array(length)
    let offset = 0

    for await (const chunk of entry.content({
    offset: 0,
    length
    })) {
    data.set(chunk, offset)
    offset += chunk.length
    }

    // `data` contains the first 5 bytes of the file
    return data

    Example: Directory content

    If entry is a directory, passing offset and/or length to entry.content() will limit the number of files returned from the directory.

    const entries = []

    for await (const entry of dir.content({
    offset: 0,
    length: 5
    })) {
    entries.push(entry)
    }

    // `entries` contains the first 5 files/directories in the directory
    -
\ No newline at end of file +
\ No newline at end of file diff --git a/interfaces/ipfs_unixfs_exporter.UnixfsV1Resolver.html b/interfaces/ipfs_unixfs_exporter.UnixfsV1Resolver.html index 5f14661a..5ba56125 100644 --- a/interfaces/ipfs_unixfs_exporter.UnixfsV1Resolver.html +++ b/interfaces/ipfs_unixfs_exporter.UnixfsV1Resolver.html @@ -1 +1 @@ -UnixfsV1Resolver | UnixFS
interface UnixfsV1Resolver ((cid, node, unixfs, path, resolve, depth, blockstore) => ((options) => UnixfsV1Content))
\ No newline at end of file +UnixfsV1Resolver | UnixFS
interface UnixfsV1Resolver ((cid, node, unixfs, path, resolve, depth, blockstore) => ((options) => UnixfsV1Content))
\ No newline at end of file diff --git a/interfaces/ipfs_unixfs_importer.chunker.Chunker.html b/interfaces/ipfs_unixfs_importer.chunker.Chunker.html index 4e43343d..0028a7c6 100644 --- a/interfaces/ipfs_unixfs_importer.chunker.Chunker.html +++ b/interfaces/ipfs_unixfs_importer.chunker.Chunker.html @@ -1 +1 @@ -Chunker | UnixFS
interface Chunker ((source) => AsyncIterable<Uint8Array>)
\ No newline at end of file +Chunker | UnixFS
interface Chunker ((source) => AsyncIterable<Uint8Array>)
\ No newline at end of file diff --git a/interfaces/ipfs_unixfs_importer.index.BufferImporter.html b/interfaces/ipfs_unixfs_importer.index.BufferImporter.html index 50d312f9..b9c1b991 100644 --- a/interfaces/ipfs_unixfs_importer.index.BufferImporter.html +++ b/interfaces/ipfs_unixfs_importer.index.BufferImporter.html @@ -1 +1 @@ -BufferImporter | UnixFS
interface BufferImporter ((file, blockstore) => AsyncIterable<(() => Promise<BufferImporterResult>)>)
\ No newline at end of file +BufferImporter | UnixFS
interface BufferImporter ((file, blockstore) => AsyncIterable<(() => Promise<BufferImporterResult>)>)
\ No newline at end of file diff --git a/interfaces/ipfs_unixfs_importer.index.BufferImporterResult.html b/interfaces/ipfs_unixfs_importer.index.BufferImporterResult.html index 75552059..df56439d 100644 --- a/interfaces/ipfs_unixfs_importer.index.BufferImporterResult.html +++ b/interfaces/ipfs_unixfs_importer.index.BufferImporterResult.html @@ -1,6 +1,6 @@ -BufferImporterResult | UnixFS
interface BufferImporterResult {
    block: Uint8Array;
    cid: CID<unknown, number, number, Version>;
    path?: string;
    size: bigint;
    unixfs?: UnixFS;
}

Hierarchy (view full)

Properties

block +BufferImporterResult | UnixFS
interface BufferImporterResult {
    block: Uint8Array;
    cid: CID<unknown, number, number, Version>;
    path?: string;
    size: bigint;
    unixfs?: UnixFS;
}

Hierarchy (view full)

Properties

Properties

block: Uint8Array
cid: CID<unknown, number, number, Version>
path?: string
size: bigint
unixfs?: UnixFS
\ No newline at end of file +

Properties

block: Uint8Array
cid: CID<unknown, number, number, Version>
path?: string
size: bigint
unixfs?: UnixFS
\ No newline at end of file diff --git a/interfaces/ipfs_unixfs_importer.index.Directory.html b/interfaces/ipfs_unixfs_importer.index.Directory.html index 601b611c..61d05734 100644 --- a/interfaces/ipfs_unixfs_importer.index.Directory.html +++ b/interfaces/ipfs_unixfs_importer.index.Directory.html @@ -1,5 +1,5 @@ -Directory | UnixFS
interface Directory {
    mode?: number;
    mtime?: Mtime;
    originalPath?: string;
    path?: string;
}

Properties

mode? +Directory | UnixFS
interface Directory {
    mode?: number;
    mtime?: Mtime;
    originalPath?: string;
    path?: string;
}

Properties

mode?: number
mtime?: Mtime
originalPath?: string
path?: string
\ No newline at end of file +

Properties

mode?: number
mtime?: Mtime
originalPath?: string
path?: string
\ No newline at end of file diff --git a/interfaces/ipfs_unixfs_importer.index.DirectoryCandidate.html b/interfaces/ipfs_unixfs_importer.index.DirectoryCandidate.html index b9ac519e..ce89cb26 100644 --- a/interfaces/ipfs_unixfs_importer.index.DirectoryCandidate.html +++ b/interfaces/ipfs_unixfs_importer.index.DirectoryCandidate.html @@ -1,4 +1,4 @@ -DirectoryCandidate | UnixFS
interface DirectoryCandidate {
    mode?: number;
    mtime?: Mtime;
    path: string;
}

Properties

mode? +DirectoryCandidate | UnixFS
interface DirectoryCandidate {
    mode?: number;
    mtime?: Mtime;
    path: string;
}

Properties

Properties

mode?: number
mtime?: Mtime
path: string
\ No newline at end of file +

Properties

mode?: number
mtime?: Mtime
path: string
\ No newline at end of file diff --git a/interfaces/ipfs_unixfs_importer.index.File.html b/interfaces/ipfs_unixfs_importer.index.File.html index a1735248..510a1368 100644 --- a/interfaces/ipfs_unixfs_importer.index.File.html +++ b/interfaces/ipfs_unixfs_importer.index.File.html @@ -1,6 +1,6 @@ -File | UnixFS
interface File {
    content: AsyncIterable<Uint8Array>;
    mode?: number;
    mtime?: Mtime;
    originalPath?: string;
    path?: string;
}

Properties

content +File | UnixFS
interface File {
    content: AsyncIterable<Uint8Array>;
    mode?: number;
    mtime?: Mtime;
    originalPath?: string;
    path?: string;
}

Properties

content: AsyncIterable<Uint8Array>
mode?: number
mtime?: Mtime
originalPath?: string
path?: string
\ No newline at end of file +

Properties

content: AsyncIterable<Uint8Array>
mode?: number
mtime?: Mtime
originalPath?: string
path?: string
\ No newline at end of file diff --git a/interfaces/ipfs_unixfs_importer.index.FileCandidate.html b/interfaces/ipfs_unixfs_importer.index.FileCandidate.html index 9a37e107..f5c43748 100644 --- a/interfaces/ipfs_unixfs_importer.index.FileCandidate.html +++ b/interfaces/ipfs_unixfs_importer.index.FileCandidate.html @@ -1,5 +1,5 @@ -FileCandidate | UnixFS
interface FileCandidate<T> {
    content: T;
    mode?: number;
    mtime?: Mtime;
    path?: string;
}

Type Parameters

Properties

content +FileCandidate | UnixFS
interface FileCandidate<T> {
    content: T;
    mode?: number;
    mtime?: Mtime;
    path?: string;
}

Type Parameters

Properties

content: T
mode?: number
mtime?: Mtime
path?: string
\ No newline at end of file +

Properties

content: T
mode?: number
mtime?: Mtime
path?: string
\ No newline at end of file diff --git a/interfaces/ipfs_unixfs_importer.index.HamtHashFn.html b/interfaces/ipfs_unixfs_importer.index.HamtHashFn.html index 3afaa8a5..ad53aae4 100644 --- a/interfaces/ipfs_unixfs_importer.index.HamtHashFn.html +++ b/interfaces/ipfs_unixfs_importer.index.HamtHashFn.html @@ -1 +1 @@ -HamtHashFn | UnixFS
interface HamtHashFn ((value) => Promise<Uint8Array>)
\ No newline at end of file +HamtHashFn | UnixFS
interface HamtHashFn ((value) => Promise<Uint8Array>)
\ No newline at end of file diff --git a/interfaces/ipfs_unixfs_importer.index.ImportResult.html b/interfaces/ipfs_unixfs_importer.index.ImportResult.html index f3d27416..6280d0b3 100644 --- a/interfaces/ipfs_unixfs_importer.index.ImportResult.html +++ b/interfaces/ipfs_unixfs_importer.index.ImportResult.html @@ -1,5 +1,5 @@ -ImportResult | UnixFS
interface ImportResult {
    cid: CID<unknown, number, number, Version>;
    path?: string;
    size: bigint;
    unixfs?: UnixFS;
}

Hierarchy (view full)

Properties

cid +ImportResult | UnixFS
interface ImportResult {
    cid: CID<unknown, number, number, Version>;
    path?: string;
    size: bigint;
    unixfs?: UnixFS;
}

Hierarchy (view full)

Properties

Properties

cid: CID<unknown, number, number, Version>
path?: string
size: bigint
unixfs?: UnixFS
\ No newline at end of file +

Properties

cid: CID<unknown, number, number, Version>
path?: string
size: bigint
unixfs?: UnixFS
\ No newline at end of file diff --git a/interfaces/ipfs_unixfs_importer.index.ImporterOptions.html b/interfaces/ipfs_unixfs_importer.index.ImporterOptions.html index 282c1b9b..eda09a1f 100644 --- a/interfaces/ipfs_unixfs_importer.index.ImporterOptions.html +++ b/interfaces/ipfs_unixfs_importer.index.ImporterOptions.html @@ -1,5 +1,5 @@ ImporterOptions | UnixFS

Options to control the importer's behaviour

-
interface ImporterOptions {
    blockWriteConcurrency?: number;
    bufferImporter?: BufferImporter;
    chunkValidator?: ChunkValidator;
    chunker?: Chunker;
    cidVersion?: Version;
    dagBuilder?: DAGBuilder;
    fileImportConcurrency?: number;
    layout?: FileLayout;
    leafType?: "file" | "raw";
    onProgress?: ((evt) => void);
    rawLeaves?: boolean;
    reduceSingleLeafToSelf?: boolean;
    shardFanoutBits?: number;
    shardSplitThresholdBytes?: number;
    treeBuilder?: TreeBuilder;
    wrapWithDirectory?: boolean;
}

Hierarchy

Properties

interface ImporterOptions {
    blockWriteConcurrency?: number;
    bufferImporter?: BufferImporter;
    chunkValidator?: ChunkValidator;
    chunker?: Chunker;
    cidVersion?: Version;
    dagBuilder?: DAGBuilder;
    fileImportConcurrency?: number;
    layout?: FileLayout;
    leafType?: "file" | "raw";
    onProgress?: ((evt) => void);
    rawLeaves?: boolean;
    reduceSingleLeafToSelf?: boolean;
    shardFanoutBits?: number;
    shardSplitThresholdBytes?: number;
    treeBuilder?: TreeBuilder;
    wrapWithDirectory?: boolean;
}

Hierarchy

Properties

blockWriteConcurrency?: number

How many blocks to hash and write to the block store concurrently. For small numbers of large files this should be high (e.g. 50). Default: 50

-
bufferImporter?: BufferImporter

This option can be used to override the importer internals.

+
bufferImporter?: BufferImporter

This option can be used to override the importer internals.

This function should read Buffers from source and persist them using blockstore.put or similar entry is the { path, content } entry, where entry.content is an async @@ -26,15 +26,15 @@ the properties { cid, unixfs, size } where cid is a [CID], unixfs is a [UnixFS] entry and size is a Number that represents the serialized size of the [IPLD] node that holds the buffer data. Values will be pulled from this generator in parallel - the amount of parallelisation is controlled by the blockWriteConcurrency option (default: 10)

-
chunkValidator?: ChunkValidator

This option can be used to override the importer internals.

+
chunkValidator?: ChunkValidator

This option can be used to override the importer internals.

This function takes input from the content field of imported entries. It should transform them into Buffers, throwing an error if it cannot. It should yield Buffer objects constructed from the source or throw an Error

-
chunker?: Chunker

The chunking strategy. See ./src/chunker/index.ts +

chunker?: Chunker

The chunking strategy. See ./src/chunker/index.ts for available chunkers. Default: fixedSize

-
cidVersion?: Version

the CID version to use when storing the data. Default: 1

-
dagBuilder?: DAGBuilder

This option can be used to override the importer internals.

+
cidVersion?: Version

the CID version to use when storing the data. Default: 1

+
dagBuilder?: DAGBuilder

This option can be used to override the importer internals.

This function should read { path, content } entries from source and turn them into DAGs It should yield a function that returns a Promise that resolves to @@ -42,32 +42,32 @@ is a UnixFS entry and node is a DAGNode. Values will be pulled from this generator in parallel - the amount of parallelisation is controlled by the fileImportConcurrency option (default: 50)

-
fileImportConcurrency?: number

How many files to import concurrently. For large numbers of small files this +

fileImportConcurrency?: number

How many files to import concurrently. For large numbers of small files this should be high (e.g. 50). Default: 10

-
layout?: FileLayout

How the DAG that represents files are created. See +

layout?: FileLayout

How the DAG that represents files are created. See ./src/layout/index.ts for available layouts. Default: balanced

-
leafType?: "file" | "raw"

What type of UnixFS node leaves should be - can be 'file' or 'raw' +

leafType?: "file" | "raw"

What type of UnixFS node leaves should be - can be 'file' or 'raw' (ignored when rawLeaves is true).

This option exists to simulate kubo's trickle dag which uses a combination of 'raw' UnixFS leaves and reduceSingleLeafToSelf: false.

For modern code the rawLeaves: true option should be used instead so leaves are plain Uint8Arrays without a UnixFS/Protobuf wrapper.

-
onProgress?: ((evt) => void)

Type declaration

rawLeaves?: boolean

When a file would span multiple DAGNodes, if this is true the leaf nodes +

onProgress?: ((evt) => void)

Type declaration

rawLeaves?: boolean

When a file would span multiple DAGNodes, if this is true the leaf nodes will not be wrapped in UnixFS protobufs and will instead contain the raw file bytes. Default: true

-
reduceSingleLeafToSelf?: boolean

If the file being imported is small enough to fit into one DAGNodes, store +

reduceSingleLeafToSelf?: boolean

If the file being imported is small enough to fit into one DAGNodes, store the file data in the root node along with the UnixFS metadata instead of in a leaf node which would then require additional I/O to load. Default: true

-
shardFanoutBits?: number

The number of bits of a hash digest used at each level of sharding to +

shardFanoutBits?: number

The number of bits of a hash digest used at each level of sharding to the child index. 2**shardFanoutBits will dictate the maximum number of children for any shard in the HAMT. Default: 8

-
shardSplitThresholdBytes?: number

If the serialized node is larger than this it might be converted to a HAMT +

shardSplitThresholdBytes?: number

If the serialized node is larger than this it might be converted to a HAMT sharded directory. Default: 256KiB

-
treeBuilder?: TreeBuilder

This option can be used to override the importer internals.

+
treeBuilder?: TreeBuilder

This option can be used to override the importer internals.

This function should read { cid, path, unixfs, node } entries from source and place them in a directory structure It should yield an object with the properties { cid, path, unixfs, size } where cid is a CID, path is a string, unixfs is a UnixFS entry and size is a Number.

-
wrapWithDirectory?: boolean

If true, all imported files and folders will be contained in a directory that +

wrapWithDirectory?: boolean

If true, all imported files and folders will be contained in a directory that will correspond to the CID of the final entry yielded. Default: false

-
\ No newline at end of file +
\ No newline at end of file diff --git a/interfaces/ipfs_unixfs_importer.index.MultipleBlockImportResult.html b/interfaces/ipfs_unixfs_importer.index.MultipleBlockImportResult.html index 3fb9a616..bb5d0b05 100644 --- a/interfaces/ipfs_unixfs_importer.index.MultipleBlockImportResult.html +++ b/interfaces/ipfs_unixfs_importer.index.MultipleBlockImportResult.html @@ -1,6 +1,6 @@ -MultipleBlockImportResult | UnixFS
interface MultipleBlockImportResult {
    cid: CID<unknown, number, number, Version>;
    originalPath?: string;
    path?: string;
    size: bigint;
    unixfs?: UnixFS;
}

Hierarchy (view full)

Properties

cid +MultipleBlockImportResult | UnixFS
interface MultipleBlockImportResult {
    cid: CID<unknown, number, number, Version>;
    originalPath?: string;
    path?: string;
    size: bigint;
    unixfs?: UnixFS;
}

Hierarchy (view full)

Properties

cid: CID<unknown, number, number, Version>
originalPath?: string
path?: string
size: bigint
unixfs?: UnixFS
\ No newline at end of file +

Properties

cid: CID<unknown, number, number, Version>
originalPath?: string
path?: string
size: bigint
unixfs?: UnixFS
\ No newline at end of file diff --git a/interfaces/ipfs_unixfs_importer.index.SingleBlockImportResult.html b/interfaces/ipfs_unixfs_importer.index.SingleBlockImportResult.html index df9a0758..10de5ad7 100644 --- a/interfaces/ipfs_unixfs_importer.index.SingleBlockImportResult.html +++ b/interfaces/ipfs_unixfs_importer.index.SingleBlockImportResult.html @@ -1,8 +1,8 @@ -SingleBlockImportResult | UnixFS
interface SingleBlockImportResult {
    block: Uint8Array;
    cid: CID<unknown, number, number, Version>;
    originalPath?: string;
    path?: string;
    single: true;
    size: bigint;
    unixfs?: UnixFS;
}

Hierarchy (view full)

Properties

block +SingleBlockImportResult | UnixFS
interface SingleBlockImportResult {
    block: Uint8Array;
    cid: CID<unknown, number, number, Version>;
    originalPath?: string;
    path?: string;
    single: true;
    size: bigint;
    unixfs?: UnixFS;
}

Hierarchy (view full)

Properties

block: Uint8Array
cid: CID<unknown, number, number, Version>
originalPath?: string
path?: string
single: true
size: bigint
unixfs?: UnixFS
\ No newline at end of file +

Properties

block: Uint8Array
cid: CID<unknown, number, number, Version>
originalPath?: string
path?: string
single: true
size: bigint
unixfs?: UnixFS
\ No newline at end of file diff --git a/interfaces/ipfs_unixfs_importer.index.TreeBuilder.html b/interfaces/ipfs_unixfs_importer.index.TreeBuilder.html index a11e0d2f..42c0094d 100644 --- a/interfaces/ipfs_unixfs_importer.index.TreeBuilder.html +++ b/interfaces/ipfs_unixfs_importer.index.TreeBuilder.html @@ -1 +1 @@ -TreeBuilder | UnixFS
interface TreeBuilder ((source, blockstore) => AsyncIterable<ImportResult>)
\ No newline at end of file +TreeBuilder | UnixFS
interface TreeBuilder ((source, blockstore) => AsyncIterable<ImportResult>)
\ No newline at end of file diff --git a/interfaces/ipfs_unixfs_importer.layout.FileLayout.html b/interfaces/ipfs_unixfs_importer.layout.FileLayout.html index 94dade4e..6d2281aa 100644 --- a/interfaces/ipfs_unixfs_importer.layout.FileLayout.html +++ b/interfaces/ipfs_unixfs_importer.layout.FileLayout.html @@ -1 +1 @@ -FileLayout | UnixFS
interface FileLayout ((source, reducer) => Promise<InProgressImportResult>)
\ No newline at end of file +FileLayout | UnixFS
interface FileLayout ((source, reducer) => Promise<InProgressImportResult>)
\ No newline at end of file diff --git a/interfaces/ipfs_unixfs_importer.layout.Reducer.html b/interfaces/ipfs_unixfs_importer.layout.Reducer.html index ab4c3342..4b625100 100644 --- a/interfaces/ipfs_unixfs_importer.layout.Reducer.html +++ b/interfaces/ipfs_unixfs_importer.layout.Reducer.html @@ -1 +1 @@ -Reducer | UnixFS
interface Reducer ((leaves) => Promise<InProgressImportResult>)
\ No newline at end of file +Reducer | UnixFS
interface Reducer ((leaves) => Promise<InProgressImportResult>)
\ No newline at end of file diff --git a/modules/ipfs_unixfs.html b/modules/ipfs_unixfs.html index b2911e20..fe244ee3 100644 --- a/modules/ipfs_unixfs.html +++ b/modules/ipfs_unixfs.html @@ -98,7 +98,7 @@

Example: Has an mtime been set?

If no modification time has been set,

Install

$ npm i ipfs-unixfs
 
-

Browser <script> tag

Loading this module through a script tag will make it's exports available as IpfsUnixfs in the global namespace.

+

Browser <script> tag

Loading this module through a script tag will make its exports available as IpfsUnixfs in the global namespace.

<script src="https://unpkg.com/ipfs-unixfs/dist/index.min.js"></script>
 

API Docs

License

Licensed under either of

Contribute

Contributions welcome! Please check out the issues.

Also see our contributing document for more information on how we work, and about contributing in general.

diff --git a/modules/ipfs_unixfs_exporter.html b/modules/ipfs_unixfs_exporter.html index fb9f30a7..28a648dd 100644 --- a/modules/ipfs_unixfs_exporter.html +++ b/modules/ipfs_unixfs_exporter.html @@ -28,7 +28,7 @@

Install

$ npm i ipfs-unixfs-exporter
 
-

Browser <script> tag

Loading this module through a script tag will make it's exports available as IpfsUnixfsExporter in the global namespace.

+

Browser <script> tag

Loading this module through a script tag will make its exports available as IpfsUnixfsExporter in the global namespace.

<script src="https://unpkg.com/ipfs-unixfs-exporter/dist/index.min.js"></script>
 

API Docs

License

Licensed under either of

Contribute

Contributions welcome! Please check out the issues.

Also see our contributing document for more information on how we work, and about contributing in general.

diff --git a/modules/ipfs_unixfs_importer.chunker.html b/modules/ipfs_unixfs_importer.chunker.html index 998b7532..e9960888 100644 --- a/modules/ipfs_unixfs_importer.chunker.html +++ b/modules/ipfs_unixfs_importer.chunker.html @@ -1,7 +1,7 @@ chunker | UnixFS

Chunker functions split an incoming stream of bytes into chunks.

The default is a fixed-size chunker which splits them into equally sized chunks though other strategies are available such as Rabin chunking.

-

Index

Interfaces

Index

Interfaces

Functions

\ No newline at end of file diff --git a/modules/ipfs_unixfs_importer.html b/modules/ipfs_unixfs_importer.html index e2502e62..7991dc2a 100644 --- a/modules/ipfs_unixfs_importer.html +++ b/modules/ipfs_unixfs_importer.html @@ -31,7 +31,7 @@

Install

$ npm i ipfs-unixfs-importer
 
-

Browser <script> tag

Loading this module through a script tag will make it's exports available as IpfsUnixfsImporter in the global namespace.

+

Browser <script> tag

Loading this module through a script tag will make its exports available as IpfsUnixfsImporter in the global namespace.

<script src="https://unpkg.com/ipfs-unixfs-importer/dist/index.min.js"></script>
 

API Docs

License

Licensed under either of

Contribute

Contributions welcome! Please check out the issues.

Also see our contributing document for more information on how we work, and about contributing in general.

diff --git a/modules/ipfs_unixfs_importer.index.html b/modules/ipfs_unixfs_importer.index.html index 23c5ad89..8030cca3 100644 --- a/modules/ipfs_unixfs_importer.index.html +++ b/modules/ipfs_unixfs_importer.index.html @@ -7,7 +7,7 @@

When run, metadata about DAGNodes in the created tree is printed until the root:

{
cid: CID, // see https://github.com/multiformats/js-cid
path: 'tmp/foo/bar',
unixfs: UnixFS // see https://github.com/ipfs/js-ipfs-unixfs
}
{
cid: CID, // see https://github.com/multiformats/js-cid
path: 'tmp/foo/quxx',
unixfs: UnixFS // see https://github.com/ipfs/js-ipfs-unixfs
}
{
cid: CID, // see https://github.com/multiformats/js-cid
path: 'tmp/foo',
unixfs: UnixFS // see https://github.com/ipfs/js-ipfs-unixfs
}
{
cid: CID, // see https://github.com/multiformats/js-cid
path: 'tmp',
unixfs: UnixFS // see https://github.com/ipfs/js-ipfs-unixfs
}
-

Index

Interfaces

Index

Interfaces

BufferImporter BufferImporterResult Directory DirectoryCandidate diff --git a/modules/ipfs_unixfs_importer.layout.html b/modules/ipfs_unixfs_importer.layout.html index a52e0c2e..80f1867e 100644 --- a/modules/ipfs_unixfs_importer.layout.html +++ b/modules/ipfs_unixfs_importer.layout.html @@ -1,6 +1,6 @@ layout | UnixFS

Layout functions allow customising the shape of final DAGs

https://dag.ipfs.tech can be used to explore different conigurations.

-

Index

Interfaces

Index

Interfaces

Functions

balanced flat diff --git a/types/ipfs_unixfs.MtimeLike.html b/types/ipfs_unixfs.MtimeLike.html index a3c80ece..d07871fe 100644 --- a/types/ipfs_unixfs.MtimeLike.html +++ b/types/ipfs_unixfs.MtimeLike.html @@ -1 +1 @@ -MtimeLike | UnixFS

Type alias MtimeLike

MtimeLike: Mtime | {
    FractionalNanoseconds?: number;
    Seconds: number;
} | [number, number] | Date

Type declaration

  • Optional FractionalNanoseconds?: number
  • Seconds: number
\ No newline at end of file +MtimeLike | UnixFS

Type alias MtimeLike

MtimeLike: Mtime | {
    FractionalNanoseconds?: number;
    Seconds: number;
} | [number, number] | Date

Type declaration

  • Optional FractionalNanoseconds?: number
  • Seconds: number
\ No newline at end of file diff --git a/types/ipfs_unixfs_exporter.ExporterProgressEvents.html b/types/ipfs_unixfs_exporter.ExporterProgressEvents.html index fa468c42..cc5fc857 100644 --- a/types/ipfs_unixfs_exporter.ExporterProgressEvents.html +++ b/types/ipfs_unixfs_exporter.ExporterProgressEvents.html @@ -1,2 +1,2 @@ ExporterProgressEvents | UnixFS

Type alias ExporterProgressEvents

ExporterProgressEvents: ProgressEvent<"unixfs:exporter:progress:unixfs:file", ExportProgress> | ProgressEvent<"unixfs:exporter:progress:unixfs:raw", ExportProgress> | ProgressEvent<"unixfs:exporter:progress:raw", ExportProgress> | ProgressEvent<"unixfs:exporter:progress:identity", ExportProgress> | ProgressEvent<"unixfs:exporter:walk:file", ExportWalk> | ProgressEvent<"unixfs:exporter:walk:directory", ExportWalk> | ProgressEvent<"unixfs:exporter:walk:hamt-sharded-directory", ExportWalk> | ProgressEvent<"unixfs:exporter:walk:raw", ExportWalk>

Progress events emitted by the exporter

-
\ No newline at end of file +
\ No newline at end of file diff --git a/types/ipfs_unixfs_exporter.ReadableStorage.html b/types/ipfs_unixfs_exporter.ReadableStorage.html index 39c8e674..ba835044 100644 --- a/types/ipfs_unixfs_exporter.ReadableStorage.html +++ b/types/ipfs_unixfs_exporter.ReadableStorage.html @@ -1,3 +1,3 @@ ReadableStorage | UnixFS
ReadableStorage: Pick<Blockstore, "get">

A subset of the Blockstore interface that just contains the get method.

-
\ No newline at end of file +
\ No newline at end of file diff --git a/types/ipfs_unixfs_exporter.UnixFSEntry.html b/types/ipfs_unixfs_exporter.UnixFSEntry.html index 32d08564..4d9d7753 100644 --- a/types/ipfs_unixfs_exporter.UnixFSEntry.html +++ b/types/ipfs_unixfs_exporter.UnixFSEntry.html @@ -1,3 +1,3 @@ UnixFSEntry | UnixFS

A UnixFSEntry is a representation of the types of node that can be encountered in a DAG.

-
\ No newline at end of file +
\ No newline at end of file diff --git a/types/ipfs_unixfs_exporter.UnixfsV1Content.html b/types/ipfs_unixfs_exporter.UnixfsV1Content.html index 8ea85d3f..111e5217 100644 --- a/types/ipfs_unixfs_exporter.UnixfsV1Content.html +++ b/types/ipfs_unixfs_exporter.UnixfsV1Content.html @@ -1 +1 @@ -UnixfsV1Content | UnixFS
\ No newline at end of file +UnixfsV1Content | UnixFS
\ No newline at end of file diff --git a/types/ipfs_unixfs_exporter.UnixfsV1DirectoryContent.html b/types/ipfs_unixfs_exporter.UnixfsV1DirectoryContent.html index 08a20410..6d054e05 100644 --- a/types/ipfs_unixfs_exporter.UnixfsV1DirectoryContent.html +++ b/types/ipfs_unixfs_exporter.UnixfsV1DirectoryContent.html @@ -1 +1 @@ -UnixfsV1DirectoryContent | UnixFS

Type alias UnixfsV1DirectoryContent

UnixfsV1DirectoryContent: AsyncIterable<UnixFSEntry> | Iterable<UnixFSEntry>
\ No newline at end of file +UnixfsV1DirectoryContent | UnixFS

Type alias UnixfsV1DirectoryContent

UnixfsV1DirectoryContent: AsyncIterable<UnixFSEntry> | Iterable<UnixFSEntry>
\ No newline at end of file diff --git a/types/ipfs_unixfs_exporter.UnixfsV1FileContent.html b/types/ipfs_unixfs_exporter.UnixfsV1FileContent.html index 8fa165d0..8165a2e5 100644 --- a/types/ipfs_unixfs_exporter.UnixfsV1FileContent.html +++ b/types/ipfs_unixfs_exporter.UnixfsV1FileContent.html @@ -1 +1 @@ -UnixfsV1FileContent | UnixFS

Type alias UnixfsV1FileContent

UnixfsV1FileContent: AsyncIterable<Uint8Array> | Iterable<Uint8Array>
\ No newline at end of file +UnixfsV1FileContent | UnixFS

Type alias UnixfsV1FileContent

UnixfsV1FileContent: AsyncIterable<Uint8Array> | Iterable<Uint8Array>
\ No newline at end of file diff --git a/types/ipfs_unixfs_importer.index.ByteStream.html b/types/ipfs_unixfs_importer.index.ByteStream.html index 0b351f40..c5db0b01 100644 --- a/types/ipfs_unixfs_importer.index.ByteStream.html +++ b/types/ipfs_unixfs_importer.index.ByteStream.html @@ -1 +1 @@ -ByteStream | UnixFS
\ No newline at end of file +ByteStream | UnixFS
\ No newline at end of file diff --git a/types/ipfs_unixfs_importer.index.ImportCandidate.html b/types/ipfs_unixfs_importer.index.ImportCandidate.html index 991218cc..f2d05869 100644 --- a/types/ipfs_unixfs_importer.index.ImportCandidate.html +++ b/types/ipfs_unixfs_importer.index.ImportCandidate.html @@ -1 +1 @@ -ImportCandidate | UnixFS
\ No newline at end of file +ImportCandidate | UnixFS
\ No newline at end of file diff --git a/types/ipfs_unixfs_importer.index.ImportCandidateStream.html b/types/ipfs_unixfs_importer.index.ImportCandidateStream.html index 99d1adbb..8c108b2f 100644 --- a/types/ipfs_unixfs_importer.index.ImportCandidateStream.html +++ b/types/ipfs_unixfs_importer.index.ImportCandidateStream.html @@ -1 +1 @@ -ImportCandidateStream | UnixFS
\ No newline at end of file +ImportCandidateStream | UnixFS
\ No newline at end of file diff --git a/types/ipfs_unixfs_importer.index.ImportContent.html b/types/ipfs_unixfs_importer.index.ImportContent.html index 858aad1b..cc686085 100644 --- a/types/ipfs_unixfs_importer.index.ImportContent.html +++ b/types/ipfs_unixfs_importer.index.ImportContent.html @@ -1 +1 @@ -ImportContent | UnixFS
\ No newline at end of file +ImportContent | UnixFS
\ No newline at end of file diff --git a/types/ipfs_unixfs_importer.index.ImporterProgressEvents.html b/types/ipfs_unixfs_importer.index.ImporterProgressEvents.html index e3a38006..171ce937 100644 --- a/types/ipfs_unixfs_importer.index.ImporterProgressEvents.html +++ b/types/ipfs_unixfs_importer.index.ImporterProgressEvents.html @@ -1 +1 @@ -ImporterProgressEvents | UnixFS
\ No newline at end of file +ImporterProgressEvents | UnixFS
\ No newline at end of file diff --git a/types/ipfs_unixfs_importer.index.InProgressImportResult.html b/types/ipfs_unixfs_importer.index.InProgressImportResult.html index abcd9a42..fb00ff4b 100644 --- a/types/ipfs_unixfs_importer.index.InProgressImportResult.html +++ b/types/ipfs_unixfs_importer.index.InProgressImportResult.html @@ -1 +1 @@ -InProgressImportResult | UnixFS
\ No newline at end of file +InProgressImportResult | UnixFS
\ No newline at end of file diff --git a/types/ipfs_unixfs_importer.index.WritableStorage.html b/types/ipfs_unixfs_importer.index.WritableStorage.html index ef5811f2..9cb6d8a4 100644 --- a/types/ipfs_unixfs_importer.index.WritableStorage.html +++ b/types/ipfs_unixfs_importer.index.WritableStorage.html @@ -1 +1 @@ -WritableStorage | UnixFS
\ No newline at end of file +WritableStorage | UnixFS
\ No newline at end of file