file
Higher level path and file manipulation functions.
Last updated 11 years ago by aconbere .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ gnpm install file 
SYNC missed versions from official npm registry.

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)

Synchronus version of file.walk, calling callback for each directory, passing in (dirPath, dirs, files).

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.relativePath(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"

Current Tags

  • 0.2.2                                ...           latest (11 years ago)

4 Versions

  • 0.2.2                                ...           11 years ago
  • 0.2.1                                ...           13 years ago
  • 0.1.1                                ...           13 years ago
  • 0.2.0                                ...           13 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (1)
Dependents (3)

Copyright 2013 - present © cnpmjs.org | Home |