Giter Club home page Giter Club logo

fso's Introduction

npm npm license npm download total npm download by month dependencies Status devDependencies Status

Travis Build Status AppVeyor Build Status codecov.io Code Climate Codacy Badge Greenkeeper badge

fso - FileSystemObject is a objective fs interface like Pathname(ruby).

Installation

npm install fso

Usage

node.js:

var fso = require('fso').default;
var FileSystemObject = require('fso').FileSystemObject;

ES2015:

import fso, {FileSystemObject} from 'fso';

API

API Documents (with type annotations)

objective methods

constructor

var abc = new FileSystemObject("a", "b", "c");
abc.toString() === "a/b/c"

new / join

dir = fso.new('dir');
a = dir.new('a.txt');
a.writeFileSync('aaaaaa');

parent

dir = fso.new('dir');
p = dir.parent();
dir = p.new('dir');

children, childrenSync

dir = fso.new('dir');
files = dir.childrenSync();

childrenAll, childrenAllSync

dir = fso.new('dir');
files = dir.childrenAllSync();

filteredChildren, filteredChildrenSync, filteredChildrenAll, filteredChildrenAllSync

excepts = ["ignore_file", "path/to/ignore_directory"];
entries = target.filteredChildrenAllSync(excepts);
// Sync
excepts = (entry) => entry.isDirectorySync();
files = target.filteredChildrenAllSync(excepts); // childrenSync() minus directories
// Promise form condition also OK when Promise form call
excepts = (entry) => entry.isDirectory();
files = await target.filteredChildrenAll(excepts);
// callback form also OK when callback form call
excepts = (entry, callback) =>
  entry.isDirectory(
    (error, isDirectory) => callback(error, isDirectory)
  );
target.filteredChildrenAll(excepts, (error, files) => console.log(files.toString()));

path

path / toString

fooPath = fso.new('foo').path;
fooPath = fso.new('foo').toString();

'fs' API

Supports all the node.js 'fs' APIs that needs no first path argument.

method(...args, callback), methodSync(...args) and promise = method(...args)

one file args

fs.truncateSync('/path/to/file', 0);
// is
file = fso.new('/path/to/file');
file.truncateSync(0);

two file args

fs.rename('/path/to/file', 'newfile', callback);
// is
file = fso.new('/path/to/file');
file.remane('newfile', callback);

fd args

fd = fs.openSync('/path/to/file');
fs.ftruncateSync(fd, 0);
fs.close(fd);
// is
file = fso.new('/path/to/file');
file.openSync();
file.ftruncateSync(0);
file.close();

convenient additional

mkdirAll

fso.new('long/deep/path/to').mkdirAll().then(...);

mkdirp (= mkdirAll)

mkpath (= mkdirAll)

readdirAll

dir.readdirAllSync()
// results
['a.txt', 'aa', 'aa/a.txt', 'aa/b', 'aa/b/c.txt']

rmAll

await dir.rmAll('junk');

rmtree (= rmAll)

mergeDirectory

target.mergeDirectory(source);

copy:

target.rmAllSync();
target.mergeDirectorySync(source);

filteredMergeDirectory

excepts = ["ignore_file", "path/to/ignore_directory"];
target.filteredMergeDirectorySync(source, excepts);
excepts = (entry) => entry.path === "ignore_file" || entry.path === "path/to/ignore_directory";
target.filteredMergeDirectorySync(source, excepts);

isChildOf

dir.new("foo/bar").isChildOf(dir)

isParentOf

dir.isParentOf(dir.new("foo/bar"))

path methods

(property) delimiter

fso.delimiter; // ":" or ";"

(property) sep

fso.sep; // "/" or "\\"

(static) format

var entry = FileSystemObject.format({...});

parse

var parsedObject = fso.new("a").parse();

normalize

fso.new("a").normalize(); // same as fso.new("a")

basename

fso.new("a/b/c").basename(); // same as new FileSystemObject("c")

dirname

same as parent()

extname

fso.new("a/b/c.txt").extname(); // ".txt"

isAbsolute

fso.new("a/b/c.txt").isAbsolute() === true

relative

fso.new("a/b/c").relative(fso.new("a/d")); // same as new FileSystemObject("../d")
fso.new("/a/b/c").relative("/a/d"); // same as new FileSystemObject("../d")

resolve

fso.new("a/b/c").resolve("/") // same as new FileSystemObject("/a/b/c")

License

This is released under Zlib License.

fso's People

Contributors

codacy-badger avatar dependabot-preview[bot] avatar greenkeeper[bot] avatar narazaka avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

ze6

fso's Issues

An in-range update of @types/node is breaking the build 🚨

The devDependency @types/node was updated from 10.12.8 to 10.12.9.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@types/node is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).
  • continuous-integration/appveyor/branch: AppVeyor build succeeded (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of power-assert is breaking the build 🚨

Version 1.6.1 of power-assert was just published.

Branch Build failing 🚨
Dependency power-assert
Current Version 1.6.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

power-assert is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/appveyor/branch: AppVeyor build succeeded (Details).
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Commits

The new version differs by 8 commits.

  • e549955 1.6.1
  • 63043bc docs: add CHANGELOG for 1.6.1
  • 389e525 chore(travis): drop Node9 from CI
  • 8bd962e chore: update package-lock.json
  • 04ff9fd chore: update empower to ^1.3.1
  • 76af2b7 chore: avoid concatenating undefined
  • 170892e chore: fix failing tests due to the change in assertion message since Node v10.7.0
  • 9455634 test: Object Rest/Spread in assertion expression

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of @types/node is breaking the build 🚨

Version 10.5.0 of @types/node was just published.

Branch Build failing 🚨
Dependency @types/node
Current Version 10.3.6
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

@types/node is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/appveyor/branch AppVeyor build succeeded Details
  • continuous-integration/travis-ci/push The Travis CI build could not complete due to an error Details

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of sinon is breaking the build 🚨

The devDependency sinon was updated from 7.3.1 to 7.3.2.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

sinon is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/appveyor/branch: AppVeyor build failed (Details).
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Commits

The new version differs by 6 commits.

  • 15a9d65 Update docs/changelog.md and set new release id in docs/_config.yml
  • 5d770e0 Add release documentation for v7.3.2
  • 585a1e9 7.3.2
  • b51901d Update CHANGELOG.md and AUTHORS for new release
  • 83861a7 Update Lolex to bring in fix for sinonjs/lolex#232
  • 2430fd9 Documentation (#2004)

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of typedoc is breaking the build 🚨

The devDependency typedoc was updated from 0.15.0 to 0.15.1.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

typedoc is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/appveyor/branch: AppVeyor build failed (Details).

Commits

The new version differs by 21 commits.

  • 87099f8 Bump version
  • ad488ef Back to official release of themes
  • 5704bf5 Keep tests passing
  • 0a61a00 Add type predicate converter
  • 1f01579 Upgrade nyc to beta
  • 3157e05 Upgrade the rest of the dependencies for good measure
  • 1ab03e6 Rebuild function specs.
  • d8666a0 Upgrade to typescript-3.7; add test for assertion functions.
  • c67dabc Fix tests
  • 5355abc Escape text in wbr
  • cc4cef1 Support linking to module.d.ts (#1117)
  • 37bfc1d Ignore tarball, which is the result of running npm pack
  • 352d622 Typo
  • b74f5bb fix: also correct typo in test assertion
  • f8cbb6e refactor: use const instead of let where possible

There are 21 commits in total.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of mocha is breaking the build 🚨

The devDependency mocha was updated from 6.0.1 to 6.0.2.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

mocha is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/appveyor/branch: AppVeyor build failed (Details).
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Release Notes for v6.0.2

6.0.2 / 2019-02-25

🐛 Fixes

Two more regressions fixed:

  • #3768: Test file paths no longer dropped from mocha.opts (@boneskull)
  • #3767: --require does not break on module names that look like certain node flags (@boneskull)
Commits

The new version differs by 6 commits.

  • 00a895f Release v6.0.2
  • 1edce76 update CHANGELOG for v6.0.2 [ci skip]
  • 347e9db fix broken positional arguments in config; ensure positional args are unique; closes #3763
  • 9e31e9d fix handling of bareword args matching node flags; closes #3761
  • 6535965 Update "karma-browserify" to eliminate Karma middleware warning (#3762)
  • 37febb6 improve issue template. (#3411)

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of eslint is breaking the build 🚨

The devDependency eslint was updated from 5.15.3 to 5.16.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

eslint is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/appveyor/branch: AppVeyor build failed (Details).
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Release Notes for v5.16.0
  • dfef227 Build: gensite passes rulesMeta to formatter rendering (#11567) (Kevin Partington)
  • c06d38c Fix: Allow HTML formatter to handle no meta data (#11566) (Ilya Volodin)
  • 87a5c03 Docs: func-style: clarify when allowArrowFunctions is used (#11548) (Oliver Joseph Ash)
  • bc3e427 Update: pass rule meta to formatters RFC 10 (#11551) (Chris Meyer)
  • b452f27 Chore: Update README to pull in reviewer data (#11506) (Nicholas C. Zakas)
  • afe3d25 Upgrade: Bump js-yaml dependency to fix Denial of Service vulnerability (#11550) (Vernon de Goede)
  • 4fe7eb7 Chore: use nyc instead of istanbul (#11532) (Toru Nagashima)
  • f16af43 Chore: fix formatters/table test (#11534) (Toru Nagashima)
  • 78358a8 Docs: fix duplicate punctuation in CLI docs (#11528) (Teddy Katz)
Commits

The new version differs by 11 commits.

  • ded2f94 5.16.0
  • ea36e13 Build: changelog update for 5.16.0
  • dfef227 Build: gensite passes rulesMeta to formatter rendering (#11567)
  • c06d38c Fix: Allow HTML formatter to handle no meta data (#11566)
  • 87a5c03 Docs: func-style: clarify when allowArrowFunctions is used (#11548)
  • bc3e427 Update: pass rule meta to formatters RFC 10 (#11551)
  • b452f27 Chore: Update README to pull in reviewer data (#11506)
  • afe3d25 Upgrade: Bump js-yaml dependency to fix Denial of Service vulnerability (#11550)
  • 4fe7eb7 Chore: use nyc instead of istanbul (#11532)
  • f16af43 Chore: fix formatters/table test (#11534)
  • 78358a8 Docs: fix duplicate punctuation in CLI docs (#11528)

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of @types/node is breaking the build 🚨

The devDependency @types/node was updated from 10.11.0 to 10.11.1.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@types/node is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/appveyor/branch: AppVeyor build failed (Details).
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of sinon is breaking the build 🚨

☝️ Greenkeeper’s updated Terms of Service will come into effect on April 6th, 2018.

Version 4.4.7 of sinon was just published.

Branch Build failing 🚨
Dependency sinon
Current Version 4.4.6
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

sinon is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/appveyor/branch AppVeyor build failed Details
  • continuous-integration/travis-ci/push The Travis CI build could not complete due to an error Details

Commits

The new version differs by 7 commits.

  • e060fe9 Update docs/changelog.md and set new release id in docs/_config.yml
  • e9fce06 Add release documentation for v4.4.7
  • f047838 4.4.7
  • cc91fe6 Update History.md and AUTHORS for new release
  • 9fb8577 Emojify the support message :heart:
  • a87ef85 Use existing mini-lib for coloring
  • 1f33fe5 Reduce noisy NPM output from postinstall script

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of @types/node is breaking the build 🚨

The devDependency @types/node was updated from 11.12.0 to 11.12.1.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@types/node is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/appveyor/branch: AppVeyor build failed (Details).
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Version 10 of node.js has been released

Version 10 of Node.js (code name Dubnium) has been released! 🎊

To see what happens to your code in Node.js 10, Greenkeeper has created a branch with the following changes:

  • Added the new Node.js version to your .travis.yml

If you’re interested in upgrading this repo to Node.js 10, you can open a PR with these changes. Please note that this issue is just intended as a friendly reminder and the PR as a possible starting point for getting your code running on Node.js 10.

More information on this issue

Greenkeeper has checked the engines key in any package.json file, the .nvmrc file, and the .travis.yml file, if present.

  • engines was only updated if it defined a single version, not a range.
  • .nvmrc was updated to Node.js 10
  • .travis.yml was only changed if there was a root-level node_js that didn’t already include Node.js 10, such as node or lts/*. In this case, the new version was appended to the list. We didn’t touch job or matrix configurations because these tend to be quite specific and complex, and it’s difficult to infer what the intentions were.

For many simpler .travis.yml configurations, this PR should suffice as-is, but depending on what you’re doing it may require additional work or may not be applicable at all. We’re also aware that you may have good reasons to not update to Node.js 10, which is why this was sent as an issue and not a pull request. Feel free to delete it without comment, I’m a humble robot and won’t feel rejected 🤖


FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.