@zenfs/core 0.2.2 → 0.2.3
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/browser.min.js +1 -1
- package/dist/browser.min.js.map +2 -2
- package/dist/utils.d.ts +1 -6
- package/dist/utils.js +5 -5
- package/package.json +1 -1
package/dist/utils.d.ts
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
3
2
|
import { FileSystem } from './filesystem.js';
|
|
4
3
|
import { Cred } from './cred.js';
|
|
5
|
-
import type { TextDecoder as _TextDecoder, TextEncoder as _TextEncoder } from 'node:util';
|
|
6
4
|
declare global {
|
|
7
|
-
function setImmediate(callback: () => unknown): void;
|
|
8
5
|
function atob(data: string): string;
|
|
9
6
|
function btoa(data: string): string;
|
|
10
|
-
const TextDecoder: typeof _TextDecoder;
|
|
11
|
-
const TextEncoder: typeof _TextEncoder;
|
|
12
7
|
}
|
|
13
8
|
/**
|
|
14
9
|
* Synchronous recursive makedir.
|
|
@@ -30,7 +25,7 @@ export declare function toPromise(fn: (...fnArgs: unknown[]) => unknown): (...ar
|
|
|
30
25
|
/**
|
|
31
26
|
* @internal
|
|
32
27
|
*/
|
|
33
|
-
export declare const setImmediate:
|
|
28
|
+
export declare const setImmediate: (callback: () => unknown) => void;
|
|
34
29
|
/**
|
|
35
30
|
* Encodes a string into a buffer
|
|
36
31
|
* @internal
|
package/dist/utils.js
CHANGED
|
@@ -123,7 +123,7 @@ export const setImmediate = typeof globalThis.setImmediate == 'function' ? globa
|
|
|
123
123
|
export function encode(input, encoding = 'utf8') {
|
|
124
124
|
switch (encoding) {
|
|
125
125
|
case 'ascii':
|
|
126
|
-
return new TextEncoder().encode(input).map(v => v & 0x7f);
|
|
126
|
+
return new globalThis.TextEncoder().encode(input).map(v => v & 0x7f);
|
|
127
127
|
case 'latin1':
|
|
128
128
|
case 'binary':
|
|
129
129
|
case 'utf8':
|
|
@@ -131,11 +131,11 @@ export function encode(input, encoding = 'utf8') {
|
|
|
131
131
|
case 'base64':
|
|
132
132
|
case 'base64url':
|
|
133
133
|
case 'hex':
|
|
134
|
-
return new TextEncoder().encode(input);
|
|
134
|
+
return new globalThis.TextEncoder().encode(input);
|
|
135
135
|
case 'utf16le':
|
|
136
136
|
case 'ucs2':
|
|
137
137
|
case 'ucs-2':
|
|
138
|
-
return new TextEncoder().encode(input).slice(0, -1);
|
|
138
|
+
return new globalThis.TextEncoder().encode(input).slice(0, -1);
|
|
139
139
|
default:
|
|
140
140
|
throw new ApiError(ErrorCode.EINVAL, 'Invalid encoding: ' + encoding);
|
|
141
141
|
}
|
|
@@ -149,10 +149,10 @@ export function decode(input, encoding = 'utf8') {
|
|
|
149
149
|
case 'ascii':
|
|
150
150
|
case 'utf8':
|
|
151
151
|
case 'utf-8':
|
|
152
|
-
return new TextDecoder().decode(input);
|
|
152
|
+
return new globalThis.TextDecoder().decode(input);
|
|
153
153
|
case 'latin1':
|
|
154
154
|
case 'binary':
|
|
155
|
-
return new TextDecoder('latin1').decode(input);
|
|
155
|
+
return new globalThis.TextDecoder('latin1').decode(input);
|
|
156
156
|
case 'utf16le':
|
|
157
157
|
case 'ucs2':
|
|
158
158
|
case 'ucs-2':
|