fs-no-eperm-anymore
TypeScript icon, indicating that this package has built-in type declarations

5.0.0 • Public • Published

fs-no-eperm-anymore

is a Node.js module that reduces EPERM or other errors on win32 or other platforms using retry loop approach.

GitHub Actions CI

Notes

  • Original "fs" methods are wrapped into the ES2015 Promises.
  • Module exposes only the async functions. Retry approach is used and so it won't make much sense to sleep the main process just to support sync methods set.
  • You can see some details about the options parameter in the Making options more flexible issue. Default options value:
    const options = {
        items: [
            {
                platforms: ["win32"],
                errorCodes: ["EPERM"], // https://nodejs.org/api/errors.html#errors_common_system_errors
                options: {
                    retryIntervalMs: 100,
                    retryTimeoutMs: 10 * 1000,
                },
            },
        ],
    };

Code Example

    import {instantiate} from "fs-no-eperm-anymore";
    // const fs = require("fs-no-eperm-anymore").instantiate();
     
    // options parameter is optional
    const fs = instantiate(/*options*/);
    
    fs.rename("from.txt", "to.txt")
        .then(() => console.log("Successful renaming"))
        .catch((error) => console.log("Renaming failed with the error", error));    

Links

Package Sidebar

Install

npm i fs-no-eperm-anymore

Weekly Downloads

148

Version

5.0.0

License

MIT

Unpacked Size

23.4 kB

Total Files

18

Last publish

Collaborators

  • vladimiry