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

base-fs-conflicts

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

base-fs-conflicts

Detect potential file system conflicts and if necessary prompt the user before overwriting files.

  • 0.1.9
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.2K
increased by2.62%
Maintainers
1
Weekly downloads
 
Created
Source

base-fs-conflicts NPM version NPM downloads Build Status

Detect potential file system conflicts and if necessary prompt the user before overwriting files.

Install

Install with npm:

$ npm install --save base-fs-conflicts

Attribution

Some of the logic in this plugin, in particular lib/diffs.js, is based on the conflicter code in yeoman-generator, Copyright (c) 2015, Google, licensed under BSD-2-Clause.

Usage

The following code should work with any base application, including verb, assemble, and generate.

var path = require('path');
var Base = require('base');
var fs = require('base-fs');
var conflicts = require('base-fs-conflicts');
var base = new Base();

// register the `conflicts` and `fs` plugins
base.use(conflicts());
base.use(fs());

// pass the same `dest` to both `.dest()` and `.conflicts()`
var dest = 'fixtures/dist';

base.src('fixtures/*.txt')
  .pipe(base.conflicts(dest)) // adds a `.conflicts()` method
  .pipe(base.dest(dest));

Example

If a file conflict is detected, you'll see something like this in the terminal:

screen shot 2016-03-17 at 8 05 53 pm

API

  1. The existing file's contents is compared with file.contents on the vinyl file
  2. If the contents of both are identical, no action is taken
  3. If the contents differ, the user is prompted for action
  4. If no conflicting file exists, the vinyl file is written to the file system

Params

  • dest {String}: The same desination directory passed to app.dest()
  • returns {String}

Example

app.src('foo/*.js')
  .pipe(app.conflicts('foo'))
  .pipe(app.dest('foo'));

You might also be interested in these projects:

  • assemble: Get the rocks out of your socks! Assemble makes you fast at creating web projects… more | homepage
  • generate: Command line tool and developer framework for scaffolding out new GitHub projects. Generate offers the… more | homepage
  • templates: System for creating and managing template collections, and rendering templates with any node.js template engine… more | homepage
  • verb: Documentation generator for GitHub projects. Verb is extremely powerful, easy to use, and is used… more | homepage

Contributing

This document was generated by verb-readme-generator (a verb generator), please don't edit directly. Any changes to the readme must be made in .verb.md. See Building Docs.

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue. Or visit the verb-readme-generator project to submit bug reports or pull requests for the readme layout template.

Building docs

Generate readme and API documentation with verb:

$ npm install -g verb verb-readme-generator && verb

Running tests

Install dev dependencies:

$ npm install -d && npm test

Author

Jon Schlinkert

License

Copyright © 2016, Jon Schlinkert. Released under the MIT license.


This file was generated by verb, v0.9.0, on July 26, 2016.

Keywords

FAQs

Package last updated on 18 Aug 2016

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