@vscode-utility/fs-browserify
When developing vscode extensions, it is essential to ensure compatibility between the desktop and web versions of vscode (https://vscode.dev or https://github.dev).
Using @vscode-utility/fs-browserify
, you can access and manipulate files stored locally or remotely, making it easier to develop vscode extensions that work seamlessly on both the desktop and web versions of vscode.
This library utilizes a portion of the File System provided by the VS Code API.
If you find this package useful for your projects, please consider supporting me by Github, Patreon, KO-FI or Paypal. It's a great way to help me maintain and improve this tool in the future. Your support is truly appreciated!
Installation
npm
npm install @vscode-utility/fs-browserify
yarn
yarn add @vscode-utility/fs-browserify
pnpm
pnpm add @vscode-utility/fs-browserify
Usage
import { fs } from '@vscode-utility/fs-browserify';
await fs.statAsync(path);
await fs.readDirectoryAsync(path);
await fs.createDirectoryAsync(path);
await fs.readFileAsync(path, options);
await fs.readJsonAsync(path, options);
await fs.appendFileAsync(path, content);
await fs.writeFileAsync(path, content);
await fs.writeJsonAsync(path, content, options);
await fs.deleteAsync(path, options);
await fs.renameAsync(source, target, options);
await fs.copyAsync(source, target, options);
await fs.existAsync(source);
await fs.existAsync(path, length);
fs.access(path);
Compare functions
@vscode-utility/fs-browserify | fs (node) | fs (vscode api) |
---|
fs.statAsync () | fs.stat () | fs.stat () |
fs.readDirectoryAsync () | fs.readDir () | fs.readDirectory () |
fs.createDirectoryAsync () | fs.mkdir () | fs.createDirectory () |
fs.readFileAsync () | fs.readFile () | fs.readFile () |
fs.readJsonAsync () | undefined | undefined |
fs.appendFileAsync () | fs.appendFile () | undefined |
fs.writeFileAsync () | fs.writeFile () | fs.writeFile () |
fs.writeJsonAsync () | undefined | undefined |
fs.deleteAsync () | fs.rmdir () | fs.delete () |
fs.renameAsync () | fs.rename () | fs.rename () |
fs.copyAsync () | fs.cp () | fs.copy () |
fs.existAsync () | fs.exist () | undefined |
fs.truncateAsync () | fs.truncate () | undefined |
fs.watch () | fs.watch () | undefined |
fs.access () | fs.access () | undefined |
Feedback
If you discover a bug, or have a suggestion for a feature request, please
submit an issue.
LICENSE
This extension is licensed under the MIT License