@lvce-editor/file-system-process 3.7.0 → 3.8.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.
Files changed (2) hide show
  1. package/dist/index.js +14 -0
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1551,6 +1551,19 @@ const writeFile = async (uri, content, encoding = Utf8) => {
1551
1551
  throw new VError(error, `Failed to write to file "${uri}"`);
1552
1552
  }
1553
1553
  };
1554
+ const writeBuffer = async (uri, buffer) => {
1555
+ try {
1556
+ assertUri(uri);
1557
+ string(uri);
1558
+ const path = fileURLToPath(uri);
1559
+ await fs.writeFile(path, buffer);
1560
+ } catch (error) {
1561
+ if (isEnoentError(error)) {
1562
+ throw new FileNotFoundError(uri);
1563
+ }
1564
+ throw new VError(error, `Failed to write to file "${uri}"`);
1565
+ }
1566
+ };
1554
1567
  const appendFile = async (uri, content) => {
1555
1568
  try {
1556
1569
  assertUri(uri);
@@ -1885,6 +1898,7 @@ const commandMap = {
1885
1898
  'FileSystem.unwatchFile': unwatchFile,
1886
1899
  'FileSystem.watchFile': watchFile,
1887
1900
  'FileSystem.writeFile': writeFile,
1901
+ 'FileSystem.writeBuffer': writeBuffer,
1888
1902
  'HandleElectronMessagePort.handleElectronMessagePort': handleElectronMessagePort,
1889
1903
  'HandleWebSocket.handleWebSocket': handleWebSocket,
1890
1904
  'Initialize.initialize': initialize,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/file-system-process",
3
- "version": "3.7.0",
3
+ "version": "3.8.0",
4
4
  "description": "File System Process",
5
5
  "keywords": [
6
6
  "Lvce Editor",