Codebase list node-read-file / 2e80c70
lint jonschlinkert 8 years ago
11 changed file(s) with 42 addition(s) and 69 deletion(s). Raw diff Collapse all Expand all
00 # Enforce Unix newlines
11 *.* text eol=lf
2 *.css text eol=lf
3 *.html text eol=lf
4 *.js text eol=lf
5 *.json text eol=lf
6 *.less text eol=lf
7 *.md text eol=lf
8 *.yml text eol=lf
92
103 *.jpg binary
114 *.gif binary
0 The MIT License (MIT)
1
2 Copyright (c) 2014, 2015 Jon Schlinkert.
3
4 Permission is hereby granted, free of charge, to any person
5 obtaining a copy of this software and associated documentation
6 files (the "Software"), to deal in the Software without
7 restriction, including without limitation the rights to use,
8 copy, modify, merge, publish, distribute, sublicense, and/or sell
9 copies of the Software, and to permit persons to whom the
10 Software is furnished to do so, subject to the following
11 conditions:
12
13 The above copyright notice and this permission notice shall be
14 included in all copies or substantial portions of the Software.
15
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18 OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 OTHER DEALINGS IN THE SOFTWARE.
+0
-22
LICENSE-MIT less more
0 Copyright (c) 2014 Jon Schlinkert, contributors.
1
2 Permission is hereby granted, free of charge, to any person
3 obtaining a copy of this software and associated documentation
4 files (the "Software"), to deal in the Software without
5 restriction, including without limitation the rights to use,
6 copy, modify, merge, publish, distribute, sublicense, and/or sell
7 copies of the Software, and to permit persons to whom the
8 Software is furnished to do so, subject to the following
9 conditions:
10
11 The above copyright notice and this permission notice shall be
12 included in all copies or substantial portions of the Software.
13
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
16 OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
18 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
19 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21 OTHER DEALINGS IN THE SOFTWARE.
0 FILE CONTENTS!!!
+0
-1
test/fixtures/foo.md less more
0 FOOOO!
+0
-5
test/fixtures/test.json less more
0 {
1 "foo": {
2 "bar": "baz"
3 }
4 }
+0
-1
test/fixtures/test.txt less more
0 FILE CONTENTS!!!
+0
-2
test/fixtures/test.yaml less more
0 foo:
1 bar: baz
+0
-1
test/mocha.opts less more
0 --reporter progress
+0
-30
test/test.js less more
0 /**
1 * read-file <https://github.com/assemble/read-file>
2 *
3 * Copyright (c) 2014 Jon Schlinkert, contributors.
4 * Licensed under the MIT license.
5 */
6
7 const expect = require('chai').expect;
8 const path = require('path');
9 const file = require('../');
10
11 describe('file system methods', function () {
12
13 var testTxtFile = 'test/fixtures/test.txt';
14 var testTxtContents = 'FILE CONTENTS!!!';
15
16 it('should read the file', function () {
17 var expected = testTxtContents;
18 var actual = file.readFileSync(testTxtFile);
19 expect(actual).to.eql(expected);
20 });
21
22 it('should read the file (async)', function (done) {
23 var expected = testTxtContents;
24 file.readFile(testTxtFile, function (err, actual) {
25 expect(actual).to.eql(expected);
26 done();
27 });
28 });
29 });
0 'ust strict';
1
2 var assert = require('assert');
3 var read = require('./');
4
5 describe('read-file', function () {
6 it('should read the file synchronously:', function () {
7 assert.equal(read.sync('fixtures/a.txt'), 'FILE CONTENTS!!!');
8 });
9
10 it('should read the file:', function (done) {
11 read('fixtures/a.txt', function (err, str) {
12 assert.equal(str, 'FILE CONTENTS!!!');
13 done();
14 });
15 });
16 });