vscode-fs 0.0.6 → 0.0.7
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/index.cjs +7 -2
- package/dist/index.d.cts +7 -0
- package/dist/index.d.mts +7 -0
- package/dist/index.mjs +7 -2
- package/package.json +4 -1
package/dist/index.cjs
CHANGED
|
@@ -167,11 +167,12 @@ function joinPath(basePath, ...segments) {
|
|
|
167
167
|
return vscode_uri.Utils.joinPath(vscode_uri.URI.file(basePath), ...segments).fsPath;
|
|
168
168
|
}
|
|
169
169
|
async function createNodeFileSystem() {
|
|
170
|
-
const [fs, trash, glob, watch] = await Promise.all([
|
|
170
|
+
const [fs, trash, glob, watch, stream] = await Promise.all([
|
|
171
171
|
import("node:fs"),
|
|
172
172
|
import("trash").then((m) => m.default),
|
|
173
173
|
import("tinyglobby").then((m) => m.glob),
|
|
174
|
-
import("chokidar").then((m) => m.watch)
|
|
174
|
+
import("chokidar").then((m) => m.watch),
|
|
175
|
+
import("node:stream")
|
|
175
176
|
]);
|
|
176
177
|
async function resolveFileType(path) {
|
|
177
178
|
const lstats = await fs.promises.lstat(path);
|
|
@@ -337,6 +338,10 @@ async function createNodeFileSystem() {
|
|
|
337
338
|
resolve(fileSystemWatcher);
|
|
338
339
|
});
|
|
339
340
|
});
|
|
341
|
+
},
|
|
342
|
+
createWritableStream: async (uri) => {
|
|
343
|
+
const writableStream = fs.createWriteStream(uri.fsPath);
|
|
344
|
+
return stream.Writable.toWeb(writableStream);
|
|
340
345
|
}
|
|
341
346
|
};
|
|
342
347
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -232,6 +232,13 @@ interface FileSystem {
|
|
|
232
232
|
*/
|
|
233
233
|
ignoreDeleteEvents?: boolean;
|
|
234
234
|
}): Promise<FileSystemWatcher>;
|
|
235
|
+
/**
|
|
236
|
+
* Create a writer for a file.
|
|
237
|
+
*
|
|
238
|
+
* @param uri The uri of the file to write to.
|
|
239
|
+
* @returns A writer for the file.
|
|
240
|
+
*/
|
|
241
|
+
createWritableStream(uri: URI): Promise<WritableStream<Uint8Array>>;
|
|
235
242
|
}
|
|
236
243
|
interface Disposable {
|
|
237
244
|
/** Dispose resources. */
|
package/dist/index.d.mts
CHANGED
|
@@ -232,6 +232,13 @@ interface FileSystem {
|
|
|
232
232
|
*/
|
|
233
233
|
ignoreDeleteEvents?: boolean;
|
|
234
234
|
}): Promise<FileSystemWatcher>;
|
|
235
|
+
/**
|
|
236
|
+
* Create a writer for a file.
|
|
237
|
+
*
|
|
238
|
+
* @param uri The uri of the file to write to.
|
|
239
|
+
* @returns A writer for the file.
|
|
240
|
+
*/
|
|
241
|
+
createWritableStream(uri: URI): Promise<WritableStream<Uint8Array>>;
|
|
235
242
|
}
|
|
236
243
|
interface Disposable {
|
|
237
244
|
/** Dispose resources. */
|
package/dist/index.mjs
CHANGED
|
@@ -166,11 +166,12 @@ function joinPath(basePath, ...segments) {
|
|
|
166
166
|
return Utils.joinPath(URI.file(basePath), ...segments).fsPath;
|
|
167
167
|
}
|
|
168
168
|
async function createNodeFileSystem() {
|
|
169
|
-
const [fs, trash, glob, watch] = await Promise.all([
|
|
169
|
+
const [fs, trash, glob, watch, stream] = await Promise.all([
|
|
170
170
|
import("node:fs"),
|
|
171
171
|
import("trash").then((m) => m.default),
|
|
172
172
|
import("tinyglobby").then((m) => m.glob),
|
|
173
|
-
import("chokidar").then((m) => m.watch)
|
|
173
|
+
import("chokidar").then((m) => m.watch),
|
|
174
|
+
import("node:stream")
|
|
174
175
|
]);
|
|
175
176
|
async function resolveFileType(path) {
|
|
176
177
|
const lstats = await fs.promises.lstat(path);
|
|
@@ -336,6 +337,10 @@ async function createNodeFileSystem() {
|
|
|
336
337
|
resolve(fileSystemWatcher);
|
|
337
338
|
});
|
|
338
339
|
});
|
|
340
|
+
},
|
|
341
|
+
createWritableStream: async (uri) => {
|
|
342
|
+
const writableStream = fs.createWriteStream(uri.fsPath);
|
|
343
|
+
return stream.Writable.toWeb(writableStream);
|
|
339
344
|
}
|
|
340
345
|
};
|
|
341
346
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vscode-fs",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.7",
|
|
5
5
|
"description": "VSCode like simple、serializable and cross-platform file system utilities.",
|
|
6
6
|
"author": "Naily Zero <zero@naily.cc> (https://naily.cc)",
|
|
7
7
|
"license": "MIT",
|
|
@@ -41,6 +41,9 @@
|
|
|
41
41
|
"files": [
|
|
42
42
|
"dist"
|
|
43
43
|
],
|
|
44
|
+
"engines": {
|
|
45
|
+
"node": ">=17.0.0"
|
|
46
|
+
},
|
|
44
47
|
"peerDependencies": {
|
|
45
48
|
"vscode-uri": "^3.1.0"
|
|
46
49
|
},
|