https://github.com/tecfu/file_get_contents_sync
Nodejs module to get the contents of a directory or a file synchronously. Returns result as a javascript object or a flattened string. Can be run as a node module or in CLI.
https://github.com/tecfu/file_get_contents_sync
Last synced: about 1 year ago
JSON representation
Nodejs module to get the contents of a directory or a file synchronously. Returns result as a javascript object or a flattened string. Can be run as a node module or in CLI.
- Host: GitHub
- URL: https://github.com/tecfu/file_get_contents_sync
- Owner: tecfu
- Created: 2014-09-04T23:48:37.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2016-03-07T15:39:51.000Z (over 10 years ago)
- Last Synced: 2025-02-06T14:32:08.640Z (over 1 year ago)
- Language: JavaScript
- Homepage: https://www.npmjs.org/package/file_get_contents_sync
- Size: 11.7 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
file_get_contents_sync
======================
Nodejs module to get the contents of a directory or a file synchronously.
## Usages:
### Node Module
- Return the contents of all matched files as a js object:
```
require("file_get_contents_sync")("/path/to/somedir");
//{path1:"...contents...",path2:function(){}}
```
- Return the contents of all matched files as a single string:
```
require("file_get_contents_sync")("/path/to/somedir","string");
//"...contents...function(){}"
```
### Command line :
- Return the contents of all matched files as a js object:
```
$ node node_modules/file_get_contents_sync/src/main.js /path/to/js
```
- Return the contents of all matched files as a single string:
```
$ node node_modules/file_get_contents_sync/src/main.js /path/to/html string
```