@loaders.gl/loader-utils 4.0.0-alpha.22 → 4.0.0-alpha.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es5/index.js +30 -2
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/json-loader.js +1 -1
- package/dist/es5/lib/file-provider/data-view-file.js +146 -0
- package/dist/es5/lib/file-provider/data-view-file.js.map +1 -0
- package/dist/es5/lib/file-provider/file-handle-file.js +236 -0
- package/dist/es5/lib/file-provider/file-handle-file.js.map +1 -0
- package/dist/es5/lib/file-provider/file-handle.js +104 -0
- package/dist/es5/lib/file-provider/file-handle.js.map +1 -0
- package/dist/es5/lib/file-provider/file-provider.js +11 -0
- package/dist/es5/lib/file-provider/file-provider.js.map +1 -0
- package/dist/es5/lib/filesystems/filesystem.js +2 -0
- package/dist/es5/lib/filesystems/filesystem.js.map +1 -0
- package/dist/es5/lib/filesystems/node-filesystem.js +2 -2
- package/dist/es5/lib/filesystems/node-filesystem.js.map +1 -1
- package/dist/es5/lib/node/fs.browser.js +9 -0
- package/dist/es5/lib/node/fs.browser.js.map +1 -0
- package/dist/es5/lib/node/fs.js +19 -35
- package/dist/es5/lib/node/fs.js.map +1 -1
- package/dist/es5/lib/node/stream.browser.js +9 -0
- package/dist/es5/lib/node/stream.browser.js.map +1 -0
- package/dist/es5/lib/node/stream.js +1 -4
- package/dist/es5/lib/node/stream.js.map +1 -1
- package/dist/es5/types.js.map +1 -1
- package/dist/esm/index.js +5 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/json-loader.js +1 -1
- package/dist/esm/lib/file-provider/data-view-file.js +33 -0
- package/dist/esm/lib/file-provider/data-view-file.js.map +1 -0
- package/dist/esm/lib/file-provider/file-handle-file.js +59 -0
- package/dist/esm/lib/file-provider/file-handle-file.js.map +1 -0
- package/dist/esm/lib/file-provider/file-handle.js +37 -0
- package/dist/esm/lib/file-provider/file-handle.js.map +1 -0
- package/dist/esm/lib/file-provider/file-provider.js +4 -0
- package/dist/esm/lib/file-provider/file-provider.js.map +1 -0
- package/dist/esm/lib/filesystems/filesystem.js +2 -0
- package/dist/esm/lib/filesystems/filesystem.js.map +1 -0
- package/dist/esm/lib/filesystems/node-filesystem.js +1 -1
- package/dist/esm/lib/filesystems/node-filesystem.js.map +1 -1
- package/dist/esm/lib/node/fs.browser.js +2 -0
- package/dist/esm/lib/node/fs.browser.js.map +1 -0
- package/dist/esm/lib/node/fs.js +14 -30
- package/dist/esm/lib/node/fs.js.map +1 -1
- package/dist/esm/lib/node/stream.browser.js +2 -0
- package/dist/esm/lib/node/stream.browser.js.map +1 -0
- package/dist/esm/lib/node/stream.js +1 -4
- package/dist/esm/lib/node/stream.js.map +1 -1
- package/dist/esm/types.js.map +1 -1
- package/dist/index.d.ts +8 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/lib/file-provider/data-view-file.d.ts +37 -0
- package/dist/lib/file-provider/data-view-file.d.ts.map +1 -0
- package/dist/lib/file-provider/file-handle-file.d.ts +53 -0
- package/dist/lib/file-provider/file-handle-file.d.ts.map +1 -0
- package/dist/lib/file-provider/file-handle.d.ts +40 -0
- package/dist/lib/file-provider/file-handle.d.ts.map +1 -0
- package/dist/lib/file-provider/file-provider.d.ts +45 -0
- package/dist/lib/file-provider/file-provider.d.ts.map +1 -0
- package/dist/lib/filesystems/filesystem.d.ts +81 -0
- package/dist/lib/filesystems/filesystem.d.ts.map +1 -0
- package/dist/lib/filesystems/node-filesystem.d.ts +2 -2
- package/dist/lib/filesystems/node-filesystem.d.ts.map +1 -1
- package/dist/lib/node/fs.browser.d.ts +2 -0
- package/dist/lib/node/fs.browser.d.ts.map +1 -0
- package/dist/lib/node/fs.d.ts +16 -14
- package/dist/lib/node/fs.d.ts.map +1 -1
- package/dist/lib/node/stream.browser.d.ts +2 -0
- package/dist/lib/node/stream.browser.d.ts.map +1 -0
- package/dist/lib/node/stream.d.ts +4 -1
- package/dist/lib/node/stream.d.ts.map +1 -1
- package/dist/types.d.ts +0 -44
- package/dist/types.d.ts.map +1 -1
- package/package.json +9 -5
- package/src/index.ts +10 -4
- package/src/lib/file-provider/data-view-file.ts +72 -0
- package/src/lib/file-provider/file-handle-file.ts +116 -0
- package/src/lib/file-provider/file-handle.ts +74 -0
- package/src/lib/file-provider/file-provider.ts +56 -0
- package/src/lib/filesystems/filesystem.ts +87 -0
- package/src/lib/filesystems/node-filesystem.ts +3 -3
- package/src/lib/node/fs.browser.ts +1 -0
- package/src/lib/node/fs.ts +16 -53
- package/src/lib/node/stream.browser.ts +1 -0
- package/src/lib/node/stream.ts +2 -10
- package/src/types.ts +0 -34
- package/dist/index.js +0 -127
- package/dist/json-loader.js +0 -27
- package/dist/lib/binary-utils/array-buffer-utils.js +0 -84
- package/dist/lib/binary-utils/dataview-copy-utils.js +0 -97
- package/dist/lib/binary-utils/get-first-characters.js +0 -45
- package/dist/lib/binary-utils/memory-conversion-utils.js +0 -73
- package/dist/lib/binary-utils/memory-copy-utils.js +0 -61
- package/dist/lib/env-utils/assert.js +0 -13
- package/dist/lib/env-utils/globals.js +0 -30
- package/dist/lib/filesystems/node-filesystem.js +0 -73
- package/dist/lib/filesystems/readable-file.js +0 -25
- package/dist/lib/filesystems/writable-file.js +0 -48
- package/dist/lib/iterators/async-iteration.js +0 -53
- package/dist/lib/iterators/text-iterators.js +0 -61
- package/dist/lib/node/buffer.browser.js +0 -22
- package/dist/lib/node/buffer.js +0 -36
- package/dist/lib/node/fs.js +0 -51
- package/dist/lib/node/promisify.js +0 -22
- package/dist/lib/node/stream.js +0 -17
- package/dist/lib/option-utils/merge-loader-options.js +0 -27
- package/dist/lib/parser-utils/parse-json.js +0 -16
- package/dist/lib/path-utils/file-aliases.js +0 -47
- package/dist/lib/path-utils/get-cwd.js +0 -12
- package/dist/lib/path-utils/path.js +0 -178
- package/dist/lib/request-utils/request-scheduler.js +0 -142
- package/dist/lib/worker-loader-utils/create-loader-worker.js +0 -99
- package/dist/lib/worker-loader-utils/encode-with-worker.js +0 -21
- package/dist/lib/worker-loader-utils/parse-with-worker.js +0 -81
- package/dist/loader-types.js +0 -36
- package/dist/types.js +0 -3
- package/dist/workers/json-worker.js +0 -5
- package/dist/writer-types.js +0 -3
package/dist/esm/lib/node/fs.js
CHANGED
|
@@ -1,36 +1,20 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import { toArrayBuffer } from './buffer';
|
|
3
3
|
import { promisify2, promisify3 } from './promisify';
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export
|
|
12
|
-
export
|
|
13
|
-
export
|
|
14
|
-
export
|
|
15
|
-
export
|
|
16
|
-
export
|
|
17
|
-
export
|
|
18
|
-
try {
|
|
19
|
-
readdir = promisify2(fs.readdir);
|
|
20
|
-
stat = promisify2(fs.stat);
|
|
21
|
-
statSync = fs.statSync;
|
|
22
|
-
readFile = fs.readFile;
|
|
23
|
-
readFileSync = fs.readFileSync;
|
|
24
|
-
writeFile = promisify3(fs.writeFile);
|
|
25
|
-
writeFileSync = fs.writeFileSync;
|
|
26
|
-
open = fs.open;
|
|
27
|
-
close = fd => new Promise((resolve, reject) => fs.close(fd, err => err ? reject(err) : resolve()));
|
|
28
|
-
read = fs.read;
|
|
29
|
-
fstat = fs.fstat;
|
|
30
|
-
createReadStream = fs.createReadStream;
|
|
31
|
-
createWriteStream = fs.createWriteStream;
|
|
32
|
-
isSupported = Boolean(fs);
|
|
33
|
-
} catch {}
|
|
4
|
+
export const readdir = promisify2(fs.readdir);
|
|
5
|
+
export const stat = promisify2(fs.stat);
|
|
6
|
+
export const statSync = fs.statSync;
|
|
7
|
+
export const readFile = fs.readFile;
|
|
8
|
+
export const readFileSync = fs.readFileSync;
|
|
9
|
+
export const writeFile = promisify3(fs.writeFile);
|
|
10
|
+
export const writeFileSync = fs.writeFileSync;
|
|
11
|
+
export const open = fs.open;
|
|
12
|
+
export const close = fd => new Promise((resolve, reject) => fs.close(fd, err => err ? reject(err) : resolve()));
|
|
13
|
+
export const read = fs.read;
|
|
14
|
+
export const fstat = fs.fstat;
|
|
15
|
+
export const createReadStream = fs.createReadStream;
|
|
16
|
+
export const createWriteStream = fs.createWriteStream;
|
|
17
|
+
export const isSupported = Boolean(fs);
|
|
34
18
|
export async function _readToArrayBuffer(fd, start, length) {
|
|
35
19
|
const buffer = Buffer.alloc(length);
|
|
36
20
|
const {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fs.js","names":["fs","toArrayBuffer","promisify2","promisify3","readdir","stat","statSync","readFile","readFileSync","writeFile","writeFileSync","open","close","
|
|
1
|
+
{"version":3,"file":"fs.js","names":["fs","toArrayBuffer","promisify2","promisify3","readdir","stat","statSync","readFile","readFileSync","writeFile","writeFileSync","open","close","fd","Promise","resolve","reject","err","read","fstat","createReadStream","createWriteStream","isSupported","Boolean","_readToArrayBuffer","start","length","buffer","Buffer","alloc","bytesRead","Error"],"sources":["../../../../src/lib/node/fs.ts"],"sourcesContent":["// fs wrapper (promisified fs + avoids bundling fs in browsers)\nimport fs from 'fs';\nimport {toArrayBuffer} from './buffer';\nimport {promisify2, promisify3} from './promisify';\n\nexport type {Stats, ReadStream, WriteStream} from 'fs';\n/** Wrapper for Node.js fs method */\nexport const readdir: any = promisify2(fs.readdir);\n/** Wrapper for Node.js fs method */\nexport const stat: any = promisify2(fs.stat);\nexport const statSync = fs.statSync;\n\n/** Wrapper for Node.js fs method */\nexport const readFile: any = fs.readFile;\n/** Wrapper for Node.js fs method */\nexport const readFileSync = fs.readFileSync;\n/** Wrapper for Node.js fs method */\nexport const writeFile: any = promisify3(fs.writeFile);\n/** Wrapper for Node.js fs method */\nexport const writeFileSync = fs.writeFileSync;\n\n// file descriptors\n\n/** Wrapper for Node.js fs method */\nexport const open: any = fs.open;\n/** Wrapper for Node.js fs method */\nexport const close = (fd: number) =>\n new Promise<void>((resolve, reject) => fs.close(fd, (err) => (err ? reject(err) : resolve())));\n/** Wrapper for Node.js fs method */\nexport const read: any = fs.read;\n/** Wrapper for Node.js fs method */\nexport const fstat: any = fs.fstat;\n\nexport const createReadStream = fs.createReadStream;\nexport const createWriteStream = fs.createWriteStream;\n\nexport const isSupported = Boolean(fs);\n\nexport async function _readToArrayBuffer(fd: number, start: number, length: number) {\n const buffer = Buffer.alloc(length);\n const {bytesRead} = await read(fd, buffer, 0, length, start);\n if (bytesRead !== length) {\n throw new Error('fs.read failed');\n }\n return toArrayBuffer(buffer);\n}\n"],"mappings":"AACA,OAAOA,EAAE,MAAM,IAAI;AACnB,SAAQC,aAAa,QAAO,UAAU;AACtC,SAAQC,UAAU,EAAEC,UAAU,QAAO,aAAa;AAIlD,OAAO,MAAMC,OAAY,GAAGF,UAAU,CAACF,EAAE,CAACI,OAAO,CAAC;AAElD,OAAO,MAAMC,IAAS,GAAGH,UAAU,CAACF,EAAE,CAACK,IAAI,CAAC;AAC5C,OAAO,MAAMC,QAAQ,GAAGN,EAAE,CAACM,QAAQ;AAGnC,OAAO,MAAMC,QAAa,GAAGP,EAAE,CAACO,QAAQ;AAExC,OAAO,MAAMC,YAAY,GAAGR,EAAE,CAACQ,YAAY;AAE3C,OAAO,MAAMC,SAAc,GAAGN,UAAU,CAACH,EAAE,CAACS,SAAS,CAAC;AAEtD,OAAO,MAAMC,aAAa,GAAGV,EAAE,CAACU,aAAa;AAK7C,OAAO,MAAMC,IAAS,GAAGX,EAAE,CAACW,IAAI;AAEhC,OAAO,MAAMC,KAAK,GAAIC,EAAU,IAC9B,IAAIC,OAAO,CAAO,CAACC,OAAO,EAAEC,MAAM,KAAKhB,EAAE,CAACY,KAAK,CAACC,EAAE,EAAGI,GAAG,IAAMA,GAAG,GAAGD,MAAM,CAACC,GAAG,CAAC,GAAGF,OAAO,CAAC,CAAE,CAAC,CAAC;AAEhG,OAAO,MAAMG,IAAS,GAAGlB,EAAE,CAACkB,IAAI;AAEhC,OAAO,MAAMC,KAAU,GAAGnB,EAAE,CAACmB,KAAK;AAElC,OAAO,MAAMC,gBAAgB,GAAGpB,EAAE,CAACoB,gBAAgB;AACnD,OAAO,MAAMC,iBAAiB,GAAGrB,EAAE,CAACqB,iBAAiB;AAErD,OAAO,MAAMC,WAAW,GAAGC,OAAO,CAACvB,EAAE,CAAC;AAEtC,OAAO,eAAewB,kBAAkBA,CAACX,EAAU,EAAEY,KAAa,EAAEC,MAAc,EAAE;EAClF,MAAMC,MAAM,GAAGC,MAAM,CAACC,KAAK,CAACH,MAAM,CAAC;EACnC,MAAM;IAACI;EAAS,CAAC,GAAG,MAAMZ,IAAI,CAACL,EAAE,EAAEc,MAAM,EAAE,CAAC,EAAED,MAAM,EAAED,KAAK,CAAC;EAC5D,IAAIK,SAAS,KAAKJ,MAAM,EAAE;IACxB,MAAM,IAAIK,KAAK,CAAC,gBAAgB,CAAC;EACnC;EACA,OAAO9B,aAAa,CAAC0B,MAAM,CAAC;AAC9B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream.browser.js","names":["isSupported"],"sources":["../../../../src/lib/node/stream.browser.ts"],"sourcesContent":["export const isSupported = false;\n"],"mappings":"AAAA,OAAO,MAAMA,WAAW,GAAG,KAAK"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream.js","names":["stream","Transform","isSupported","Boolean"],"sources":["../../../../src/lib/node/stream.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport stream from 'stream';\n\nexport type {Writable} from 'stream';\n\
|
|
1
|
+
{"version":3,"file":"stream.js","names":["stream","Transform","isSupported","Boolean"],"sources":["../../../../src/lib/node/stream.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport stream from 'stream';\n\nexport type {Writable} from 'stream';\n\n/** Wrapper for Node.js stream method */\nexport const Transform = stream.Transform;\n\nexport const isSupported = Boolean(stream);\n"],"mappings":"AAEA,OAAOA,MAAM,MAAM,QAAQ;AAK3B,OAAO,MAAMC,SAAS,GAAGD,MAAM,CAACC,SAAS;AAEzC,OAAO,MAAMC,WAAW,GAAGC,OAAO,CAACH,MAAM,CAAC"}
|
package/dist/esm/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../src/types.ts"],"sourcesContent":["// Typed arrays\n\nexport type TypedIntArray =\n | Int8Array\n | Uint8Array\n | Uint8ClampedArray\n | Int16Array\n | Uint16Array\n | Int32Array\n | Uint32Array\n | Int32Array\n | Uint32Array;\n\nexport type TypedFloatArray = Uint16Array | Float32Array | Float64Array;\n\nexport type TypedArray = TypedIntArray | TypedFloatArray;\n\nexport type BigTypedArray = TypedArray | BigInt64Array | BigUint64Array;\n\nexport type TypedArrayConstructor =\n | Int8ArrayConstructor\n | Uint8ArrayConstructor\n | Int16ArrayConstructor\n | Uint16ArrayConstructor\n | Int32ArrayConstructor\n | Uint32ArrayConstructor\n | Int32ArrayConstructor\n | Uint32ArrayConstructor\n | Float32ArrayConstructor\n | Float64ArrayConstructor;\n\nexport type BigTypedArrayConstructor =\n | TypedArrayConstructor\n | BigInt64ArrayConstructor\n | BigUint64ArrayConstructor;\n\n/** Any numeric array: typed array or `number[]` */\nexport type NumberArray = number[] | TypedArray;\n\nexport type NumericArray = number[] | TypedArray;\n\n// FETCH\n\nexport type FetchLike = (url: string, options?: RequestInit) => Promise<Response>;\n\n// MISC TYPES\n\nexport type TransformBatches = (\n asyncIterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer>\n) => AsyncIterable<ArrayBuffer>;\n\n/** Types that can be synchronously parsed */\nexport type SyncDataType = string | ArrayBuffer; // TODO File | Blob can be read synchronously...\n\n/** Types that can be parsed async */\nexport type DataType =\n | string\n | ArrayBuffer\n | File\n | Blob\n | Response\n | ReadableStream\n | Iterable<ArrayBuffer>\n | AsyncIterable<ArrayBuffer>;\n\n/** Types that can be parsed in batches */\nexport type BatchableDataType =\n | DataType\n | Iterable<ArrayBuffer>\n | AsyncIterable<ArrayBuffer>\n | Promise<AsyncIterable<ArrayBuffer>>;\n
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../src/types.ts"],"sourcesContent":["// Typed arrays\n\nexport type TypedIntArray =\n | Int8Array\n | Uint8Array\n | Uint8ClampedArray\n | Int16Array\n | Uint16Array\n | Int32Array\n | Uint32Array\n | Int32Array\n | Uint32Array;\n\nexport type TypedFloatArray = Uint16Array | Float32Array | Float64Array;\n\nexport type TypedArray = TypedIntArray | TypedFloatArray;\n\nexport type BigTypedArray = TypedArray | BigInt64Array | BigUint64Array;\n\nexport type TypedArrayConstructor =\n | Int8ArrayConstructor\n | Uint8ArrayConstructor\n | Int16ArrayConstructor\n | Uint16ArrayConstructor\n | Int32ArrayConstructor\n | Uint32ArrayConstructor\n | Int32ArrayConstructor\n | Uint32ArrayConstructor\n | Float32ArrayConstructor\n | Float64ArrayConstructor;\n\nexport type BigTypedArrayConstructor =\n | TypedArrayConstructor\n | BigInt64ArrayConstructor\n | BigUint64ArrayConstructor;\n\n/** Any numeric array: typed array or `number[]` */\nexport type NumberArray = number[] | TypedArray;\n\nexport type NumericArray = number[] | TypedArray;\n\n// FETCH\n\nexport type FetchLike = (url: string, options?: RequestInit) => Promise<Response>;\n\n// MISC TYPES\n\nexport type TransformBatches = (\n asyncIterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer>\n) => AsyncIterable<ArrayBuffer>;\n\n/** Types that can be synchronously parsed */\nexport type SyncDataType = string | ArrayBuffer; // TODO File | Blob can be read synchronously...\n\n/** Types that can be parsed async */\nexport type DataType =\n | string\n | ArrayBuffer\n | File\n | Blob\n | Response\n | ReadableStream\n | Iterable<ArrayBuffer>\n | AsyncIterable<ArrayBuffer>;\n\n/** Types that can be parsed in batches */\nexport type BatchableDataType =\n | DataType\n | Iterable<ArrayBuffer>\n | AsyncIterable<ArrayBuffer>\n | Promise<AsyncIterable<ArrayBuffer>>;\n"],"mappings":""}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { DataType, SyncDataType, BatchableDataType,
|
|
1
|
+
export type { DataType, SyncDataType, BatchableDataType, TypedArray, BigTypedArray, TypedArrayConstructor, BigTypedArrayConstructor, NumberArray, NumericArray, FetchLike } from './types';
|
|
2
2
|
export type { Loader, LoaderWithParser, LoaderContext, LoaderOptions, LoaderOptionsType, LoaderReturnType, LoaderBatchType } from './loader-types';
|
|
3
3
|
export { parseFromContext, parseSyncFromContext, parseInBatchesFromContext } from './loader-types';
|
|
4
4
|
export type { Writer, WriterOptions, WriterOptionsType } from './writer-types';
|
|
@@ -27,9 +27,15 @@ import * as fs from './lib/node/fs';
|
|
|
27
27
|
export { fs };
|
|
28
28
|
import * as stream from './lib/node/stream';
|
|
29
29
|
export { stream };
|
|
30
|
+
export type { FileSystem, RandomAccessReadFileSystem } from './lib/filesystems/filesystem';
|
|
31
|
+
export { NodeFileSystem as _NodeFileSystem } from './lib/filesystems/node-filesystem';
|
|
32
|
+
export type { FileProvider } from './lib/file-provider/file-provider';
|
|
33
|
+
export { isFileProvider } from './lib/file-provider/file-provider';
|
|
34
|
+
export { FileHandle } from './lib/file-provider/file-handle';
|
|
35
|
+
export { FileHandleFile } from './lib/file-provider/file-handle-file';
|
|
36
|
+
export { DataViewFile } from './lib/file-provider/data-view-file';
|
|
30
37
|
export type { ReadableFile } from './lib/filesystems/readable-file';
|
|
31
38
|
export { makeReadableFile } from './lib/filesystems/readable-file';
|
|
32
39
|
export type { WritableFile } from './lib/filesystems/writable-file';
|
|
33
40
|
export { makeWritableFile } from './lib/filesystems/writable-file';
|
|
34
|
-
export { default as _NodeFileSystem } from './lib/filesystems/node-filesystem';
|
|
35
41
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,YAAY,EAEV,QAAQ,EACR,YA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C,CAAC;AACpE,OAAO,EAAC,YAAY,EAAC,MAAM,oCAAoC,CAAC;AAEhE,YAAY,EAAC,YAAY,EAAC,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAC,gBAAgB,EAAC,MAAM,iCAAiC,CAAC;AAEjE,YAAY,EAAC,YAAY,EAAC,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAC,gBAAgB,EAAC,MAAM,iCAAiC,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { FileProvider } from './file-provider';
|
|
2
|
+
/** Provides file data using DataView */
|
|
3
|
+
export declare class DataViewFile implements FileProvider {
|
|
4
|
+
/** The DataView from which data is provided */
|
|
5
|
+
private file;
|
|
6
|
+
constructor(file: DataView);
|
|
7
|
+
destroy(): Promise<void>;
|
|
8
|
+
/**
|
|
9
|
+
* Gets an unsigned 8-bit integer at the specified byte offset from the start of the file.
|
|
10
|
+
* @param offset The offset, in bytes, from the start of the file where to read the data.
|
|
11
|
+
*/
|
|
12
|
+
getUint8(offset: bigint): Promise<number>;
|
|
13
|
+
/**
|
|
14
|
+
* Gets an unsigned 16-bit intege at the specified byte offset from the start of the file.
|
|
15
|
+
* @param offset The offset, in bytes, from the start of the file where to read the data.
|
|
16
|
+
*/
|
|
17
|
+
getUint16(offset: bigint): Promise<number>;
|
|
18
|
+
/**
|
|
19
|
+
* Gets an unsigned 32-bit integer at the specified byte offset from the start of the file.
|
|
20
|
+
* @param offset The offset, in bytes, from the start of the file where to read the data.
|
|
21
|
+
*/
|
|
22
|
+
getUint32(offset: bigint): Promise<number>;
|
|
23
|
+
/**
|
|
24
|
+
* Gets an unsigned 64-bit integer at the specified byte offset from the start of the file.
|
|
25
|
+
* @param offset The offset, in bytes, from the start of the file where to read the data.
|
|
26
|
+
*/
|
|
27
|
+
getBigUint64(offset: bigint): Promise<bigint>;
|
|
28
|
+
/**
|
|
29
|
+
* returns an ArrayBuffer whose contents are a copy of this file bytes from startOffset, inclusive, up to endOffset, exclusive.
|
|
30
|
+
* @param startOffset The offset, in bytes, from the start of the file where to start reading the data.
|
|
31
|
+
* @param endOffset The offset, in bytes, from the start of the file where to end reading the data.
|
|
32
|
+
*/
|
|
33
|
+
slice(startOffset: bigint, endOffset: bigint): Promise<ArrayBuffer>;
|
|
34
|
+
/** the length (in bytes) of the data. */
|
|
35
|
+
get length(): bigint;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=data-view-file.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-view-file.d.ts","sourceRoot":"","sources":["../../../src/lib/file-provider/data-view-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAc7C,wCAAwC;AACxC,qBAAa,YAAa,YAAW,YAAY;IAC/C,+CAA+C;IAC/C,OAAO,CAAC,IAAI,CAAW;gBAEX,IAAI,EAAE,QAAQ;IAKpB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAE9B;;;OAGG;IACG,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAI/C;;;OAGG;IACG,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAIhD;;;OAGG;IACG,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAIhD;;;OAGG;IACG,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAInD;;;;OAIG;IACG,KAAK,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAIzE,yCAAyC;IACzC,IAAI,MAAM,WAET;CACF"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { FileProvider } from './file-provider';
|
|
2
|
+
/**
|
|
3
|
+
* Provides file data using node fs library
|
|
4
|
+
*/
|
|
5
|
+
export declare class FileHandleFile implements FileProvider {
|
|
6
|
+
/**
|
|
7
|
+
* Returns a new copy of FileHandleFile
|
|
8
|
+
* @param path The path to the file in file system
|
|
9
|
+
*/
|
|
10
|
+
static from(path: string): Promise<FileHandleFile>;
|
|
11
|
+
/**
|
|
12
|
+
* The FileHandle from which data is provided
|
|
13
|
+
*/
|
|
14
|
+
private fileDescriptor;
|
|
15
|
+
/**
|
|
16
|
+
* The file length in bytes
|
|
17
|
+
*/
|
|
18
|
+
private size;
|
|
19
|
+
private constructor();
|
|
20
|
+
/** Close file */
|
|
21
|
+
destroy(): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Gets an unsigned 8-bit integer at the specified byte offset from the start of the file.
|
|
24
|
+
* @param offset The offset, in bytes, from the start of the file where to read the data.
|
|
25
|
+
*/
|
|
26
|
+
getUint8(offset: bigint): Promise<number>;
|
|
27
|
+
/**
|
|
28
|
+
* Gets an unsigned 16-bit integer at the specified byte offset from the start of the file.
|
|
29
|
+
* @param offset The offset, in bytes, from the start of the file where to read the data.
|
|
30
|
+
*/
|
|
31
|
+
getUint16(offset: bigint): Promise<number>;
|
|
32
|
+
/**
|
|
33
|
+
* Gets an unsigned 32-bit integer at the specified byte offset from the start of the file.
|
|
34
|
+
* @param offset The offset, in bytes, from the start of the file where to read the data.
|
|
35
|
+
*/
|
|
36
|
+
getUint32(offset: bigint): Promise<number>;
|
|
37
|
+
/**
|
|
38
|
+
* Gets an unsigned 32-bit integer at the specified byte offset from the start of the file.
|
|
39
|
+
* @param offset The offset, in bytes, from the start of the file where to read the data.
|
|
40
|
+
*/
|
|
41
|
+
getBigUint64(offset: bigint): Promise<bigint>;
|
|
42
|
+
/**
|
|
43
|
+
* returns an ArrayBuffer whose contents are a copy of this file bytes from startOffset, inclusive, up to endOffset, exclusive.
|
|
44
|
+
* @param startOffsset The offset, in byte, from the start of the file where to start reading the data.
|
|
45
|
+
* @param endOffset The offset, in bytes, from the start of the file where to end reading the data.
|
|
46
|
+
*/
|
|
47
|
+
slice(startOffsset: bigint, endOffset: bigint): Promise<ArrayBuffer>;
|
|
48
|
+
/**
|
|
49
|
+
* the length (in bytes) of the data.
|
|
50
|
+
*/
|
|
51
|
+
get length(): bigint;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=file-handle-file.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-handle-file.d.ts","sourceRoot":"","sources":["../../../src/lib/file-provider/file-handle-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAI7C;;GAEG;AACH,qBAAa,cAAe,YAAW,YAAY;IACjD;;;OAGG;WACU,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAMxD;;OAEG;IACH,OAAO,CAAC,cAAc,CAAa;IAEnC;;OAEG;IACH,OAAO,CAAC,IAAI,CAAS;IAErB,OAAO;IAKP,iBAAiB;IACX,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAI9B;;;OAGG;IACG,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAU/C;;;OAGG;IACG,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAUhD;;;OAGG;IACG,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAUhD;;;OAGG;IACG,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAUnD;;;;OAIG;IACG,KAAK,CAAC,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAU1E;;OAEG;IACH,IAAI,MAAM,IAAI,MAAM,CAEnB;CACF"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import { BigIntStats } from 'fs';
|
|
4
|
+
/** file reading result */
|
|
5
|
+
export type FileReadResult = {
|
|
6
|
+
/** amount of the bytes read */
|
|
7
|
+
bytesRead: number;
|
|
8
|
+
/** the buffer filled with data from file*/
|
|
9
|
+
buffer: Buffer;
|
|
10
|
+
};
|
|
11
|
+
/** Object handling file info */
|
|
12
|
+
export declare class FileHandle {
|
|
13
|
+
private fileDescriptor;
|
|
14
|
+
private stats;
|
|
15
|
+
private constructor();
|
|
16
|
+
/**
|
|
17
|
+
* Opens a `FileHandle`.
|
|
18
|
+
*
|
|
19
|
+
* @param path path to the file
|
|
20
|
+
* @return Fulfills with a {FileHandle} object.
|
|
21
|
+
*/
|
|
22
|
+
static open(path: string): Promise<FileHandle>;
|
|
23
|
+
/** Close file */
|
|
24
|
+
close(): Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* Reads data from the file and stores that in the given buffer.
|
|
27
|
+
*
|
|
28
|
+
* If the file is not modified concurrently, the end-of-file is reached when the
|
|
29
|
+
* number of bytes read is zero.
|
|
30
|
+
* @param buffer A buffer that will be filled with the file data read.
|
|
31
|
+
* @param offset The location in the buffer at which to start filling.
|
|
32
|
+
* @param length The number of bytes to read.
|
|
33
|
+
* @param position The location where to begin reading data from the file. If `null`, data will be read from the current file position, and the position will be updated. If `position` is an
|
|
34
|
+
* integer, the current file position will remain unchanged.
|
|
35
|
+
* @return Fulfills upon success with a FileReadResult object
|
|
36
|
+
*/
|
|
37
|
+
read: (buffer: Buffer, offset: number, length: number, position: number | bigint) => Promise<FileReadResult>;
|
|
38
|
+
get stat(): BigIntStats;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=file-handle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-handle.d.ts","sourceRoot":"","sources":["../../../src/lib/file-provider/file-handle.ts"],"names":[],"mappings":";;AAAA,OAAO,EAA0B,WAAW,EAAC,MAAM,IAAI,CAAC;AAExD,0BAA0B;AAC1B,MAAM,MAAM,cAAc,GAAG;IAC3B,+BAA+B;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,2CAA2C;IAC3C,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,gCAAgC;AAChC,qBAAa,UAAU;IACrB,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,KAAK,CAAc;IAE3B,OAAO;IAIP;;;;;OAKG;WAEU,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAYpD,iBAAiB;IACX,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAM5B;;;;;;;;;;;OAWG;IACH,IAAI,WACM,MAAM,UACN,MAAM,UACN,MAAM,YACJ,MAAM,GAAG,MAAM,KACxB,QAAQ,cAAc,CAAC,CAMxB;IAEF,IAAI,IAAI,IAAI,WAAW,CAEtB;CACF"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interface for providing file data
|
|
3
|
+
*/
|
|
4
|
+
export interface FileProvider {
|
|
5
|
+
/**
|
|
6
|
+
* Cleanup class data
|
|
7
|
+
*/
|
|
8
|
+
destroy(): Promise<void>;
|
|
9
|
+
/**
|
|
10
|
+
* Gets an unsigned 8-bit integer at the specified byte offset from the start of the file.
|
|
11
|
+
* @param offset The offset, in bytes, from the start of the file where to read the data.
|
|
12
|
+
*/
|
|
13
|
+
getUint8(offset: bigint): Promise<number>;
|
|
14
|
+
/**
|
|
15
|
+
* Gets an unsigned 16-bit integer at the specified byte offset from the start of the file.
|
|
16
|
+
* @param offset The offset, in bytes, from the start of the file where to read the data.
|
|
17
|
+
*/
|
|
18
|
+
getUint16(offset: bigint): Promise<number>;
|
|
19
|
+
/**
|
|
20
|
+
* Gets an unsigned 32-bit integer at the specified byte offset from the start of the file.
|
|
21
|
+
* @param offset The offset, in bytes, from the file of the view where to read the data.
|
|
22
|
+
*/
|
|
23
|
+
getUint32(offset: bigint): Promise<number>;
|
|
24
|
+
/**
|
|
25
|
+
* Gets an unsigned 32-bit integer at the specified byte offset from the start of the file.
|
|
26
|
+
* @param offset The offset, in byte, from the file of the view where to read the data.
|
|
27
|
+
*/
|
|
28
|
+
getBigUint64(offset: bigint): Promise<bigint>;
|
|
29
|
+
/**
|
|
30
|
+
* returns an ArrayBuffer whose contents are a copy of this file bytes from startOffset, inclusive, up to endOffset, exclusive.
|
|
31
|
+
* @param startOffset The offset, in bytes, from the start of the file where to start reading the data.
|
|
32
|
+
* @param endOffset The offset, in bytes, from the start of the file where to end reading the data.
|
|
33
|
+
*/
|
|
34
|
+
slice(startOffset: bigint, endOffset: bigint): Promise<ArrayBuffer>;
|
|
35
|
+
/**
|
|
36
|
+
* the length (in bytes) of the data.
|
|
37
|
+
*/
|
|
38
|
+
length: bigint;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Check is the object has FileProvider members
|
|
42
|
+
* @param fileProvider - tested object
|
|
43
|
+
*/
|
|
44
|
+
export declare const isFileProvider: (fileProvider: unknown) => bigint;
|
|
45
|
+
//# sourceMappingURL=file-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-provider.d.ts","sourceRoot":"","sources":["../../../src/lib/file-provider/file-provider.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACzB;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAE1C;;;OAGG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAE3C;;;OAGG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAE3C;;;OAGG;IACH,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAE9C;;;;OAIG;IACH,KAAK,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAEpE;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,eAAO,MAAM,cAAc,iBAAkB,OAAO,WAMnD,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
export type ReadOptions = {};
|
|
3
|
+
export type Stat = {
|
|
4
|
+
size: number;
|
|
5
|
+
isDirectory: () => boolean;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* A FileSystem interface can encapsulate various file sources,
|
|
9
|
+
* a FileList, a ZipFile, a GoogleDrive etc.
|
|
10
|
+
*/
|
|
11
|
+
export interface FileSystem {
|
|
12
|
+
/**
|
|
13
|
+
* Return a list of file names
|
|
14
|
+
* @param dirname directory name. file system root directory if omitted
|
|
15
|
+
*/
|
|
16
|
+
readdir(dirname?: string, options?: {
|
|
17
|
+
recursive?: boolean;
|
|
18
|
+
}): Promise<string[]>;
|
|
19
|
+
/**
|
|
20
|
+
* Gets information from a local file from the filesystem
|
|
21
|
+
* @param filename file name to stat
|
|
22
|
+
* @param options currently unused
|
|
23
|
+
* @throws if filename is not in local filesystem
|
|
24
|
+
*/
|
|
25
|
+
stat(filename: string, options?: object): Promise<{
|
|
26
|
+
size: number;
|
|
27
|
+
}>;
|
|
28
|
+
/**
|
|
29
|
+
* Fetches a local file from the filesystem (or a URL)
|
|
30
|
+
* @param filename
|
|
31
|
+
* @param options
|
|
32
|
+
*/
|
|
33
|
+
fetch(filename: RequestInfo, options?: RequestInit): Promise<Response>;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* A random access file system
|
|
37
|
+
*/
|
|
38
|
+
export interface RandomAccessReadFileSystem extends FileSystem {
|
|
39
|
+
open(path: string, flags: unknown, mode?: unknown): Promise<any>;
|
|
40
|
+
close(fd: unknown): Promise<void>;
|
|
41
|
+
fstat(fd: unknown): Promise<Stat>;
|
|
42
|
+
read(fd: any, options?: ReadOptions): Promise<{
|
|
43
|
+
bytesRead: number;
|
|
44
|
+
buffer: Buffer;
|
|
45
|
+
}>;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* A FileSystem interface can encapsulate a FileList, a ZipFile, a GoogleDrive etc.
|
|
49
|
+
*
|
|
50
|
+
export interface IFileSystem {
|
|
51
|
+
/**
|
|
52
|
+
* Return a list of file names
|
|
53
|
+
* @param dirname directory name. file system root directory if omitted
|
|
54
|
+
*
|
|
55
|
+
readdir(dirname?: string, options?: {recursive?: boolean}): Promise<string[]>;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Gets information from a local file from the filesystem
|
|
59
|
+
* @param filename file name to stat
|
|
60
|
+
* @param options currently unused
|
|
61
|
+
* @throws if filename is not in local filesystem
|
|
62
|
+
*
|
|
63
|
+
stat(filename: string, options?: object): Promise<{size: number}>;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Fetches a local file from the filesystem (or a URL)
|
|
67
|
+
* @param filename
|
|
68
|
+
* @param options
|
|
69
|
+
*
|
|
70
|
+
fetch(filename: string, options?: object): Promise<Response>;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
type ReadOptions = {buffer?: ArrayBuffer; offset?: number; length?: number; position?: number};
|
|
74
|
+
export interface IRandomAccessReadFileSystem extends IFileSystem {
|
|
75
|
+
open(path: string, flags: string | number, mode?: any): Promise<any>;
|
|
76
|
+
close(fd: any): Promise<void>;
|
|
77
|
+
fstat(fd: any): Promise<object>;
|
|
78
|
+
read(fd: any, options?: ReadOptions): Promise<{bytesRead: number; buffer: Buffer}>;
|
|
79
|
+
}
|
|
80
|
+
*/
|
|
81
|
+
//# sourceMappingURL=filesystem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filesystem.d.ts","sourceRoot":"","sources":["../../../src/lib/filesystems/filesystem.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reference types="node" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
3
|
import * as fs from '../node/fs';
|
|
4
|
-
import {
|
|
4
|
+
import { FileSystem, RandomAccessReadFileSystem } from './filesystem';
|
|
5
5
|
type Stat = {
|
|
6
6
|
size: number;
|
|
7
7
|
isDirectory: () => boolean;
|
|
@@ -18,7 +18,7 @@ type ReadOptions = {
|
|
|
18
18
|
* Compatible with BrowserFileSystem.
|
|
19
19
|
* @param options
|
|
20
20
|
*/
|
|
21
|
-
export
|
|
21
|
+
export declare class NodeFileSystem implements FileSystem, RandomAccessReadFileSystem {
|
|
22
22
|
constructor(options: {
|
|
23
23
|
[key: string]: any;
|
|
24
24
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-filesystem.d.ts","sourceRoot":"","sources":["../../../src/lib/filesystems/node-filesystem.ts"],"names":[],"mappings":";;AAAA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"node-filesystem.d.ts","sourceRoot":"","sources":["../../../src/lib/filesystems/node-filesystem.ts"],"names":[],"mappings":";;AAAA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAAC,UAAU,EAAE,0BAA0B,EAAC,MAAM,cAAc,CAAC;AAIpE,KAAK,IAAI,GAAG;IACV,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,OAAO,CAAC;IAC3B,IAAI,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC;CACjB,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;;;GAIG;AACH,qBAAa,cAAe,YAAW,UAAU,EAAE,0BAA0B;gBAE/D,OAAO,EAAE;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAC;IAInC,OAAO,CAAC,OAAO,SAAM,EAAE,OAAO,CAAC,EAAE,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAIpD,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAK/C,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAC;IAQjD,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC;IAIvE,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIhC,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKhC,IAAI,CACR,EAAE,EAAE,MAAM,EAEV,EAAC,MAAa,EAAE,MAAU,EAAE,MAA0B,EAAE,QAAe,EAAC,EAAE,WAAW,GACpF,OAAO,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAC,CAAC;CAehD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fs.browser.d.ts","sourceRoot":"","sources":["../../../src/lib/node/fs.browser.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,QAAQ,CAAC"}
|
package/dist/lib/node/fs.d.ts
CHANGED
|
@@ -1,27 +1,29 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
1
2
|
import fs from 'fs';
|
|
2
3
|
export type { Stats, ReadStream, WriteStream } from 'fs';
|
|
3
|
-
export declare let readdir: any;
|
|
4
4
|
/** Wrapper for Node.js fs method */
|
|
5
|
-
export declare
|
|
6
|
-
export declare let statSync: typeof fs.statSync;
|
|
5
|
+
export declare const readdir: any;
|
|
7
6
|
/** Wrapper for Node.js fs method */
|
|
8
|
-
export declare
|
|
7
|
+
export declare const stat: any;
|
|
8
|
+
export declare const statSync: fs.StatSyncFn;
|
|
9
9
|
/** Wrapper for Node.js fs method */
|
|
10
|
-
export declare
|
|
10
|
+
export declare const readFile: any;
|
|
11
11
|
/** Wrapper for Node.js fs method */
|
|
12
|
-
export declare
|
|
12
|
+
export declare const readFileSync: typeof fs.readFileSync;
|
|
13
13
|
/** Wrapper for Node.js fs method */
|
|
14
|
-
export declare
|
|
14
|
+
export declare const writeFile: any;
|
|
15
15
|
/** Wrapper for Node.js fs method */
|
|
16
|
-
export declare
|
|
16
|
+
export declare const writeFileSync: typeof fs.writeFileSync;
|
|
17
17
|
/** Wrapper for Node.js fs method */
|
|
18
|
-
export declare
|
|
18
|
+
export declare const open: any;
|
|
19
19
|
/** Wrapper for Node.js fs method */
|
|
20
|
-
export declare
|
|
20
|
+
export declare const close: (fd: number) => Promise<void>;
|
|
21
21
|
/** Wrapper for Node.js fs method */
|
|
22
|
-
export declare
|
|
23
|
-
|
|
24
|
-
export declare
|
|
25
|
-
export declare
|
|
22
|
+
export declare const read: any;
|
|
23
|
+
/** Wrapper for Node.js fs method */
|
|
24
|
+
export declare const fstat: any;
|
|
25
|
+
export declare const createReadStream: typeof fs.createReadStream;
|
|
26
|
+
export declare const createWriteStream: typeof fs.createWriteStream;
|
|
27
|
+
export declare const isSupported: boolean;
|
|
26
28
|
export declare function _readToArrayBuffer(fd: number, start: number, length: number): Promise<any>;
|
|
27
29
|
//# sourceMappingURL=fs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../../../src/lib/node/fs.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,IAAI,CAAC;AAIpB,YAAY,EAAC,KAAK,EAAE,UAAU,EAAE,WAAW,EAAC,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../../../src/lib/node/fs.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,IAAI,CAAC;AAIpB,YAAY,EAAC,KAAK,EAAE,UAAU,EAAE,WAAW,EAAC,MAAM,IAAI,CAAC;AACvD,oCAAoC;AACpC,eAAO,MAAM,OAAO,EAAE,GAA4B,CAAC;AACnD,oCAAoC;AACpC,eAAO,MAAM,IAAI,EAAE,GAAyB,CAAC;AAC7C,eAAO,MAAM,QAAQ,eAAc,CAAC;AAEpC,oCAAoC;AACpC,eAAO,MAAM,QAAQ,EAAE,GAAiB,CAAC;AACzC,oCAAoC;AACpC,eAAO,MAAM,YAAY,wBAAkB,CAAC;AAC5C,oCAAoC;AACpC,eAAO,MAAM,SAAS,EAAE,GAA8B,CAAC;AACvD,oCAAoC;AACpC,eAAO,MAAM,aAAa,yBAAmB,CAAC;AAI9C,oCAAoC;AACpC,eAAO,MAAM,IAAI,EAAE,GAAa,CAAC;AACjC,oCAAoC;AACpC,eAAO,MAAM,KAAK,OAAQ,MAAM,kBACgE,CAAC;AACjG,oCAAoC;AACpC,eAAO,MAAM,IAAI,EAAE,GAAa,CAAC;AACjC,oCAAoC;AACpC,eAAO,MAAM,KAAK,EAAE,GAAc,CAAC;AAEnC,eAAO,MAAM,gBAAgB,4BAAsB,CAAC;AACpD,eAAO,MAAM,iBAAiB,6BAAuB,CAAC;AAEtD,eAAO,MAAM,WAAW,SAAc,CAAC;AAEvC,wBAAsB,kBAAkB,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,gBAOjF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream.browser.d.ts","sourceRoot":"","sources":["../../../src/lib/node/stream.browser.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,QAAQ,CAAC"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import stream from 'stream';
|
|
1
3
|
export type { Writable } from 'stream';
|
|
2
|
-
|
|
4
|
+
/** Wrapper for Node.js stream method */
|
|
5
|
+
export declare const Transform: typeof stream.Transform;
|
|
3
6
|
export declare const isSupported: boolean;
|
|
4
7
|
//# sourceMappingURL=stream.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../../src/lib/node/stream.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../../src/lib/node/stream.ts"],"names":[],"mappings":";AAEA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,YAAY,EAAC,QAAQ,EAAC,MAAM,QAAQ,CAAC;AAErC,wCAAwC;AACxC,eAAO,MAAM,SAAS,yBAAmB,CAAC;AAE1C,eAAO,MAAM,WAAW,SAAkB,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
export type TypedIntArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Int32Array | Uint32Array;
|
|
3
2
|
export type TypedFloatArray = Uint16Array | Float32Array | Float64Array;
|
|
4
3
|
export type TypedArray = TypedIntArray | TypedFloatArray;
|
|
@@ -16,47 +15,4 @@ export type SyncDataType = string | ArrayBuffer;
|
|
|
16
15
|
export type DataType = string | ArrayBuffer | File | Blob | Response | ReadableStream | Iterable<ArrayBuffer> | AsyncIterable<ArrayBuffer>;
|
|
17
16
|
/** Types that can be parsed in batches */
|
|
18
17
|
export type BatchableDataType = DataType | Iterable<ArrayBuffer> | AsyncIterable<ArrayBuffer> | Promise<AsyncIterable<ArrayBuffer>>;
|
|
19
|
-
/**
|
|
20
|
-
* A FileSystem interface can encapsulate a FileList, a ZipFile, a GoogleDrive etc.
|
|
21
|
-
*/
|
|
22
|
-
export interface IFileSystem {
|
|
23
|
-
/**
|
|
24
|
-
* Return a list of file names
|
|
25
|
-
* @param dirname directory name. file system root directory if omitted
|
|
26
|
-
*/
|
|
27
|
-
readdir(dirname?: string, options?: {
|
|
28
|
-
recursive?: boolean;
|
|
29
|
-
}): Promise<string[]>;
|
|
30
|
-
/**
|
|
31
|
-
* Gets information from a local file from the filesystem
|
|
32
|
-
* @param filename file name to stat
|
|
33
|
-
* @param options currently unused
|
|
34
|
-
* @throws if filename is not in local filesystem
|
|
35
|
-
*/
|
|
36
|
-
stat(filename: string, options?: object): Promise<{
|
|
37
|
-
size: number;
|
|
38
|
-
}>;
|
|
39
|
-
/**
|
|
40
|
-
* Fetches a local file from the filesystem (or a URL)
|
|
41
|
-
* @param filename
|
|
42
|
-
* @param options
|
|
43
|
-
*/
|
|
44
|
-
fetch(filename: string, options?: object): Promise<Response>;
|
|
45
|
-
}
|
|
46
|
-
type ReadOptions = {
|
|
47
|
-
buffer?: ArrayBuffer;
|
|
48
|
-
offset?: number;
|
|
49
|
-
length?: number;
|
|
50
|
-
position?: number;
|
|
51
|
-
};
|
|
52
|
-
export interface IRandomAccessReadFileSystem extends IFileSystem {
|
|
53
|
-
open(path: string, flags: string | number, mode?: any): Promise<any>;
|
|
54
|
-
close(fd: any): Promise<void>;
|
|
55
|
-
fstat(fd: any): Promise<object>;
|
|
56
|
-
read(fd: any, options?: ReadOptions): Promise<{
|
|
57
|
-
bytesRead: number;
|
|
58
|
-
buffer: Buffer;
|
|
59
|
-
}>;
|
|
60
|
-
}
|
|
61
|
-
export {};
|
|
62
18
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,aAAa,GACrB,SAAS,GACT,UAAU,GACV,iBAAiB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