https://github.com/binded/kitchenfile
Small utility for dealing with files inside tests (not for use in production)
https://github.com/binded/kitchenfile
Last synced: 6 months ago
JSON representation
Small utility for dealing with files inside tests (not for use in production)
- Host: GitHub
- URL: https://github.com/binded/kitchenfile
- Owner: binded
- License: mit
- Created: 2016-09-20T08:04:20.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-10-27T00:45:14.000Z (over 9 years ago)
- Last Synced: 2025-02-22T12:48:37.067Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 5.86 KB
- Stars: 0
- Watchers: 9
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# kitchenfile
[](https://travis-ci.org/blockai/kitchenfile)
Small utility for dealing with files in tests. Only use in tests!
```javascript
import kitchenfile from 'kitchenfile'
const file = kitchenfile(`${__dirname}/files`)
// or: const file = kitchenfile(__dirname, files)
// Calls to file() are memoized!
file('image.jpg').rs() // returns a readable stream
file('image.jpg').buf // returns a buffer
file('image.jpg').path // path to image.jpg
file('image.jpg').contentType // content type based on file ext (e.g. image/jpg)
file('image.jpg').size // file size in bytes
file('image.jpg').filename // => image.jpg
```
## Install
```bash
npm install --save-dev kitchenfile
```
Requires Node v6+
## Usage
See [./test](./test) directory for usage examples.