@d0paminedriven/fs 10.0.0 → 11.0.0
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/docs/index.d.ts +119 -0
- package/dist/docs/index.js +1027 -0
- package/dist/extract/client.d.ts +54 -0
- package/dist/extract/client.js +118 -0
- package/dist/extract/index.d.ts +69 -0
- package/dist/extract/index.js +622 -0
- package/dist/fs/index.d.ts +19 -55
- package/dist/fs/index.js +88 -19
- package/dist/fs-atomic/index.d.ts +28 -36
- package/dist/fs-atomic/index.js +88 -13
- package/dist/fs-base/index.d.ts +105 -111
- package/dist/fs-base/index.js +188 -12
- package/dist/fs-core/index.d.ts +20 -24
- package/dist/fs-core/index.js +44 -16
- package/dist/fs-fetch/index.d.ts +48 -62
- package/dist/fs-fetch/index.js +146 -18
- package/dist/fs-size/index.d.ts +16 -28
- package/dist/fs-size/index.js +64 -15
- package/dist/fs-tmp/index.d.ts +179 -192
- package/dist/fs-tmp/index.js +321 -17
- package/dist/images/index.d.ts +447 -0
- package/dist/images/index.js +899 -0
- package/dist/images/workup.d.ts +30 -0
- package/dist/images/workup.js +317 -0
- package/dist/index.d.ts +20 -22
- package/dist/index.js +20 -64
- package/dist/ld/index.d.ts +15 -13
- package/dist/ld/index.js +56 -6
- package/dist/mime/index.d.ts +299 -294
- package/dist/mime/index.js +348 -13
- package/dist/mixins/index.d.ts +34 -0
- package/dist/mixins/index.js +54 -0
- package/dist/types/index.d.ts +279 -215
- package/dist/types/index.js +11 -6
- package/dist/types/stream.d.ts +6 -4
- package/dist/types/stream.js +1 -1
- package/dist/url/index.d.ts +15 -18
- package/dist/url/index.js +21 -8
- package/dist/utils/index.d.ts +19 -23
- package/dist/utils/index.js +82 -7
- package/package.json +33 -13
- package/dist/chunk-5CACVZVF.js +0 -386
- package/dist/chunk-5H6GE5AO.js +0 -14
- package/dist/chunk-7JQ56XIH.js +0 -187
- package/dist/chunk-7LOAFIZM.js +0 -77
- package/dist/chunk-7QVYU63E.js +0 -7
- package/dist/chunk-DNR5ZI2T.js +0 -75
- package/dist/chunk-L2QMQOEJ.js +0 -366
- package/dist/chunk-NJHN5OE3.js +0 -33
- package/dist/chunk-OHKRQJZH.js +0 -82
- package/dist/chunk-OT5JEQKW.js +0 -139
- package/dist/chunk-PATMSIQK.js +0 -367
- package/dist/chunk-PB5A7ZFD.js +0 -79
- package/dist/chunk-VDKUXJE7.js +0 -240
- package/dist/chunk-Y5QWE4EG.js +0 -1335
- package/dist/chunk-YRCJWFZD.js +0 -107
- package/dist/image/index.d.ts +0 -182
- package/dist/image/index.js +0 -13
- package/dist/image/workup.d.ts +0 -40
- package/dist/image/workup.js +0 -12
package/dist/fs-base/index.js
CHANGED
|
@@ -1,14 +1,190 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
} from "
|
|
4
|
-
import "
|
|
5
|
-
import "
|
|
6
|
-
import "
|
|
7
|
-
import "
|
|
8
|
-
import "
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { MimeService } from "../mime/index.js";
|
|
2
|
+
import fsSync from "fs";
|
|
3
|
+
import { join, relative, resolve } from "path";
|
|
4
|
+
import { Readable } from "node:stream";
|
|
5
|
+
import { EOL, devNull, homedir, hostname, platform, tmpdir } from "node:os";
|
|
6
|
+
import { ReadableStream } from "stream/web";
|
|
7
|
+
import * as dotenv from "dotenv";
|
|
8
|
+
import expand from "dotenv-expand";
|
|
9
|
+
|
|
10
|
+
//#region src/fs-base/index.ts
|
|
11
|
+
var FsBase = class extends MimeService {
|
|
12
|
+
constructor(cwd) {
|
|
13
|
+
super();
|
|
14
|
+
this.cwd = cwd;
|
|
15
|
+
}
|
|
16
|
+
get tmpDir() {
|
|
17
|
+
return tmpdir();
|
|
18
|
+
}
|
|
19
|
+
get homeDir() {
|
|
20
|
+
return homedir();
|
|
21
|
+
}
|
|
22
|
+
get platform() {
|
|
23
|
+
return platform();
|
|
24
|
+
}
|
|
25
|
+
get hostname() {
|
|
26
|
+
return hostname();
|
|
27
|
+
}
|
|
28
|
+
get devNull() {
|
|
29
|
+
return devNull;
|
|
30
|
+
}
|
|
31
|
+
get eol() {
|
|
32
|
+
return EOL;
|
|
33
|
+
}
|
|
34
|
+
get env() {
|
|
35
|
+
return dotenv.config({
|
|
36
|
+
processEnv: {},
|
|
37
|
+
quiet: true
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
parseDotEnv() {
|
|
41
|
+
const env = expand.expand(this.env);
|
|
42
|
+
if (typeof env !== "undefined") if (env.error) throw new Error(env.error.message);
|
|
43
|
+
else return env.parsed;
|
|
44
|
+
else throw new Error("env returned undefined");
|
|
45
|
+
}
|
|
46
|
+
relative(from, to) {
|
|
47
|
+
return relative(from, to);
|
|
48
|
+
}
|
|
49
|
+
isHomeTargeted(path) {
|
|
50
|
+
if (/^(~\/\.?)$/g.test(path)) return true;
|
|
51
|
+
else if (path.includes(this.homeDir)) return true;
|
|
52
|
+
else return false;
|
|
53
|
+
}
|
|
54
|
+
isRootPathTargeted(path) {
|
|
55
|
+
if (/^(?:\.\/|\.|\/|root|\.\.\/|cwd|\.\/\.)$/g.test(path)) return true;
|
|
56
|
+
else return false;
|
|
57
|
+
}
|
|
58
|
+
pathHandler(path) {
|
|
59
|
+
return /\//g.test(path) === true ? path.split(/([/])/gim).reverse().slice(2).reverse().join("") : path;
|
|
60
|
+
}
|
|
61
|
+
isUint8Array(v) {
|
|
62
|
+
return v instanceof Uint8Array;
|
|
63
|
+
}
|
|
64
|
+
isBuffer(v) {
|
|
65
|
+
return Buffer.isBuffer(v);
|
|
66
|
+
}
|
|
67
|
+
isWebReadableStream(v) {
|
|
68
|
+
return v instanceof ReadableStream;
|
|
69
|
+
}
|
|
70
|
+
isAsyncIterable(v) {
|
|
71
|
+
return typeof v === "object" && v !== null && Symbol.asyncIterator in v;
|
|
72
|
+
}
|
|
73
|
+
formatHelper(f) {
|
|
74
|
+
if (/([A-Za-z]+-[A-Za-z]+)/g.test(f) === true) return f.split(/-/g).map((v) => v.substring(0, 1).toUpperCase().concat(v.substring(1))).join(" ");
|
|
75
|
+
else return f.substring(0, 1).toUpperCase().concat(f.substring(1));
|
|
76
|
+
}
|
|
77
|
+
cleanDataUrl(props) {
|
|
78
|
+
return props.replace(/^data:(?:image|application|haptics|video|text|font|model|audio|multipart)\/[A-Za-z0-9+-.]+(?:;[^,]+)*;base64,/i, "");
|
|
79
|
+
}
|
|
80
|
+
toReadable(data) {
|
|
81
|
+
if (typeof data === "string") return Readable.from([Buffer.from(data)]);
|
|
82
|
+
if (this.isBuffer(data) || this.isUint8Array(data)) return Readable.from([data]);
|
|
83
|
+
if (this.isWebReadableStream(data)) return Readable.fromWeb(data);
|
|
84
|
+
if (this.isAsyncIterable(data)) return Readable.from(data);
|
|
85
|
+
if (data instanceof Readable) return data;
|
|
86
|
+
throw new TypeError("Unsupported data type for toReadable()");
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
*
|
|
90
|
+
* @param target path to the file or directory to check for existence
|
|
91
|
+
* @returns true if the file or directory exists, false otherwise
|
|
92
|
+
* @example
|
|
93
|
+
* ```ts
|
|
94
|
+
* const fs = new Fs(process.cwd());
|
|
95
|
+
* const exists = fs.exists("my-file.txt");
|
|
96
|
+
* console.log(exists); // true if the file exists, false otherwise
|
|
97
|
+
* ```
|
|
98
|
+
* @description
|
|
99
|
+
* This method checks if a file or directory exists at the specified path input
|
|
100
|
+
*
|
|
101
|
+
* Additional Note:
|
|
102
|
+
*
|
|
103
|
+
* say you have a directory that begins with a dot, such as `.turbo`;
|
|
104
|
+
*
|
|
105
|
+
* in this scenario, both `./.turbo` and `.turbo` will return true if the directory exists
|
|
106
|
+
*
|
|
107
|
+
*/
|
|
108
|
+
exists(target) {
|
|
109
|
+
if (!/\//gm.test(target)) if (/\./g.test(target)) return fsSync.existsSync(resolve(join(this.cwd, target)));
|
|
110
|
+
else {
|
|
111
|
+
const isDir = fsSync.statSync(resolve(join(this.cwd, target)), { throwIfNoEntry: false })?.isDirectory();
|
|
112
|
+
if (isDir) return isDir;
|
|
113
|
+
else return false;
|
|
114
|
+
}
|
|
115
|
+
else if (/\./g.test(target)) return fsSync.existsSync(relative(this.cwd ?? process.cwd(), target));
|
|
116
|
+
else {
|
|
117
|
+
const isDir = fsSync.statSync(relative(this.cwd, target), { throwIfNoEntry: false })?.isDirectory();
|
|
118
|
+
if (isDir) return isDir;
|
|
119
|
+
else return false;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
*
|
|
124
|
+
* @param ms milliseconds to wait
|
|
125
|
+
* @returns a promise that resolves after the specified number of milliseconds
|
|
126
|
+
* @example
|
|
127
|
+
* ```ts
|
|
128
|
+
* const fs = new Fs(process.cwd());
|
|
129
|
+
* await fs.wait(1000); // waits for 1 second
|
|
130
|
+
* console.log("Done waiting!");
|
|
131
|
+
* ```
|
|
132
|
+
*
|
|
133
|
+
* Alternatively, you can use it like this:
|
|
134
|
+
* ```ts
|
|
135
|
+
* const fs = new Fs(process.cwd());
|
|
136
|
+
* fs.wait(1000).then(() => { // waits for 1 second
|
|
137
|
+
* console.log("Done waiting!");
|
|
138
|
+
* // do something after waiting
|
|
139
|
+
* });
|
|
140
|
+
* ```
|
|
141
|
+
*
|
|
142
|
+
* @description
|
|
143
|
+
* This method is useful for delaying execution in asynchronous code, such as when you need to wait for a file operation to complete or when you want to introduce a delay in a loop.
|
|
144
|
+
*/
|
|
145
|
+
wait(ms) {
|
|
146
|
+
return new Promise((resolve$1) => setTimeout(resolve$1, ms));
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Handles an array or readonly array of strings and/or Buffers, converting Buffers to strings
|
|
150
|
+
* @param arr An array or readonly array of strings and/or Buffers
|
|
151
|
+
* @returns An array of strings with Buffers converted to UTF-8 strings.
|
|
152
|
+
*/
|
|
153
|
+
handleBuffStrArrUnion(arr) {
|
|
154
|
+
return arr.map((v) => Buffer.isBuffer(v) ? Buffer.from(v).toString("utf-8") : v);
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
*
|
|
158
|
+
* @param path path to the directory relative to the cwd
|
|
159
|
+
* @param options options for reading the directory, defaults to recursive
|
|
160
|
+
*
|
|
161
|
+
* The following two examples are equivalent:
|
|
162
|
+
*
|
|
163
|
+
* @example
|
|
164
|
+
* ```ts
|
|
165
|
+
* const fs = new Fs(process.cwd());
|
|
166
|
+
* const files = fs.readDir("./my-directory", { recursive: true });
|
|
167
|
+
* console.log(files);
|
|
168
|
+
* ```
|
|
169
|
+
* @example
|
|
170
|
+
* ```ts
|
|
171
|
+
* const fs = new Fs(process.cwd());
|
|
172
|
+
* const files = fs.readDir("my-directory", { recursive: true });
|
|
173
|
+
* console.log(files);
|
|
174
|
+
* ```
|
|
175
|
+
*
|
|
176
|
+
* @returns an array of strings representing the contents of the directory
|
|
177
|
+
*/
|
|
178
|
+
readDir(path, options = {
|
|
179
|
+
recursive: true,
|
|
180
|
+
withFileTypes: false,
|
|
181
|
+
encoding: "utf-8"
|
|
182
|
+
}) {
|
|
183
|
+
if (this.isRootPathTargeted(path)) return this.handleBuffStrArrUnion(fsSync.readdirSync(resolve(join(this.cwd, "./")), { ...options }));
|
|
184
|
+
else return this.handleBuffStrArrUnion(fsSync.readdirSync(relative(this.cwd ??= process.cwd(), path), options));
|
|
185
|
+
}
|
|
13
186
|
};
|
|
187
|
+
|
|
188
|
+
//#endregion
|
|
189
|
+
export { FsBase };
|
|
14
190
|
//# sourceMappingURL=index.js.map
|
package/dist/fs-core/index.d.ts
CHANGED
|
@@ -1,27 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import '../fs-base/index.js';
|
|
5
|
-
import 'node:stream';
|
|
6
|
-
import 'stream/web';
|
|
7
|
-
import 'dotenv-expand';
|
|
8
|
-
import '../types/stream.js';
|
|
9
|
-
import '../image/index.js';
|
|
10
|
-
import '@d0paminedriven/metadata';
|
|
11
|
-
import '../image/workup.js';
|
|
12
|
-
import 'stream';
|
|
13
|
-
import '../mime/index.js';
|
|
14
|
-
import '../url/index.js';
|
|
15
|
-
import '../utils/index.js';
|
|
16
|
-
import '../ld/index.js';
|
|
17
|
-
import 'fs';
|
|
1
|
+
import { WriteFileAsyncDataType, WriteFileAsyncOptions, WriteStreamOptions, WriteableDataType } from "../types/index.js";
|
|
2
|
+
import { FsSize } from "../fs-size/index.js";
|
|
3
|
+
import { Abortable } from "node:events";
|
|
18
4
|
|
|
5
|
+
//#region src/fs-core/index.d.ts
|
|
6
|
+
interface CreateReadStreamOptions extends Abortable {
|
|
7
|
+
encoding?: BufferEncoding | null | undefined;
|
|
8
|
+
autoClose?: boolean | undefined;
|
|
9
|
+
emitClose?: boolean | undefined;
|
|
10
|
+
start?: number | undefined;
|
|
11
|
+
end?: number | undefined;
|
|
12
|
+
highWaterMark?: number | undefined;
|
|
13
|
+
}
|
|
19
14
|
declare class FsCore extends FsSize {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
15
|
+
cwd: string;
|
|
16
|
+
constructor(cwd: string);
|
|
17
|
+
withWs<const T extends string>(path: T, data: WriteableDataType, options?: WriteStreamOptions): string | boolean | undefined;
|
|
18
|
+
withWsAsync<const T extends string>(path: T, data: WriteableDataType, options?: WriteStreamOptions): Promise<string | boolean | undefined>;
|
|
19
|
+
writeFileAsync: <const T extends string>(path: T, data: WriteFileAsyncDataType, options?: WriteFileAsyncOptions) => Promise<void | string>;
|
|
25
20
|
}
|
|
26
|
-
|
|
27
|
-
export { FsCore };
|
|
21
|
+
//#endregion
|
|
22
|
+
export { CreateReadStreamOptions, FsCore };
|
|
23
|
+
//# sourceMappingURL=index.d.ts.map
|
package/dist/fs-core/index.js
CHANGED
|
@@ -1,18 +1,46 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
} from "
|
|
4
|
-
import "
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import { FsSize } from "../fs-size/index.js";
|
|
2
|
+
import fsSync from "node:fs";
|
|
3
|
+
import { relative } from "path";
|
|
4
|
+
import fsAsync from "fs/promises";
|
|
5
|
+
|
|
6
|
+
//#region src/fs-core/index.ts
|
|
7
|
+
var FsCore = class extends FsSize {
|
|
8
|
+
constructor(cwd) {
|
|
9
|
+
super(cwd ??= process.cwd());
|
|
10
|
+
this.cwd = cwd;
|
|
11
|
+
}
|
|
12
|
+
withWs(path, data, options) {
|
|
13
|
+
try {
|
|
14
|
+
if (/\//g.test(path) === true) return this.generateDirIfDNE(this.pathHandler(path), { recursive: true });
|
|
15
|
+
else return path;
|
|
16
|
+
} catch (error) {
|
|
17
|
+
console.error(`[withWs error]: `.concat(typeof error === "string" ? error : JSON.stringify(error, null, 2)));
|
|
18
|
+
} finally {
|
|
19
|
+
return fsSync.createWriteStream(relative(this.cwd ?? process.cwd(), path), typeof options !== "undefined" ? typeof options === "object" ? options : options : { autoClose: true }).write(data);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
async withWsAsync(path, data, options) {
|
|
23
|
+
try {
|
|
24
|
+
if (/\//g.test(path) === true) return this.generateDirIfDNE(this.pathHandler(path), { recursive: true });
|
|
25
|
+
else return path;
|
|
26
|
+
} catch (error) {
|
|
27
|
+
console.error(`[withWs error]: `.concat(typeof error === "string" ? error : JSON.stringify(error, null, 2)));
|
|
28
|
+
} finally {
|
|
29
|
+
return fsSync.createWriteStream(relative(this.cwd ?? process.cwd(), path), typeof options !== "undefined" ? typeof options === "object" ? options : options : { autoClose: true }).write(data);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
writeFileAsync = async (path, data, options = {}) => {
|
|
33
|
+
try {
|
|
34
|
+
if (/\//g.test(path) === true) return this.generateDirIfDNE(this.pathHandler(path), { recursive: true });
|
|
35
|
+
else return path;
|
|
36
|
+
} catch (error) {
|
|
37
|
+
console.error(`[writeFileAsync error]: `.concat(error instanceof Error ? error.message : typeof error === "string" ? error : JSON.stringify(error, null, 2)));
|
|
38
|
+
} finally {
|
|
39
|
+
return fsAsync.writeFile(relative(this.cwd, path), data, options);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
17
42
|
};
|
|
43
|
+
|
|
44
|
+
//#endregion
|
|
45
|
+
export { FsCore };
|
|
18
46
|
//# sourceMappingURL=index.js.map
|
package/dist/fs-fetch/index.d.ts
CHANGED
|
@@ -1,66 +1,52 @@
|
|
|
1
|
-
import { FsTmp } from
|
|
2
|
-
import '../types/index.js';
|
|
3
|
-
import 'stream';
|
|
4
|
-
import 'fs';
|
|
5
|
-
import '../fs-core/index.js';
|
|
6
|
-
import '../fs-size/index.js';
|
|
7
|
-
import '../fs-atomic/index.js';
|
|
8
|
-
import '../fs-base/index.js';
|
|
9
|
-
import 'node:stream';
|
|
10
|
-
import 'stream/web';
|
|
11
|
-
import 'dotenv-expand';
|
|
12
|
-
import '../types/stream.js';
|
|
13
|
-
import '../image/index.js';
|
|
14
|
-
import '@d0paminedriven/metadata';
|
|
15
|
-
import '../image/workup.js';
|
|
16
|
-
import '../mime/index.js';
|
|
17
|
-
import '../url/index.js';
|
|
18
|
-
import '../utils/index.js';
|
|
19
|
-
import '../ld/index.js';
|
|
1
|
+
import { FsTmp } from "../fs-tmp/index.js";
|
|
20
2
|
|
|
3
|
+
//#region src/fs-fetch/index.d.ts
|
|
21
4
|
declare class FsFetch extends FsTmp {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
5
|
+
cwd: string;
|
|
6
|
+
constructor(cwd: string);
|
|
7
|
+
assetToBuffer<const T extends string>(path: T): Promise<{
|
|
8
|
+
readonly b64encodedData: `data:application/dash+xml;base64, ${string}` | `data:application/epub+zip;base64, ${string}` | `data:application/font-sfnt;base64, ${string}` | `data:application/gzip;base64, ${string}` | `data:application/java-archive;base64, ${string}` | `data:application/json5;base64, ${string}` | `data:application/json;base64, ${string}` | `data:application/jsonc;base64, ${string}` | `data:application/jsonl;base64, ${string}` | `data:application/ld+json;base64, ${string}` | `data:application/manifest+json;base64, ${string}` | `data:application/msword;base64, ${string}` | `data:application/node;base64, ${string}` | `data:application/octet-stream;base64, ${string}` | `data:application/ogg;base64, ${string}` | `data:application/pdf;base64, ${string}` | `data:application/rtf;base64, ${string}` | `data:application/sql;base64, ${string}` | `data:application/toml;base64, ${string}` | `data:application/typescript;base64, ${string}` | `data:application/vnd.amazon.ebook;base64, ${string}` | `data:application/vnd.apple.installer+xml;base64, ${string}` | `data:application/vnd.apple.mpegurl;base64, ${string}` | `data:application/vnd.apple.pkpass;base64, ${string}` | `data:application/vnd.mozilla.xul+xml;base64, ${string}` | `data:application/vnd.ms-excel;base64, ${string}` | `data:application/vnd.ms-fontobject;base64, ${string}` | `data:application/vnd.ms-powerpoint;base64, ${string}` | `data:application/vnd.oasis.opendocument.presentation;base64, ${string}` | `data:application/vnd.oasis.opendocument.spreadsheet;base64, ${string}` | `data:application/vnd.oasis.opendocument.text;base64, ${string}` | `data:application/vnd.openxmlformats-officedocument.presentationml.presentation;base64, ${string}` | `data:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;base64, ${string}` | `data:application/vnd.openxmlformats-officedocument.wordprocessingml.document;base64, ${string}` | `data:application/vnd.rar;base64, ${string}` | `data:application/vnd.visio;base64, ${string}` | `data:application/wasm;base64, ${string}` | `data:application/x-7z-compressed;base64, ${string}` | `data:application/x-abiword;base64, ${string}` | `data:application/x-bzip2;base64, ${string}` | `data:application/x-bzip;base64, ${string}` | `data:application/x-cdf;base64, ${string}` | `data:application/x-csh;base64, ${string}` | `data:application/x-freearc;base64, ${string}` | `data:application/x-gzip;base64, ${string}` | `data:application/x-httpd-php;base64, ${string}` | `data:application/x-mdx;base64, ${string}` | `data:application/x-ndjson;base64, ${string}` | `data:application/x-python-code;base64, ${string}` | `data:application/x-sh;base64, ${string}` | `data:application/x-tar;base64, ${string}` | `data:application/x-zip-compressed;base64, ${string}` | `data:application/xhtml+xml;base64, ${string}` | `data:application/xml;base64, ${string}` | `data:application/yaml;base64, ${string}` | `data:application/zip;base64, ${string}` | `data:audio/aac;base64, ${string}` | `data:audio/midi;base64, ${string}` | `data:audio/mp4;base64, ${string}` | `data:audio/mpeg;base64, ${string}` | `data:audio/ogg;base64, ${string}` | `data:audio/wav;base64, ${string}` | `data:audio/webm;base64, ${string}` | `data:audio/x-midi;base64, ${string}` | `data:font/otf;base64, ${string}` | `data:font/ttf;base64, ${string}` | `data:font/woff2;base64, ${string}` | `data:font/woff;base64, ${string}` | `data:haptics/hjif;base64, ${string}` | `data:haptics/hmpg;base64, ${string}` | `data:haptics/ivs;base64, ${string}` | `data:image/aces;base64, ${string}` | `data:image/apng;base64, ${string}` | `data:image/avci;base64, ${string}` | `data:image/avif;base64, ${string}` | `data:image/bmp;base64, ${string}` | `data:image/dpx;base64, ${string}` | `data:image/emf;base64, ${string}` | `data:image/gif;base64, ${string}` | `data:image/heic;base64, ${string}` | `data:image/jpeg;base64, ${string}` | `data:image/ktx2;base64, ${string}` | `data:image/ktx;base64, ${string}` | `data:image/png;base64, ${string}` | `data:image/svg+xml;base64, ${string}` | `data:image/tiff;base64, ${string}` | `data:image/vnd.microsoft.icon;base64, ${string}` | `data:image/webp;base64, ${string}` | `data:image/x-icon;base64, ${string}` | `data:model/gltf+json;base64, ${string}` | `data:model/gltf-binary;base64, ${string}` | `data:model/obj;base64, ${string}` | `data:model/vnd.usdz+zip;base64, ${string}` | `data:multipart/voice-message;base64, ${string}` | `data:text/calendar;base64, ${string}` | `data:text/css;base64, ${string}` | `data:text/csv;base64, ${string}` | `data:text/event-stream;base64, ${string}` | `data:text/html;base64, ${string}` | `data:text/javascript;base64, ${string}` | `data:text/markdown;base64, ${string}` | `data:text/plain;base64, ${string}` | `data:text/rust;base64, ${string}` | `data:text/typescript;base64, ${string}` | `data:text/vtt;base64, ${string}` | `data:text/x-c++;base64, ${string}` | `data:text/x-c;base64, ${string}` | `data:text/x-csharp;base64, ${string}` | `data:text/x-java;base64, ${string}` | `data:text/x-jsonl;base64, ${string}` | `data:text/x-php;base64, ${string}` | `data:text/x-python;base64, ${string}` | `data:text/x-ruby;base64, ${string}` | `data:text/x-script.python;base64, ${string}` | `data:text/x-tex;base64, ${string}` | `data:text/xml;base64, ${string}` | `data:video/3gpp2;base64, ${string}` | `data:video/3gpp;base64, ${string}` | `data:video/mp2t;base64, ${string}` | `data:video/mp4;base64, ${string}` | `data:video/mpeg;base64, ${string}` | `data:video/ogg;base64, ${string}` | `data:video/vnd.dlna.mpeg-tts;base64, ${string}` | `data:video/webm;base64, ${string}` | `data:video/x-msvideo;base64, ${string}`;
|
|
9
|
+
readonly extension: "3g2" | "3gp" | "7z" | "aac" | "abw" | "aces" | "apng" | "arc" | "avci" | "avi" | "avif" | "azw" | "bin" | "bmp" | "bz" | "bz2" | "c" | "cda" | "cjs" | "cpp" | "cs" | "csh" | "css" | "csv" | "cur" | "doc" | "docx" | "dpx" | "emf" | "eot" | "epub" | "gif" | "glb" | "gltf" | "gz" | "heic" | "hjif" | "hmpg" | "htm" | "html" | "ico" | "ics" | "ivs" | "ivt" | "jar" | "java" | "jfif" | "jif" | "jpe" | "jpeg" | "jpg" | "js" | "json" | "json5" | "jsonc" | "jsonl" | "jsonld" | "jsonlines" | "ktx" | "ktx2" | "m3u8" | "m4a" | "m4s" | "m4v" | "md" | "mdx" | "mid" | "midi" | "mjs" | "mp3" | "mp4" | "mpd" | "mpeg" | "mpkg" | "mtlx" | "ndjson" | "node" | "obj" | "odp" | "ods" | "odt" | "oga" | "ogg" | "ogv" | "ogx" | "opus" | "otf" | "pdf" | "php" | "pjp" | "pjpeg" | "pk1" | "pkpass" | "png" | "ppt" | "pptx" | "py" | "pyc" | "rar" | "rb" | "rs" | "rtf" | "sh" | "sql" | "sse" | "svg" | "tar" | "tex" | "tif" | "tiff" | "toml" | "ts" | "ttf" | "txt" | "usdz" | "vsd" | "vtt" | "wasm" | "wav" | "weba" | "webm" | "webmanifest" | "webp" | "woff" | "woff2" | "xhtml" | "xls" | "xlsx" | "xml" | "xul" | "yaml" | "yml" | "zip";
|
|
10
|
+
}>;
|
|
11
|
+
assetToBufferView<const T extends string>(path: T): Promise<{
|
|
12
|
+
readonly b64encodedData: string;
|
|
13
|
+
readonly extension: "3g2" | "3gp" | "7z" | "aac" | "abw" | "aces" | "apng" | "arc" | "avci" | "avi" | "avif" | "azw" | "bin" | "bmp" | "bz" | "bz2" | "c" | "cda" | "cjs" | "cpp" | "cs" | "csh" | "css" | "csv" | "cur" | "doc" | "docx" | "dpx" | "emf" | "eot" | "epub" | "gif" | "glb" | "gltf" | "gz" | "heic" | "hjif" | "hmpg" | "htm" | "html" | "ico" | "ics" | "ivs" | "ivt" | "jar" | "java" | "jfif" | "jif" | "jpe" | "jpeg" | "jpg" | "js" | "json" | "json5" | "jsonc" | "jsonl" | "jsonld" | "jsonlines" | "ktx" | "ktx2" | "m3u8" | "m4a" | "m4s" | "m4v" | "md" | "mdx" | "mid" | "midi" | "mjs" | "mp3" | "mp4" | "mpd" | "mpeg" | "mpkg" | "mtlx" | "ndjson" | "node" | "obj" | "odp" | "ods" | "odt" | "oga" | "ogg" | "ogv" | "ogx" | "opus" | "otf" | "pdf" | "php" | "pjp" | "pjpeg" | "pk1" | "pkpass" | "png" | "ppt" | "pptx" | "py" | "pyc" | "rar" | "rb" | "rs" | "rtf" | "sh" | "sql" | "sse" | "svg" | "tar" | "tex" | "tif" | "tiff" | "toml" | "ts" | "ttf" | "txt" | "usdz" | "vsd" | "vtt" | "wasm" | "wav" | "weba" | "webm" | "webmanifest" | "webp" | "woff" | "woff2" | "xhtml" | "xls" | "xlsx" | "xml" | "xul" | "yaml" | "yml" | "zip" | undefined;
|
|
14
|
+
}>;
|
|
15
|
+
/**
|
|
16
|
+
*
|
|
17
|
+
* @param inputUrl remote url to fetch data from
|
|
18
|
+
* @param outputPath desired output path relative to the cwd
|
|
19
|
+
* @param useDetectedExtension optional, defaults to true
|
|
20
|
+
*
|
|
21
|
+
* if `useDetectedExtension` is false you must include the file extension in your output path →
|
|
22
|
+
*
|
|
23
|
+
* 🚫 'public/assets/image-1'
|
|
24
|
+
*
|
|
25
|
+
* ✅ 'public/assets/image-1.png'
|
|
26
|
+
*/
|
|
27
|
+
fetchRemoteWriteLocal<const I extends string, const O extends string>(inputUrl: I, outputPath: O, useDetectedExtension?: boolean): Promise<void>;
|
|
28
|
+
private knownToBlockHead;
|
|
29
|
+
getUrlExt(url: string): string | null;
|
|
30
|
+
private fuzzyExtEquality;
|
|
31
|
+
/**
|
|
32
|
+
*
|
|
33
|
+
* @param inputUrl remote url to fetch data from
|
|
34
|
+
* @param outputPath desired output path relative to the cwd
|
|
35
|
+
* @param useDetectedExtension optional, defaults to true
|
|
36
|
+
*
|
|
37
|
+
* if `useDetectedExtension` is false you must include the file extension in your output path →
|
|
38
|
+
*
|
|
39
|
+
* 🚫 'public/assets/image-1'
|
|
40
|
+
*
|
|
41
|
+
* ✅ 'public/assets/image-1.png'
|
|
42
|
+
*
|
|
43
|
+
* @description
|
|
44
|
+
* This method is designed for all files regardless of size, but especially for
|
|
45
|
+
* larger files that may not fit into memory (it intelligently determines the best approach on the fly)
|
|
46
|
+
* It streams the data directly to disk for files of all sizes instead of loading it all into memory
|
|
47
|
+
*/
|
|
48
|
+
fetchRemoteWriteLocalLargeFiles<const I extends string, const O extends string>(inputUrl: I, outputPathI: O, useDetectedExtension?: boolean): Promise<void>;
|
|
64
49
|
}
|
|
65
|
-
|
|
50
|
+
//#endregion
|
|
66
51
|
export { FsFetch };
|
|
52
|
+
//# sourceMappingURL=index.d.ts.map
|