Socket
Socket
Sign inDemoInstall

cute-fs

Package Overview
Dependencies
1
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    cute-fs

cute-fs is a special type of filesystem because it can write to both local and web. (currently in development, help encouraged)


Version published
Maintainers
1
Install size
11.6 kB
Created

Readme

Source

available on npmjs

cute-fs

This package solves the issue of file read/writes being confusing with vague syntax. Using the idea of URLs for local paths.

Install

npm install cute-fs

There are some basic concepts.

await url('').soft.write(''); // write never overwrites
await url('').hard.write(''); // hard creates directories along the way
await url('').soft.overwrite(''); // overwrite will overwrite
await url('').hard.overwrite(''); // hard will create the dirs along the way
await url('').soft.read(''); // it also works with web urls
await url('').hard.read(''); // hard will create an empty file + dirs if the file is not there

Examples

import url from 'cute-fs';
await url('C:\\WindowsLikePathOr\\LinuxLike\\Path.txt').soft.write('any text');
await url('path/to/file.txt').hard.overwrite(`any text`);
await url('https://raw.githubusercontent.com/planetrenox/cute-npm-init/main/index.js').soft.read();
  • soft will not create dirs along the way and will error.
  • hard will create dirs along the way if they dont exist.
  • write does not overwrite.
  • overwrite overwrites.
  • hard.read will create the dirs and an empty file if its not there.

The writing functionality for web URLs is not documented because it is still in testing. Feel free to look at the repo.

Keywords

FAQs

Last updated on 16 Apr 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc