README.md (7001B)
1 <!-- 2 3 @license Apache-2.0 4 5 Copyright (c) 2018 The Stdlib Authors. 6 7 Licensed under the Apache License, Version 2.0 (the "License"); 8 you may not use this file except in compliance with the License. 9 You may obtain a copy of the License at 10 11 http://www.apache.org/licenses/LICENSE-2.0 12 13 Unless required by applicable law or agreed to in writing, software 14 distributed under the License is distributed on an "AS IS" BASIS, 15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 See the License for the specific language governing permissions and 17 limitations under the License. 18 19 --> 20 21 # Filesystem 22 23 [![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] [![dependencies][dependencies-image]][dependencies-url] 24 25 > Standard library for interfacing with a filesystem. 26 27 <section class="installation"> 28 29 ## Installation 30 31 ```bash 32 npm install @stdlib/fs 33 ``` 34 35 </section> 36 37 <section class="usage"> 38 39 ## Usage 40 41 ```javascript 42 var fs = require( '@stdlib/fs' ); 43 ``` 44 45 #### fs 46 47 Standard library for interfacing with a filesystem. 48 49 ```javascript 50 var f = fs; 51 // returns {...} 52 ``` 53 54 <!-- <toc pattern="*"> --> 55 56 <div class="namespace-toc"> 57 58 - <span class="signature">[`close( fd, clbk )`][@stdlib/fs/close]</span><span class="delimiter">: </span><span class="description">close a file descriptor.</span> 59 - <span class="signature">[`exists( path, clbk )`][@stdlib/fs/exists]</span><span class="delimiter">: </span><span class="description">test whether a path exists on the filesystem.</span> 60 - <span class="signature">[`open( path[, flags[, mode]], clbk )`][@stdlib/fs/open]</span><span class="delimiter">: </span><span class="description">open a file.</span> 61 - <span class="signature">[`readDir( path, clbk )`][@stdlib/fs/read-dir]</span><span class="delimiter">: </span><span class="description">read the contents of a directory.</span> 62 - <span class="signature">[`readFileList( filepaths[, options], clbk )`][@stdlib/fs/read-file-list]</span><span class="delimiter">: </span><span class="description">read the entire contents of each file in a file list.</span> 63 - <span class="signature">[`readFile( file[, options], clbk )`][@stdlib/fs/read-file]</span><span class="delimiter">: </span><span class="description">read the entire contents of a file.</span> 64 - <span class="signature">[`readJSON( file[, options], clbk )`][@stdlib/fs/read-json]</span><span class="delimiter">: </span><span class="description">read a file as JSON.</span> 65 - <span class="signature">[`readWASM( file[, options], clbk )`][@stdlib/fs/read-wasm]</span><span class="delimiter">: </span><span class="description">read a file as WebAssembly.</span> 66 - <span class="signature">[`rename( oldPath, newPath, clbk )`][@stdlib/fs/rename]</span><span class="delimiter">: </span><span class="description">rename a file.</span> 67 - <span class="signature">[`resolveParentPathBy( path[, options], predicate, clbk )`][@stdlib/fs/resolve-parent-path-by]</span><span class="delimiter">: </span><span class="description">resolve a path according to a predicate function by walking parent directories.</span> 68 - <span class="signature">[`resolveParentPath( path[, options], clbk )`][@stdlib/fs/resolve-parent-path]</span><span class="delimiter">: </span><span class="description">resolve a path by walking parent directories.</span> 69 - <span class="signature">[`unlink( path, clbk )`][@stdlib/fs/unlink]</span><span class="delimiter">: </span><span class="description">remove a directory entry.</span> 70 - <span class="signature">[`writeFile( file, data[, options], clbk )`][@stdlib/fs/write-file]</span><span class="delimiter">: </span><span class="description">write data to a file.</span> 71 72 </div> 73 74 <!-- </toc> --> 75 76 </section> 77 78 <!-- /.usage --> 79 80 <section class="examples"> 81 82 ## Examples 83 84 <!-- TODO: better examples --> 85 86 <!-- eslint no-undef: "error" --> 87 88 ```javascript 89 var objectKeys = require( '@stdlib/utils/keys' ); 90 var fs = require( '@stdlib/fs' ); 91 92 console.log( objectKeys( fs ) ); 93 ``` 94 95 </section> 96 97 <!-- /.examples --> 98 99 100 <section class="main-repo" > 101 102 * * * 103 104 ## Notice 105 106 This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. 107 108 For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. 109 110 #### Community 111 112 [![Chat][chat-image]][chat-url] 113 114 --- 115 116 ## License 117 118 See [LICENSE][stdlib-license]. 119 120 121 ## Copyright 122 123 Copyright © 2016-2021. The Stdlib [Authors][stdlib-authors]. 124 125 </section> 126 127 <!-- /.stdlib --> 128 129 <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> 130 131 <section class="links"> 132 133 [npm-image]: http://img.shields.io/npm/v/@stdlib/fs.svg 134 [npm-url]: https://npmjs.org/package/@stdlib/fs 135 136 [test-image]: https://github.com/stdlib-js/fs/actions/workflows/test.yml/badge.svg 137 [test-url]: https://github.com/stdlib-js/fs/actions/workflows/test.yml 138 139 [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/fs/main.svg 140 [coverage-url]: https://codecov.io/github/stdlib-js/fs?branch=main 141 142 [dependencies-image]: https://img.shields.io/david/stdlib-js/fs.svg 143 [dependencies-url]: https://david-dm.org/stdlib-js/fs/main 144 145 [chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg 146 [chat-url]: https://gitter.im/stdlib-js/stdlib/ 147 148 [stdlib]: https://github.com/stdlib-js/stdlib 149 150 [stdlib-authors]: https://github.com/stdlib-js/stdlib/graphs/contributors 151 152 [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/fs/main/LICENSE 153 154 <!-- <toc-links> --> 155 156 [@stdlib/fs/close]: https://www.npmjs.com/package/@stdlib/fs/tree/main/close 157 158 [@stdlib/fs/exists]: https://www.npmjs.com/package/@stdlib/fs/tree/main/exists 159 160 [@stdlib/fs/open]: https://www.npmjs.com/package/@stdlib/fs/tree/main/open 161 162 [@stdlib/fs/read-dir]: https://www.npmjs.com/package/@stdlib/fs/tree/main/read-dir 163 164 [@stdlib/fs/read-file-list]: https://www.npmjs.com/package/@stdlib/fs/tree/main/read-file-list 165 166 [@stdlib/fs/read-file]: https://www.npmjs.com/package/@stdlib/fs/tree/main/read-file 167 168 [@stdlib/fs/read-json]: https://www.npmjs.com/package/@stdlib/fs/tree/main/read-json 169 170 [@stdlib/fs/read-wasm]: https://www.npmjs.com/package/@stdlib/fs/tree/main/read-wasm 171 172 [@stdlib/fs/rename]: https://www.npmjs.com/package/@stdlib/fs/tree/main/rename 173 174 [@stdlib/fs/resolve-parent-path-by]: https://www.npmjs.com/package/@stdlib/fs/tree/main/resolve-parent-path-by 175 176 [@stdlib/fs/resolve-parent-path]: https://www.npmjs.com/package/@stdlib/fs/tree/main/resolve-parent-path 177 178 [@stdlib/fs/unlink]: https://www.npmjs.com/package/@stdlib/fs/tree/main/unlink 179 180 [@stdlib/fs/write-file]: https://www.npmjs.com/package/@stdlib/fs/tree/main/write-file 181 182 <!-- </toc-links> --> 183 184 </section> 185 186 <!-- /.links -->