Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@tauri-apps/plugin-fs

Package Overview
Dependencies
Maintainers
5
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tauri-apps/plugin-fs - npm Package Compare versions

Comparing version 2.0.0-beta.0 to 2.0.0-beta.1

58

dist-js/index.d.ts

@@ -224,3 +224,3 @@ /**

* // if "$APP/foo/bar.txt" contains the text "hello world":
* const file = await open("foo/bar.txt", { dir: BaseDirectory.App });
* const file = await open("foo/bar.txt", { baseDir: BaseDirectory.App });
* const buf = new Uint8Array(100);

@@ -252,4 +252,4 @@ * const numberOfBytesRead = await file.read(buf); // 11 bytes

* // Given hello.txt pointing to file with "Hello world", which is 11 bytes long:
* const file = await open('hello.txt', { read: true, write: true, truncate: true, create: true, dir: BaseDirectory.App });
* await file.write(new TextEncoder().encode("Hello world"), { dir: BaseDirectory.App });
* const file = await open('hello.txt', { read: true, write: true, truncate: true, create: true, baseDir: BaseDirectory.App });
* await file.write(new TextEncoder().encode("Hello world"), { baseDir: BaseDirectory.App });
*

@@ -273,3 +273,3 @@ * // Seek 6 bytes from the start of the file

* import { open, fstat, BaseDirectory } from '@tauri-apps/plugin-fs';
* const file = await open("file.txt", { read: true, dir: BaseDirectory.App });
* const file = await open("file.txt", { read: true, baseDir: BaseDirectory.App });
* const fileInfo = await fstat(file.rid);

@@ -291,7 +291,7 @@ * console.log(fileInfo.isFile); // true

* // truncate the entire file
* const file = await open("my_file.txt", { read: true, write: true, create: true, dir: BaseDirectory.App });
* const file = await open("my_file.txt", { read: true, write: true, create: true, baseDir: BaseDirectory.App });
* await ftruncate(file.rid);
*
* // truncate part of the file
* const file = await open("my_file.txt", { read: true, write: true, create: true, dir: BaseDirectory.App });
* const file = await open("my_file.txt", { read: true, write: true, create: true, baseDir: BaseDirectory.App });
* await write(file.rid, new TextEncoder().encode("Hello World"));

@@ -320,3 +320,3 @@ * await ftruncate(file.rid, 7);

* const data = encoder.encode("Hello world");
* const file = await open("bar.txt", { write: true, dir: BaseDirectory.App });
* const file = await open("bar.txt", { write: true, baseDir: BaseDirectory.App });
* const bytesWritten = await write(file.rid, data); // 11

@@ -344,3 +344,3 @@ * await close(file.rid);

* import { create, BaseDirectory } from "@tauri-apps/plugin-fs"
* const file = await create("foo/bar.txt", { dir: BaseDirectory.App });
* const file = await create("foo/bar.txt", { baseDir: BaseDirectory.App });
* ```

@@ -412,3 +412,3 @@ *

* import { open, BaseDirectory } from "@tauri-apps/plugin-fs"
* const file = await open("foo/bar.txt", { read: true, write: true, dir: BaseDirectory.App });
* const file = await open("foo/bar.txt", { read: true, write: true, baseDir: BaseDirectory.App });
* // Do work with file

@@ -435,3 +435,3 @@ * await close(file.rid);

* import { copyFile, BaseDirectory } from '@tauri-apps/plugin-fs';
* await copyFile('app.conf', 'app.conf.bk', { dir: BaseDirectory.App });
* await copyFile('app.conf', 'app.conf.bk', { fromPathBaseDir: BaseDirectory.App, toPathBaseDir: BaseDirectory.App });
* ```

@@ -460,3 +460,3 @@ *

* import { mkdir, BaseDirectory } from '@tauri-apps/plugin-fs';
* await mkdir('users', { dir: BaseDirectory.App });
* await mkdir('users', { baseDir: BaseDirectory.App });
* ```

@@ -497,3 +497,3 @@ *

* const dir = "users"
* const entries = await readDir('users', { dir: BaseDirectory.App });
* const entries = await readDir('users', { baseDir: BaseDirectory.App });
* processEntriesRecursive(dir, entries);

@@ -505,3 +505,3 @@ * async function processEntriesRecursive(parent, entries) {

* const dir = parent + entry.name;
* processEntriesRecursive(dir, await readDir(dir, { dir: BaseDirectory.App }))
* processEntriesRecursive(dir, await readDir(dir, { baseDir: BaseDirectory.App }))
* }

@@ -528,3 +528,3 @@ * }

* import { readFile, BaseDirectory } from '@tauri-apps/plugin-fs';
* const contents = await readFile('avatar.png', { dir: BaseDirectory.Resource });
* const contents = await readFile('avatar.png', { baseDir: BaseDirectory.Resource });
* ```

@@ -540,3 +540,3 @@ *

* import { readTextFile, BaseDirectory } from '@tauri-apps/plugin-fs';
* const contents = await readTextFile('app.conf', { dir: BaseDirectory.App });
* const contents = await readTextFile('app.conf', { baseDir: BaseDirectory.App });
* ```

@@ -552,3 +552,3 @@ *

* import { readTextFileLines, BaseDirectory } from '@tauri-apps/plugin-fs';
* const lines = await readTextFileLines('app.conf', { dir: BaseDirectory.App });
* const lines = await readTextFileLines('app.conf', { baseDir: BaseDirectory.App });
* for await (const line of lines) {

@@ -579,4 +579,4 @@ * console.log(line);

* import { remove, BaseDirectory } from '@tauri-apps/plugin-fs';
* await remove('users/file.txt', { dir: BaseDirectory.App });
* await remove('users', { dir: BaseDirectory.App });
* await remove('users/file.txt', { baseDir: BaseDirectory.App });
* await remove('users', { baseDir: BaseDirectory.App });
* ```

@@ -606,3 +606,3 @@ *

* import { rename, BaseDirectory } from '@tauri-apps/plugin-fs';
* await rename('avatar.png', 'deleted.png', { dir: BaseDirectory.App });
* await rename('avatar.png', 'deleted.png', { oldPathBaseDir: BaseDirectory.App, newPathBaseDir: BaseDirectory.App });
* ```

@@ -612,3 +612,3 @@ *

*/
declare function rename(oldPath: string | URL, newPath: string | URL, options: RenameOptions): Promise<void>;
declare function rename(oldPath: string | URL, newPath: string | URL, options?: RenameOptions): Promise<void>;
/**

@@ -628,3 +628,3 @@ * @since 2.0.0

* import { stat, BaseDirectory } from '@tauri-apps/plugin-fs';
* const fileInfo = await stat("hello.txt", { dir: BaseDirectory.App });
* const fileInfo = await stat("hello.txt", { baseDir: BaseDirectory.App });
* console.log(fileInfo.isFile); // true

@@ -644,3 +644,3 @@ * ```

* import { lstat, BaseDirectory } from '@tauri-apps/plugin-fs';
* const fileInfo = await lstat("hello.txt", { dir: BaseDirectory.App });
* const fileInfo = await lstat("hello.txt", { baseDir: BaseDirectory.App });
* console.log(fileInfo.isFile); // true

@@ -667,9 +667,9 @@ * ```

* // truncate the entire file
* await truncate("my_file.txt", 0, { dir: BaseDirectory.App });
* await truncate("my_file.txt", 0, { baseDir: BaseDirectory.App });
*
* // truncate part of the file
* let file = "file.txt";
* await writeFile(file, new TextEncoder().encode("Hello World"), { dir: BaseDirectory.App });
* await writeFile(file, new TextEncoder().encode("Hello World"), { baseDir: BaseDirectory.App });
* await truncate(file, 7);
* const data = await readFile(file, { dir: BaseDirectory.App });
* const data = await readFile(file, { baseDir: BaseDirectory.App });
* console.log(new TextDecoder().decode(data)); // "Hello W"

@@ -704,3 +704,3 @@ * ```

* let data = encoder.encode("Hello World");
* await writeFile('file.txt', data, { dir: BaseDirectory.App });
* await writeFile('file.txt', data, { baseDir: BaseDirectory.App });
* ```

@@ -717,3 +717,3 @@ *

*
* await writeTextFile('file.txt', "Hello world", { dir: BaseDirectory.App });
* await writeTextFile('file.txt', "Hello world", { baseDir: BaseDirectory.App });
* ```

@@ -737,3 +737,3 @@ *

* // Check if the `$APPDATA/avatar.png` file exists
* await exists('avatar.png', { dir: BaseDirectory.AppData });
* await exists('avatar.png', { baseDir: BaseDirectory.AppData });
* ```

@@ -818,3 +818,3 @@ *

} | {
kind: "name";
kind: "rename";
mode: "any" | "to" | "from" | "both" | "other";

@@ -821,0 +821,0 @@ } | {

@@ -124,3 +124,3 @@ export { BaseDirectory } from '@tauri-apps/api/path';

* // if "$APP/foo/bar.txt" contains the text "hello world":
* const file = await open("foo/bar.txt", { dir: BaseDirectory.App });
* const file = await open("foo/bar.txt", { baseDir: BaseDirectory.App });
* const buf = new Uint8Array(100);

@@ -162,4 +162,4 @@ * const numberOfBytesRead = await file.read(buf); // 11 bytes

* // Given hello.txt pointing to file with "Hello world", which is 11 bytes long:
* const file = await open('hello.txt', { read: true, write: true, truncate: true, create: true, dir: BaseDirectory.App });
* await file.write(new TextEncoder().encode("Hello world"), { dir: BaseDirectory.App });
* const file = await open('hello.txt', { read: true, write: true, truncate: true, create: true, baseDir: BaseDirectory.App });
* await file.write(new TextEncoder().encode("Hello world"), { baseDir: BaseDirectory.App });
*

@@ -189,3 +189,3 @@ * // Seek 6 bytes from the start of the file

* import { open, fstat, BaseDirectory } from '@tauri-apps/plugin-fs';
* const file = await open("file.txt", { read: true, dir: BaseDirectory.App });
* const file = await open("file.txt", { read: true, baseDir: BaseDirectory.App });
* const fileInfo = await fstat(file.rid);

@@ -212,7 +212,7 @@ * console.log(fileInfo.isFile); // true

* // truncate the entire file
* const file = await open("my_file.txt", { read: true, write: true, create: true, dir: BaseDirectory.App });
* const file = await open("my_file.txt", { read: true, write: true, create: true, baseDir: BaseDirectory.App });
* await ftruncate(file.rid);
*
* // truncate part of the file
* const file = await open("my_file.txt", { read: true, write: true, create: true, dir: BaseDirectory.App });
* const file = await open("my_file.txt", { read: true, write: true, create: true, baseDir: BaseDirectory.App });
* await write(file.rid, new TextEncoder().encode("Hello World"));

@@ -246,3 +246,3 @@ * await ftruncate(file.rid, 7);

* const data = encoder.encode("Hello world");
* const file = await open("bar.txt", { write: true, dir: BaseDirectory.App });
* const file = await open("bar.txt", { write: true, baseDir: BaseDirectory.App });
* const bytesWritten = await write(file.rid, data); // 11

@@ -268,3 +268,3 @@ * await close(file.rid);

* import { create, BaseDirectory } from "@tauri-apps/plugin-fs"
* const file = await create("foo/bar.txt", { dir: BaseDirectory.App });
* const file = await create("foo/bar.txt", { baseDir: BaseDirectory.App });
* ```

@@ -293,3 +293,3 @@ *

* import { open, BaseDirectory } from "@tauri-apps/plugin-fs"
* const file = await open("foo/bar.txt", { read: true, write: true, dir: BaseDirectory.App });
* const file = await open("foo/bar.txt", { read: true, write: true, baseDir: BaseDirectory.App });
* // Do work with file

@@ -316,3 +316,3 @@ * await close(file.rid);

* import { copyFile, BaseDirectory } from '@tauri-apps/plugin-fs';
* await copyFile('app.conf', 'app.conf.bk', { dir: BaseDirectory.App });
* await copyFile('app.conf', 'app.conf.bk', { fromPathBaseDir: BaseDirectory.App, toPathBaseDir: BaseDirectory.App });
* ```

@@ -338,3 +338,3 @@ *

* import { mkdir, BaseDirectory } from '@tauri-apps/plugin-fs';
* await mkdir('users', { dir: BaseDirectory.App });
* await mkdir('users', { baseDir: BaseDirectory.App });
* ```

@@ -359,3 +359,3 @@ *

* const dir = "users"
* const entries = await readDir('users', { dir: BaseDirectory.App });
* const entries = await readDir('users', { baseDir: BaseDirectory.App });
* processEntriesRecursive(dir, entries);

@@ -367,3 +367,3 @@ * async function processEntriesRecursive(parent, entries) {

* const dir = parent + entry.name;
* processEntriesRecursive(dir, await readDir(dir, { dir: BaseDirectory.App }))
* processEntriesRecursive(dir, await readDir(dir, { baseDir: BaseDirectory.App }))
* }

@@ -391,3 +391,3 @@ * }

* import { readFile, BaseDirectory } from '@tauri-apps/plugin-fs';
* const contents = await readFile('avatar.png', { dir: BaseDirectory.Resource });
* const contents = await readFile('avatar.png', { baseDir: BaseDirectory.Resource });
* ```

@@ -412,3 +412,3 @@ *

* import { readTextFile, BaseDirectory } from '@tauri-apps/plugin-fs';
* const contents = await readTextFile('app.conf', { dir: BaseDirectory.App });
* const contents = await readTextFile('app.conf', { baseDir: BaseDirectory.App });
* ```

@@ -432,3 +432,3 @@ *

* import { readTextFileLines, BaseDirectory } from '@tauri-apps/plugin-fs';
* const lines = await readTextFileLines('app.conf', { dir: BaseDirectory.App });
* const lines = await readTextFileLines('app.conf', { baseDir: BaseDirectory.App });
* for await (const line of lines) {

@@ -478,4 +478,4 @@ * console.log(line);

* import { remove, BaseDirectory } from '@tauri-apps/plugin-fs';
* await remove('users/file.txt', { dir: BaseDirectory.App });
* await remove('users', { dir: BaseDirectory.App });
* await remove('users/file.txt', { baseDir: BaseDirectory.App });
* await remove('users', { baseDir: BaseDirectory.App });
* ```

@@ -504,3 +504,3 @@ *

* import { rename, BaseDirectory } from '@tauri-apps/plugin-fs';
* await rename('avatar.png', 'deleted.png', { dir: BaseDirectory.App });
* await rename('avatar.png', 'deleted.png', { oldPathBaseDir: BaseDirectory.App, newPathBaseDir: BaseDirectory.App });
* ```

@@ -528,3 +528,3 @@ *

* import { stat, BaseDirectory } from '@tauri-apps/plugin-fs';
* const fileInfo = await stat("hello.txt", { dir: BaseDirectory.App });
* const fileInfo = await stat("hello.txt", { baseDir: BaseDirectory.App });
* console.log(fileInfo.isFile); // true

@@ -550,3 +550,3 @@ * ```

* import { lstat, BaseDirectory } from '@tauri-apps/plugin-fs';
* const fileInfo = await lstat("hello.txt", { dir: BaseDirectory.App });
* const fileInfo = await lstat("hello.txt", { baseDir: BaseDirectory.App });
* console.log(fileInfo.isFile); // true

@@ -572,9 +572,9 @@ * ```

* // truncate the entire file
* await truncate("my_file.txt", 0, { dir: BaseDirectory.App });
* await truncate("my_file.txt", 0, { baseDir: BaseDirectory.App });
*
* // truncate part of the file
* let file = "file.txt";
* await writeFile(file, new TextEncoder().encode("Hello World"), { dir: BaseDirectory.App });
* await writeFile(file, new TextEncoder().encode("Hello World"), { baseDir: BaseDirectory.App });
* await truncate(file, 7);
* const data = await readFile(file, { dir: BaseDirectory.App });
* const data = await readFile(file, { baseDir: BaseDirectory.App });
* console.log(new TextDecoder().decode(data)); // "Hello W"

@@ -603,3 +603,3 @@ * ```

* let data = encoder.encode("Hello World");
* await writeFile('file.txt', data, { dir: BaseDirectory.App });
* await writeFile('file.txt', data, { baseDir: BaseDirectory.App });
* ```

@@ -625,3 +625,3 @@ *

*
* await writeTextFile('file.txt', "Hello world", { dir: BaseDirectory.App });
* await writeTextFile('file.txt', "Hello world", { baseDir: BaseDirectory.App });
* ```

@@ -647,3 +647,3 @@ *

* // Check if the `$APPDATA/avatar.png` file exists
* await exists('avatar.png', { dir: BaseDirectory.AppData });
* await exists('avatar.png', { baseDir: BaseDirectory.AppData });
* ```

@@ -650,0 +650,0 @@ *

{
"name": "@tauri-apps/plugin-fs",
"version": "2.0.0-beta.0",
"version": "2.0.0-beta.1",
"description": "Access the file system.",

@@ -24,3 +24,3 @@ "license": "MIT or APACHE-2.0",

"dependencies": {
"@tauri-apps/api": "2.0.0-beta.0"
"@tauri-apps/api": "2.0.0-beta.2"
},

@@ -27,0 +27,0 @@ "scripts": {

@@ -7,3 +7,3 @@ ![plugin-fs](https://github.com/tauri-apps/plugins-workspace/raw/v2/plugins/fs/banner.png)

_This plugin requires a Rust version of at least **1.70**_
_This plugin requires a Rust version of at least **1.75**_

@@ -10,0 +10,0 @@ There are three general methods of installation that we can recommend.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc