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

file

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

file

Higher level path and file manipulation functions.

  • 0.2.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
48K
decreased by-56.47%
Maintainers
1
Weekly downloads
 
Created
Source

File - Common higher level file and path operations

Install

  npm install file
  var file = require("file");

API

file.walk(start, callback)

Navigates a file tree, calling callback for each directory, passing in (null, dirPath, dirs, files).

file.walkSync(start, callback)

Like file.walk but synchronous.

file.mkdirs(path, mode, callback)

Makes all the directories in a path. (analgous to mkdir -P) For example given a path like "test/this/path" in an empty directory, mkdirs would make the directories "test", "this" and "path".

file.mkdirsSync(path, mode)

Like file.mkdirs but synchronous.

file.path.abspath(path)

Expands ".", "..", "~" and non root paths to their full absolute path. Relative paths default to being children of the current working directory.

file.path.relpath(root, fullPath)

Given a root path, and a fullPath attempts to diff between the two to give us an acurate path relative to root.

file.path.join(head, tail)

Just like path.join but haves a little more sanely when give a head equal to "". file.path.join("", "tail") returns "tail", path.join("", "tail") returns "/tail"

FAQs

Package last updated on 25 Apr 2012

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