-
Notifications
You must be signed in to change notification settings - Fork 15
lab-dana #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
lab-dana #13
Changes from 7 commits
e6a0b01
4e6c6ec
8ef8b1d
2f48265
34c018f
38c1c8b
4aec979
e081ea8
6c7695a
8357ad9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"rules": { | ||
"no-console": "off", | ||
"indent": [ "error", 2 ], | ||
"quotes": [ "error", "single" ], | ||
"semi": ["error", "always"], | ||
"linebreak-style": [ "error", "unix" ] | ||
}, | ||
"env": { | ||
"es6": true, | ||
"node": true, | ||
"mocha": true, | ||
"jasmine": true | ||
}, | ||
"ecmaFeatures": { | ||
"modules": true, | ||
"experimentalObjectRestSpread": true, | ||
"impliedStrict": true | ||
}, | ||
"extends": "eslint:recommended" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
|
||
# Created by https://www.gitignore.io/api/node,macos,windows | ||
|
||
### macOS ### | ||
*.DS_Store | ||
.AppleDouble | ||
.LSOverride | ||
|
||
# Icon must end with two \r | ||
Icon | ||
|
||
|
||
# Thumbnails | ||
._* | ||
|
||
# Files that might appear in the root of a volume | ||
.DocumentRevisions-V100 | ||
.fseventsd | ||
.Spotlight-V100 | ||
.TemporaryItems | ||
.Trashes | ||
.VolumeIcon.icns | ||
.com.apple.timemachine.donotpresent | ||
|
||
# Directories potentially created on remote AFP share | ||
.AppleDB | ||
.AppleDesktop | ||
Network Trash Folder | ||
Temporary Items | ||
.apdisk | ||
|
||
### Node ### | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (http://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# Typescript v1 declaration files | ||
typings/ | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variables file | ||
.env | ||
|
||
|
||
### Windows ### | ||
# Windows thumbnail cache files | ||
Thumbs.db | ||
ehthumbs.db | ||
ehthumbs_vista.db | ||
|
||
# Folder config file | ||
Desktop.ini | ||
|
||
# Recycle Bin used on file shares | ||
$RECYCLE.BIN/ | ||
|
||
# Windows Installer files | ||
*.cab | ||
*.msi | ||
*.msm | ||
*.msp | ||
|
||
# Windows shortcuts | ||
*.lnk | ||
|
||
# End of https://www.gitignore.io/api/node,macos,windows |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Enamel pin fashion axe cred, offal tilde paleo glossier art party unicorn narwhal chicharrones church-key hexagon small batch. Photo booth helvetica quinoa, thundercats lumbersexual deep v mixtape pour-over single-origin coffee whatever. Fam scenester edison bulb farm-to-table, cornhole kinfolk seitan pabst 90's kombucha la croix normcore activated charcoal mumblecore. Polaroid before they sold out 8-bit, etsy pitchfork man bun normcore succulents knausgaard humblebrag franzen kitsch marfa organic actually. Franzen knausgaard kinfolk etsy ugh. Bitters roof party tumblr hammock. Gochujang kinfolk pickled enamel pin jean shorts. | ||
|
||
Enamel pin cold-pressed hoodie, kale chips VHS man braid flexitarian quinoa unicorn pinterest taxidermy vinyl. Echo park tumblr brooklyn, craft beer wayfarers skateboard pug. Forage glossier single-origin coffee kitsch, bicycle rights messenger bag hella chicharrones shabby chic. Tumblr williamsburg truffaut master cleanse unicorn, kickstarter snackwave lo-fi vinyl DIY gentrify photo booth. Umami health goth yuccie, asymmetrical pinterest food truck chartreuse cardigan aesthetic. Drinking vinegar fixie pork belly beard twee, knausgaard hammock typewriter paleo. Microdosing truffaut tofu shabby chic normcore food truck. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Succulents schlitz skateboard asymmetrical trust fund fingerstache. Pug fingerstache taxidermy, slow-carb meggings messenger bag unicorn subway tile. Hashtag hoodie cornhole quinoa wolf yuccie polaroid, man bun cronut dreamcatcher slow-carb small batch man braid. Sriracha kinfolk whatever, slow-carb gluten-free la croix swag. Copper mug edison bulb tofu aesthetic bespoke try-hard cold-pressed. Direct trade lo-fi small batch, lumbersexual venmo cray ethical post-ironic pork belly lomo poutine tilde try-hard craft beer twee. Dreamcatcher bespoke organic, occupy put a bird on it tumeric literally. | ||
|
||
Keffiyeh fap letterpress succulents, man braid slow-carb activated charcoal. Etsy hammock food truck, jean shorts blue bottle migas small batch bitters bicycle rights yuccie poutine. Cronut 3 wolf moon poke, squid tumblr disrupt offal retro bushwick fingerstache fanny pack williamsburg. Cray actually gluten-free, fashion axe sustainable raw denim keytar flexitarian kogi 90's. Whatever lomo trust fund fam ethical, freegan yuccie next level franzen viral. Man bun literally cornhole, kogi master cleanse brunch marfa seitan farm-to-table XOXO. Church-key meh poutine etsy fap normcore plaid, pickled ugh pabst pinterest. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Slow-carb post-ironic la croix, direct trade cray umami irony ugh woke kogi hella. Pickled messenger bag twee, pour-over before they sold out jianbing tbh mustache man braid master cleanse. Leggings wolf man braid heirloom, neutra celiac 8-bit sustainable gastropub tilde glossier four dollar toast you probably haven't heard of them tousled. Banh mi ethical live-edge, trust fund schlitz echo park hot chicken vexillologist. Hot chicken shoreditch live-edge, hexagon tilde twee small batch. Etsy post-ironic pitchfork, kinfolk gastropub chartreuse cred prism humblebrag. Asymmetrical lumbersexual iPhone food truck, 3 wolf moon skateboard cold-pressed slow-carb mixtape biodiesel vaporware cornhole health goth. | ||
|
||
Seitan williamsburg literally, raw denim pork belly wolf hoodie tote bag hammock skateboard. Tumeric subway tile ugh la croix 3 wolf moon. Meh slow-carb af, bushwick church-key tilde kitsch offal swag four loko deep v. Fap scenester portland, chambray forage craft beer deep v sriracha occupy fam affogato. Twee tumblr post-ironic distillery, trust fund freegan mustache YOLO church-key cray unicorn. Pinterest slow-carb banjo 90's. Everyday carry single-origin coffee intelligentsia, mlkshk unicorn aesthetic forage lomo cronut chillwave la croix. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// 'use strict'; | ||
// | ||
// const reader = require('./lib/file-reader.js').readFiles; | ||
// | ||
// reader(['one.txt', 'two.txt', 'three.txt']); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// 'use strict'; | ||
// | ||
// const fs = require('fs'); | ||
// | ||
// const dataFiles = module.exports = function() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is heading in the correct direction. You need to figure out how to structure your function dataFils so that it can take the files you want to read, and then take a callback function as a final argument. |
||
// fs.readdir(`${__dirname}/../data`, function(err, data) { | ||
// if (err) throw err; | ||
// return data; | ||
// }); | ||
// }; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
'use strict'; | ||
|
||
const fs = require('fs'); | ||
|
||
module.exports = exports = {}; | ||
|
||
exports.readFiles = function(file, callback) { | ||
if (file instanceof Array) {//linter wouldn't let me use (! instanceof) | ||
file.map(function(ele) { | ||
fs.readFile(`${__dirname}/../data/${ele}`, function(err, data) { | ||
if (err) return callback(err); | ||
|
||
let string = data.toString('hex').substring(0, 8); | ||
console.log(string); | ||
return callback(null, string); | ||
}); | ||
}); | ||
} else { | ||
throw new Error('file name array not found'); | ||
} | ||
}; | ||
|
||
// exports.readFiles = function(file, callback) { | ||
// if (file instanceof Array) {//linter wouldn't let me use (! instanceof) | ||
// let fileResults = file.reduce(function(acc, ele) { | ||
// fs.readFile(`${__dirname}/../data/${ele}`, function(err, data) { | ||
// if (err) throw err; | ||
// let string = data.toString('hex').substring(0, 8); | ||
// acc.push(string); | ||
// return acc; | ||
// }); | ||
// }, []); | ||
// // callback(null, fileResults); | ||
// console.log(fileResults); | ||
// } else { | ||
// throw new Error('file name array not found'); | ||
// } | ||
// }; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"name": "lab03", | ||
"version": "1.0.0", | ||
"description": " Lab 03: Parallel File Processing ===", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/dkulp23/03-parallel_file_processing.git" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC", | ||
"bugs": { | ||
"url": "https://github.com/dkulp23/03-parallel_file_processing/issues" | ||
}, | ||
"homepage": "https://github.com/dkulp23/03-parallel_file_processing#readme", | ||
"devDependencies": { | ||
"chai": "^3.5.0", | ||
"gulp": "^3.9.1", | ||
"mocha": "^3.2.0" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
'use strict'; | ||
|
||
const expect = require('chai').expect; | ||
const readFile = require('../lib/file-reader.js').readFiles; | ||
|
||
describe('File Reader Module', function() { | ||
describe('test false file path', function() { | ||
it('should return an error message', function(done) { | ||
readFile(['imaginary-file.txt'], function(err) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good test; this should work fine when your method is working properly. |
||
expect(err).to.be.an('error'); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('test actual file paths', function() { | ||
it('should return the first 8 hex digits', function(done) { | ||
readFile(['one.txt', 'two.txt', 'three.txt'], function(err, data) { | ||
expect(err).to.equal(null); | ||
expect(data).to.be.a('string'); | ||
|
||
done(); | ||
}); | ||
}); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yay lorem ipsum stuff. :)