@tauri-apps/plugin-fs
Advanced tools
Comparing version 2.0.0-alpha.2 to 2.0.0-alpha.3
@@ -1,7 +0,42 @@ | ||
var f$1=Object.defineProperty;var g$1=(a,b)=>{for(var c in b)f$1(a,c,{get:b[c],enumerable:!0});};var e=(a,b,c)=>{if(!b.has(a))throw TypeError("Cannot "+c)};var h$1=(a,b,c)=>(e(a,b,"read from private field"),c?c.call(a):b.get(a)),i$1=(a,b,c)=>{if(b.has(a))throw TypeError("Cannot add the same private member more than once");b instanceof WeakSet?b.add(a):b.set(a,c);},j$1=(a,b,c,d)=>(e(a,b,"write to private field"),d?d.call(a,c):b.set(a,c),c); | ||
/****************************************************************************** | ||
Copyright (c) Microsoft Corporation. | ||
var T$1={};g$1(T$1,{Channel:()=>i,PluginListener:()=>o,addPluginListener:()=>l$1,convertFileSrc:()=>v$1,invoke:()=>u$1,transformCallback:()=>_$1});function _$1(e,n=!1){return window.__TAURI_INTERNALS__.transformCallback(e,n)}var r,i=class{constructor(){this.__TAURI_CHANNEL_MARKER__=!0;i$1(this,r,()=>{});this.id=_$1(n=>{h$1(this,r).call(this,n);});}set onmessage(n){j$1(this,r,n);}get onmessage(){return h$1(this,r)}toJSON(){return `__CHANNEL__:${this.id}`}};r=new WeakMap;var o=class{constructor(n,s,t){this.plugin=n,this.event=s,this.channelId=t;}async unregister(){return u$1(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}};async function l$1(e,n,s){let t=new i;return t.onmessage=s,u$1(`plugin:${e}|register_listener`,{event:n,handler:t}).then(()=>new o(e,n,t.id))}async function u$1(e,n={},s){return window.__TAURI_INTERNALS__.invoke(e,n,s)}function v$1(e,n="asset"){return window.__TAURI_INTERNALS__.convertFileSrc(e,n)} | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted. | ||
var U={};g$1(U,{BaseDirectory:()=>t,appCacheDir:()=>p,appConfigDir:()=>s,appDataDir:()=>u,appLocalDataDir:()=>c,appLogDir:()=>w,audioDir:()=>a,basename:()=>H,cacheDir:()=>l,configDir:()=>g,dataDir:()=>d,delimiter:()=>E,desktopDir:()=>m,dirname:()=>z,documentDir:()=>y,downloadDir:()=>h,executableDir:()=>f,extname:()=>F,fontDir:()=>P,homeDir:()=>_,isAbsolute:()=>S,join:()=>j,localDataDir:()=>v,normalize:()=>N,pictureDir:()=>A,publicDir:()=>D,resolve:()=>I,resolveResource:()=>C,resourceDir:()=>b,runtimeDir:()=>L,sep:()=>k,tempDir:()=>x,templateDir:()=>R,videoDir:()=>T});var t=(r=>(r[r.Audio=1]="Audio",r[r.Cache=2]="Cache",r[r.Config=3]="Config",r[r.Data=4]="Data",r[r.LocalData=5]="LocalData",r[r.Document=6]="Document",r[r.Download=7]="Download",r[r.Picture=8]="Picture",r[r.Public=9]="Public",r[r.Video=10]="Video",r[r.Resource=11]="Resource",r[r.Temp=12]="Temp",r[r.AppConfig=13]="AppConfig",r[r.AppData=14]="AppData",r[r.AppLocalData=15]="AppLocalData",r[r.AppCache=16]="AppCache",r[r.AppLog=17]="AppLog",r[r.Desktop=18]="Desktop",r[r.Executable=19]="Executable",r[r.Font=20]="Font",r[r.Home=21]="Home",r[r.Runtime=22]="Runtime",r[r.Template=23]="Template",r))(t||{});async function s(){return u$1("plugin:path|resolve_directory",{directory:13})}async function u(){return u$1("plugin:path|resolve_directory",{directory:14})}async function c(){return u$1("plugin:path|resolve_directory",{directory:15})}async function p(){return u$1("plugin:path|resolve_directory",{directory:16})}async function a(){return u$1("plugin:path|resolve_directory",{directory:1})}async function l(){return u$1("plugin:path|resolve_directory",{directory:2})}async function g(){return u$1("plugin:path|resolve_directory",{directory:3})}async function d(){return u$1("plugin:path|resolve_directory",{directory:4})}async function m(){return u$1("plugin:path|resolve_directory",{directory:18})}async function y(){return u$1("plugin:path|resolve_directory",{directory:6})}async function h(){return u$1("plugin:path|resolve_directory",{directory:7})}async function f(){return u$1("plugin:path|resolve_directory",{directory:19})}async function P(){return u$1("plugin:path|resolve_directory",{directory:20})}async function _(){return u$1("plugin:path|resolve_directory",{directory:21})}async function v(){return u$1("plugin:path|resolve_directory",{directory:5})}async function A(){return u$1("plugin:path|resolve_directory",{directory:8})}async function D(){return u$1("plugin:path|resolve_directory",{directory:9})}async function b(){return u$1("plugin:path|resolve_directory",{directory:11})}async function C(i){return u$1("plugin:path|resolve_directory",{directory:11,path:i})}async function L(){return u$1("plugin:path|resolve_directory",{directory:22})}async function R(){return u$1("plugin:path|resolve_directory",{directory:23})}async function T(){return u$1("plugin:path|resolve_directory",{directory:10})}async function w(){return u$1("plugin:path|resolve_directory",{directory:17})}async function x(i){return u$1("plugin:path|resolve_directory",{directory:12})}function k(){return window.__TAURI_INTERNALS__.plugins.path.sep}function E(){return window.__TAURI_INTERNALS__.plugins.path.delimiter}async function I(...i){return u$1("plugin:path|resolve",{paths:i})}async function N(i){return u$1("plugin:path|normalize",{path:i})}async function j(...i){return u$1("plugin:path|join",{paths:i})}async function z(i){return u$1("plugin:path|dirname",{path:i})}async function F(i){return u$1("plugin:path|extname",{path:i})}async function H(i,e){return u$1("plugin:path|basename",{path:i,ext:e})}async function S(i){return u$1("plugin:path|isAbsolute",{path:i})} | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | ||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | ||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | ||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */ | ||
/* global Reflect, Promise, SuppressedError, Symbol */ | ||
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { | ||
var e = new Error(message); | ||
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; | ||
}; | ||
/** | ||
* Sends a message to the backend. | ||
* @example | ||
* ```typescript | ||
* import { invoke } from '@tauri-apps/api/primitives'; | ||
* await invoke('login', { user: 'tauri', password: 'poiwe3h4r5ip3yrhtew9ty' }); | ||
* ``` | ||
* | ||
* @param cmd The command name. | ||
* @param args The optional arguments to pass to the command. | ||
* @param options The request options. | ||
* @return A promise resolving or rejecting to the backend response. | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
async function invoke(cmd, args = {}, options) { | ||
return window.__TAURI_INTERNALS__.invoke(cmd, args, options); | ||
} | ||
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy | ||
@@ -11,2 +46,43 @@ // SPDX-License-Identifier: Apache-2.0 | ||
/** | ||
* The path module provides utilities for working with file and directory paths. | ||
* | ||
* This package is also accessible with `window.__TAURI__.path` when [`build.withGlobalTauri`](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri) in `tauri.conf.json` is set to `true`. | ||
* | ||
* It is recommended to allowlist only the APIs you use for optimal bundle size and security. | ||
* @module | ||
*/ | ||
/** | ||
* @since 2.0.0 | ||
*/ | ||
var BaseDirectory; | ||
(function (BaseDirectory) { | ||
BaseDirectory[BaseDirectory["Audio"] = 1] = "Audio"; | ||
BaseDirectory[BaseDirectory["Cache"] = 2] = "Cache"; | ||
BaseDirectory[BaseDirectory["Config"] = 3] = "Config"; | ||
BaseDirectory[BaseDirectory["Data"] = 4] = "Data"; | ||
BaseDirectory[BaseDirectory["LocalData"] = 5] = "LocalData"; | ||
BaseDirectory[BaseDirectory["Document"] = 6] = "Document"; | ||
BaseDirectory[BaseDirectory["Download"] = 7] = "Download"; | ||
BaseDirectory[BaseDirectory["Picture"] = 8] = "Picture"; | ||
BaseDirectory[BaseDirectory["Public"] = 9] = "Public"; | ||
BaseDirectory[BaseDirectory["Video"] = 10] = "Video"; | ||
BaseDirectory[BaseDirectory["Resource"] = 11] = "Resource"; | ||
BaseDirectory[BaseDirectory["Temp"] = 12] = "Temp"; | ||
BaseDirectory[BaseDirectory["AppConfig"] = 13] = "AppConfig"; | ||
BaseDirectory[BaseDirectory["AppData"] = 14] = "AppData"; | ||
BaseDirectory[BaseDirectory["AppLocalData"] = 15] = "AppLocalData"; | ||
BaseDirectory[BaseDirectory["AppCache"] = 16] = "AppCache"; | ||
BaseDirectory[BaseDirectory["AppLog"] = 17] = "AppLog"; | ||
BaseDirectory[BaseDirectory["Desktop"] = 18] = "Desktop"; | ||
BaseDirectory[BaseDirectory["Executable"] = 19] = "Executable"; | ||
BaseDirectory[BaseDirectory["Font"] = 20] = "Font"; | ||
BaseDirectory[BaseDirectory["Home"] = 21] = "Home"; | ||
BaseDirectory[BaseDirectory["Runtime"] = 22] = "Runtime"; | ||
BaseDirectory[BaseDirectory["Template"] = 23] = "Template"; | ||
})(BaseDirectory || (BaseDirectory = {})); | ||
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// SPDX-License-Identifier: MIT | ||
/** | ||
* Access the file system. | ||
@@ -65,3 +141,3 @@ * | ||
async function readTextFile(filePath, options = {}) { | ||
return await u$1("plugin:fs|read_text_file", { | ||
return await invoke("plugin:fs|read_text_file", { | ||
path: filePath, | ||
@@ -83,3 +159,3 @@ options, | ||
async function readBinaryFile(filePath, options = {}) { | ||
const arr = await u$1("plugin:fs|read_file", { | ||
const arr = await invoke("plugin:fs|read_file", { | ||
path: filePath, | ||
@@ -119,3 +195,3 @@ options, | ||
} | ||
return await u$1("plugin:fs|write_file", { | ||
return await invoke("plugin:fs|write_file", { | ||
path: file.path, | ||
@@ -156,3 +232,3 @@ contents: Array.from(new TextEncoder().encode(file.contents)), | ||
} | ||
return await u$1("plugin:fs|write_file", { | ||
return await invoke("plugin:fs|write_file", { | ||
path: file.path, | ||
@@ -186,3 +262,3 @@ contents: Array.from(file.contents instanceof ArrayBuffer | ||
async function readDir(dir, options = {}) { | ||
return await u$1("plugin:fs|read_dir", { | ||
return await invoke("plugin:fs|read_dir", { | ||
path: dir, | ||
@@ -208,3 +284,3 @@ options, | ||
async function createDir(dir, options = {}) { | ||
return await u$1("plugin:fs|create_dir", { | ||
return await invoke("plugin:fs|create_dir", { | ||
path: dir, | ||
@@ -229,3 +305,3 @@ options, | ||
async function removeDir(dir, options = {}) { | ||
return await u$1("plugin:fs|remove_dir", { | ||
return await invoke("plugin:fs|remove_dir", { | ||
path: dir, | ||
@@ -249,3 +325,3 @@ options, | ||
async function copyFile(source, destination, options = {}) { | ||
return await u$1("plugin:fs|copy_file", { | ||
return await invoke("plugin:fs|copy_file", { | ||
source, | ||
@@ -270,3 +346,3 @@ destination, | ||
async function removeFile(file, options = {}) { | ||
return await u$1("plugin:fs|remove_file", { | ||
return await invoke("plugin:fs|remove_file", { | ||
path: file, | ||
@@ -290,3 +366,3 @@ options, | ||
async function renameFile(oldPath, newPath, options = {}) { | ||
return await u$1("plugin:fs|rename_file", { | ||
return await invoke("plugin:fs|rename_file", { | ||
oldPath, | ||
@@ -309,3 +385,3 @@ newPath, | ||
async function exists(path) { | ||
return await u$1("plugin:fs|exists", { path }); | ||
return await invoke("plugin:fs|exists", { path }); | ||
} | ||
@@ -318,3 +394,3 @@ /** | ||
async function metadata(path) { | ||
return await u$1("plugin:fs|metadata", { | ||
return await invoke("plugin:fs|metadata", { | ||
path, | ||
@@ -332,3 +408,3 @@ }).then((metadata) => { | ||
export { t as BaseDirectory, t as Dir, copyFile, createDir, exists, metadata, readBinaryFile, readDir, readTextFile, removeDir, removeFile, renameFile, writeBinaryFile, writeTextFile as writeFile, writeTextFile }; | ||
export { BaseDirectory, BaseDirectory as Dir, copyFile, createDir, exists, metadata, readBinaryFile, readDir, readTextFile, removeDir, removeFile, renameFile, writeBinaryFile, writeTextFile as writeFile, writeTextFile }; | ||
//# sourceMappingURL=index.min.js.map |
{ | ||
"name": "@tauri-apps/plugin-fs", | ||
"version": "2.0.0-alpha.2", | ||
"version": "2.0.0-alpha.3", | ||
"description": "Access the file system.", | ||
@@ -28,3 +28,3 @@ "license": "MIT or APACHE-2.0", | ||
"dependencies": { | ||
"@tauri-apps/api": "2.0.0-alpha.9" | ||
"@tauri-apps/api": "2.0.0-alpha.11" | ||
}, | ||
@@ -31,0 +31,0 @@ "scripts": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1074
39902
1
+ Added@tauri-apps/api@2.0.0-alpha.11(transitive)
- Removed@tauri-apps/api@2.0.0-alpha.9(transitive)