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

nano-fs

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nano-fs

Extended file system library

  • 1.2.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Gitter NPM version Build status Test coverage Dependency Status License Downloads

nano-fs

Extended native file system library adopted for Promise object.

Native functions

See https://nodejs.org/dist/latest-v5.x/docs/api/fs.html. All callback functions returns Promise object instead of call callback function.

Additional functions

listFiles(path[, regexp])

Resolve Promise object with Array of all files pathes filtered by optional RegExp.

var fs = require('nano-fs');
fs.listFiles('./source').then(function (list) {
	console.log(list);
});

Prints something like

[ "tet.jk", "a/file.txt", "a/fileaa" ]

writeTree(path, object)

Write objects tree to file system tree.

fs.writeTree('./test', {
	folder_a: {
		'file_a.txt': 'content',
		'file_b.txt': 'content'
	},
	folder_b: {
	},
	'file_c.txt': 'content'
});

readTree(path)

Resolve a Promise with objects tree where folders will be objects contains files as strings.

fs.readTree(path).then(function (o) {
	console.log(o);
});

mkpath(path[, mode])

copy(source_file_name, destination_file_name)

Copy file to another location. If destination path does not exists it will be created by mkpath() call.

remove(path)

Recursively remove folder. It can remove file too.

empty(folder_path)

Empty folder. Try it! :)

Keywords

FAQs

Package last updated on 26 Sep 2018

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc