ipfs-unixfs-exporter
Advanced tools
Comparing version
@@ -8,3 +8,3 @@ /** | ||
* | ||
* ```js | ||
* ```TypeScript | ||
* // import a file and export it again | ||
@@ -30,2 +30,6 @@ * import { importer } from 'ipfs-unixfs-importer' | ||
* | ||
* if (entry.type !== 'file') { | ||
* throw new Error('Unexpected entry type') | ||
* } | ||
* | ||
* console.info(entry.cid) // Qmqux | ||
@@ -38,3 +42,3 @@ * console.info(entry.path) // Qmbaz/foo/bar.txt | ||
* const size = entry.unixfs.fileSize() | ||
* const bytes = new Uint8Array(size) | ||
* const bytes = new Uint8Array(Number(size)) | ||
* let offset = 0 | ||
@@ -44,3 +48,3 @@ * | ||
* bytes.set(buf, offset) | ||
* offset += chunk.length | ||
* offset += buf.byteLength | ||
* } | ||
@@ -158,3 +162,3 @@ * | ||
* | ||
* ```javascript | ||
* ```TypeScript | ||
* const length = 5 | ||
@@ -180,3 +184,3 @@ * const data = new Uint8Array(length) | ||
* | ||
* ```javascript | ||
* ```TypeScript | ||
* const entries = [] | ||
@@ -199,3 +203,3 @@ * | ||
* | ||
* ```javascript | ||
* ```TypeScript | ||
* if (entry.type === 'file') { | ||
@@ -216,3 +220,3 @@ * for await (const chunk of entry.content()) { | ||
* | ||
* ```javascript | ||
* ```TypeScript | ||
* if (entry.type === 'directory') { | ||
@@ -242,3 +246,3 @@ * for await (const entry of dir.content()) { | ||
* | ||
* ```javascript | ||
* ```TypeScript | ||
* for await (const chunk of entry.content()) { | ||
@@ -307,3 +311,3 @@ * // chunk is a Buffer | ||
* | ||
* ```javascript | ||
* ```TypeScript | ||
* import { walkPath } from 'ipfs-unixfs-exporter' | ||
@@ -310,0 +314,0 @@ * |
@@ -8,3 +8,3 @@ /** | ||
* | ||
* ```js | ||
* ```TypeScript | ||
* // import a file and export it again | ||
@@ -30,2 +30,6 @@ * import { importer } from 'ipfs-unixfs-importer' | ||
* | ||
* if (entry.type !== 'file') { | ||
* throw new Error('Unexpected entry type') | ||
* } | ||
* | ||
* console.info(entry.cid) // Qmqux | ||
@@ -38,3 +42,3 @@ * console.info(entry.path) // Qmbaz/foo/bar.txt | ||
* const size = entry.unixfs.fileSize() | ||
* const bytes = new Uint8Array(size) | ||
* const bytes = new Uint8Array(Number(size)) | ||
* let offset = 0 | ||
@@ -44,3 +48,3 @@ * | ||
* bytes.set(buf, offset) | ||
* offset += chunk.length | ||
* offset += buf.byteLength | ||
* } | ||
@@ -94,3 +98,3 @@ * | ||
* | ||
* ```javascript | ||
* ```TypeScript | ||
* import { walkPath } from 'ipfs-unixfs-exporter' | ||
@@ -97,0 +101,0 @@ * |
{ | ||
"name": "ipfs-unixfs-exporter", | ||
"version": "13.6.4", | ||
"version": "13.6.5", | ||
"description": "JavaScript implementation of the UnixFs exporter used by IPFS", | ||
@@ -137,2 +137,3 @@ "license": "Apache-2.0 OR MIT", | ||
"dep-check": "aegir dep-check", | ||
"doc-check": "aegir doc-check", | ||
"release": "aegir release" | ||
@@ -139,0 +140,0 @@ }, |
@@ -31,3 +31,3 @@ # ipfs-unixfs-exporter | ||
```js | ||
```TypeScript | ||
// import a file and export it again | ||
@@ -53,2 +53,6 @@ import { importer } from 'ipfs-unixfs-importer' | ||
if (entry.type !== 'file') { | ||
throw new Error('Unexpected entry type') | ||
} | ||
console.info(entry.cid) // Qmqux | ||
@@ -61,3 +65,3 @@ console.info(entry.path) // Qmbaz/foo/bar.txt | ||
const size = entry.unixfs.fileSize() | ||
const bytes = new Uint8Array(size) | ||
const bytes = new Uint8Array(Number(size)) | ||
let offset = 0 | ||
@@ -67,3 +71,3 @@ | ||
bytes.set(buf, offset) | ||
offset += chunk.length | ||
offset += buf.byteLength | ||
} | ||
@@ -70,0 +74,0 @@ |
@@ -8,3 +8,3 @@ /** | ||
* | ||
* ```js | ||
* ```TypeScript | ||
* // import a file and export it again | ||
@@ -30,2 +30,6 @@ * import { importer } from 'ipfs-unixfs-importer' | ||
* | ||
* if (entry.type !== 'file') { | ||
* throw new Error('Unexpected entry type') | ||
* } | ||
* | ||
* console.info(entry.cid) // Qmqux | ||
@@ -38,3 +42,3 @@ * console.info(entry.path) // Qmbaz/foo/bar.txt | ||
* const size = entry.unixfs.fileSize() | ||
* const bytes = new Uint8Array(size) | ||
* const bytes = new Uint8Array(Number(size)) | ||
* let offset = 0 | ||
@@ -44,3 +48,3 @@ * | ||
* bytes.set(buf, offset) | ||
* offset += chunk.length | ||
* offset += buf.byteLength | ||
* } | ||
@@ -187,3 +191,3 @@ * | ||
* | ||
* ```javascript | ||
* ```TypeScript | ||
* const length = 5 | ||
@@ -209,3 +213,3 @@ * const data = new Uint8Array(length) | ||
* | ||
* ```javascript | ||
* ```TypeScript | ||
* const entries = [] | ||
@@ -229,3 +233,3 @@ * | ||
* | ||
* ```javascript | ||
* ```TypeScript | ||
* if (entry.type === 'file') { | ||
@@ -247,3 +251,3 @@ * for await (const chunk of entry.content()) { | ||
* | ||
* ```javascript | ||
* ```TypeScript | ||
* if (entry.type === 'directory') { | ||
@@ -275,3 +279,3 @@ * for await (const entry of dir.content()) { | ||
* | ||
* ```javascript | ||
* ```TypeScript | ||
* for await (const chunk of entry.content()) { | ||
@@ -383,3 +387,3 @@ * // chunk is a Buffer | ||
* | ||
* ```javascript | ||
* ```TypeScript | ||
* import { walkPath } from 'ipfs-unixfs-exporter' | ||
@@ -386,0 +390,0 @@ * |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
836809
0.15%3186
0.38%110
3.77%32418
-12.79%