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

browser-fs-access

Package Overview
Dependencies
Maintainers
1
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

browser-fs-access - npm Package Compare versions

Comparing version 0.20.5 to 0.21.0

59

index.d.ts

@@ -32,2 +32,35 @@ /**

fileName?: string;
/**
* Configurable cleanup and `Promise` rejector usable with legacy API for
* determining when (and reacting if) a user cancels the operation. The
* method will be passed a reference to the internal `rejectionHandler` that
* can, e.g., be attached to/removed from the window or called after a
* timeout. The method should return a function that will be called when
* either the user chooses to open a file or the `rejectionHandler` is
* called. In the latter case, the returned function will also be passed a
* reference to the `reject` callback for the `Promise` returned by
* `fileOpen`, so that developers may reject the `Promise` when desired at
* that time.
* Example rejector:
*
* const file = await fileOpen({
* legacySetup: (rejectionHandler) => {
* const timeoutId = setTimeout(rejectionHandler, 10_000);
* return (reject) => {
* clearTimeout(timeoutId);
* if (reject) {
* reject('My error message here.');
* }
* };
* },
* });
*
* ToDo: Remove this workaround once
* https://github.com/whatwg/html/issues/6376 is specified and supported.
*/
legacySetup?: (
resolve: (value: Blob) => void,
rejectionHandler: () => void,
anchor: HTMLAnchorElement
) => (reject?: (reason?: any) => void) => void;
}

@@ -59,3 +92,3 @@

* const file = await fileOpen({
* setupLegacyCleanupAndRejection: (rejectionHandler) => {
* legacySetup: (rejectionHandler) => {
* const timeoutId = setTimeout(rejectionHandler, 10_000);

@@ -74,5 +107,9 @@ * return (reject) => {

*/
setupLegacyCleanupAndRejection?: (
rejectionHandler?: () => void
) => (reject: (reason?: any) => void) => void;
legacySetup?: (
resolve: (
value: M extends false | undefined ? FileWithHandle : FileWithHandle[]
) => void,
rejectionHandler: () => void,
input: HTMLInputElement
) => (reject?: (reason?: any) => void) => void;
}

@@ -131,4 +168,4 @@

/**
* Configurable cleanup and `Promise` rejector usable with legacy API for
* determining when (and reacting if) a user cancels the operation. The
* Configurable setup, cleanup and `Promise` rejector usable with legacy API
* for determining when (and reacting if) a user cancels the operation. The
* method will be passed a reference to the internal `rejectionHandler` that

@@ -145,3 +182,3 @@ * can, e.g., be attached to/removed from the window or called after a

* const file = await directoryOpen({
* setupLegacyCleanupAndRejection: (rejectionHandler) => {
* legacySetup: (rejectionHandler) => {
* const timeoutId = setTimeout(rejectionHandler, 10_000);

@@ -160,5 +197,7 @@ * return (reject) => {

*/
setupLegacyCleanupAndRejection?: (
rejectionHandler?: () => void
) => (reject: (reason?: any) => void) => void;
legacySetup?: (
resolve: (value: FileWithDirectoryHandle) => void,
rejectionHandler: () => void,
input: HTMLInputElement
) => (reject?: (reason?: any) => void) => void;
}): Promise<FileWithDirectoryHandle[]>;

@@ -165,0 +204,0 @@

13

package.json
{
"name": "browser-fs-access",
"version": "0.20.5",
"version": "0.21.0",
"description": "File System Access API with legacy fallback in the browser.",

@@ -11,2 +11,5 @@ "browser": "./dist/index.js",

},
"publishConfig": {
"access": "public"
},
"module": "./dist/index.js",

@@ -44,9 +47,9 @@ "type": "module",

"devDependencies": {
"eslint": "^7.32.0",
"eslint": "^8.1.0",
"eslint-config-google": "^0.14.0",
"eslint-config-prettier": "^8.3.0",
"http-server": "^13.0.2",
"prettier": "^2.4.0",
"http-server": "^14.0.0",
"prettier": "^2.4.1",
"shx": "^0.3.3",
"terser": "^5.8.0"
"terser": "^5.9.0"
},

@@ -53,0 +56,0 @@ "eslintConfig": {

@@ -169,3 +169,3 @@ # Browser-FS-Access

[`index.d.ts`](https://github.com/GoogleChromeLabs/browser-fs-access/blob/main/index.d.ts) for the
documentation of the `setupLegacyCleanupAndRejection` parameter.
documentation of the `legacySetup` parameter.

@@ -172,0 +172,0 @@ ## Browser-FS-Access in Action

Sorry, the diff of this file is not supported yet

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