git-off

git off handles large files in git repos
git clone https://noulin.net/git/git-off.git
Log | Files | Refs | README

README.md (2721B)


      1 [![Build Status](https://travis-ci.org/kaelzhang/node-fs-sync.png?branch=master)](https://travis-ci.org/kaelzhang/node-fs-sync)
      2 
      3 # fs-sync
      4 
      5 > Synchronous fs with more fun
      6 
      7 ## Getting Started
      8 This module is created for the favor of use of `fs.xxxSync`.
      9 
     10 Once `fs-sync` is installed, you can use:
     11 
     12 ```js
     13 var fs = require('fs-sync');
     14 
     15 if(fs.exists('package.json')){
     16 	var pkg = fs.readJSON('package.json');
     17 }
     18 ```	
     19 	
     20 ## Methods
     21 
     22 ```js
     23 var fs = require('fs-sync');
     24 ```
     25 	
     26 ### fs.defaultEncoding
     27 Type: `String`
     28 
     29 Default value: `'utf-8'`
     30 
     31 Global default encoding
     32 
     33 ```js
     34 fs.defaultEncoding = 'utf-8'
     35 ```
     36 
     37 ### fs.copy(from, to, options)
     38 
     39 Copy a file or a whole directory to the destination. During this, necessary directories will be created.
     40 
     41 #### Syntax
     42 
     43 ```js
     44 fs.copy(file, destpath, options);
     45 fs.copy(dir, destpath, options);
     46 ```
     47 	
     48 #### file
     49 Type: `String`
     50 
     51 Path of file to be copied
     52 
     53 #### dir
     54 Type: `String`
     55 
     56 Path of directory to be copied
     57 
     58 #### options.force
     59 Type: `Boolean`
     60 
     61 Default value: `false`
     62 
     63 By default, `fs.copy` will not override existed files, set `options.force` as `true` to override.
     64 
     65 
     66 ### fs.mkdir(path)
     67 
     68 Commandline `mkdir` or `mkdir -p`
     69 
     70 
     71 ### fs.expand(patterns, options)
     72 
     73 Like `grunt.file.expand`, but the sequence of the arguments is different
     74 	
     75 
     76 ### fs.write(file, content, options)
     77 
     78 #### options
     79 Type: `Object`
     80 
     81 The same as the `options` argument of [fs.writeFile](http://nodejs.org/api/fs.html#fs_fs_writefile_filename_data_options_callback)
     82 
     83 ### fs.read(file, options)
     84 Read a file
     85 
     86 #### options
     87 Type: `Object`
     88 
     89 The same as the `options` argument of [fs.writeFile](http://nodejs.org/api/fs.html#fs_fs_readfile_filename_options_callback), except:
     90 
     91 #### options.encoding
     92 Type: `String`
     93 
     94 Default value: `fs.defaultEncoding`
     95 
     96 ### fs.readJSON(file, options)
     97 Read a file as the JSON format, if the file content fails to be parsed as JSON, an error will be thrown.
     98 
     99 ### fs.remove()
    100 
    101 Delete a file or a whole directory. It's a dangerous action, be careful.
    102 
    103 Equivalent to `rm -rf`(remove a folder and all its contents) or `rm -f`(unlink a file)
    104 
    105 #### Syntax
    106 
    107 ```js	
    108 fs.remove(file)
    109 fs.remove(dir)
    110 ```
    111 
    112 ### fs.exists(...)
    113 
    114 `arguments` will be called with `path.join`
    115 
    116 ### fs.isDir(path)
    117 
    118 ### fs.isFile(path)
    119 
    120 ### fs.isLink(path)
    121 
    122 ### fs.isPathAbsolute(path)
    123 
    124 #### Returns `Boolean`
    125 
    126 Whether the given `path` is an absolute path (starting with `'/'`)
    127 
    128 ### fs.doesPathContain(ancestor, path...)
    129 
    130 ```js
    131 if(fs.doesPathContain(ancestor, path, path2)){
    132 	console.log(path, 'and', path2, 'are inside', ancestor);
    133 }
    134 ```
    135 
    136 #### Returns `Boolean`
    137 
    138 Whether path `ancestor` contains all `path`s after
    139 
    140 #### ancestor `String`
    141 
    142 Ancestor path
    143 
    144 #### path `String`
    145 
    146 The arguments of `fs.doesPathContain` could be more than 2.
    147 
    148 
    149 
    150 
    151