Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
**/node_modules/*
**/vendor/*
**/*.min.js
**/coverage/*
**/build/*
21 changes: 21 additions & 0 deletions .eslintrc
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"
}
136 changes: 136 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
# Created by https://www.gitignore.io/api/osx,vim,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


### OSX ###

# Icon must end with two \r

# Thumbnails

# Files that might appear in the root of a volume

# Directories potentially created on remote AFP share

### Vim ###
# swap
[._]*.s[a-v][a-z]
[._]*.sw[a-p]
[._]s[a-v][a-z]
[._]sw[a-p]
# session
Session.vim
# temporary
.netrwhist
*~
# auto-generated tag files
tags

### 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/osx,vim,node,macos,windows
45 changes: 45 additions & 0 deletions assets/one.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
You sit there in your heartache
Waiting on some beautiful boy to
To save your from your old ways
You play forgiveness
Watch it now, here he comes

He doesn't look a thing like Jesus
But he talks like a gentlemen
Like you imagined when you were young

Can we climb this mountain
I don't know
Higher now than ever before
I know we can make it if we take it slow
Let's take it easy
Easy now, watch it go

We're burning down the highway skyline
On the back of a hurricane that started turning
When you were young
When you were young

And sometimes you close your eyes
And see the place where you Used to live
When you were young

They say the devil's water - it ain't so sweet
You don't have to drink right now
But you can dip your feet
Every once in a little while

You sit there in your heartache
Waiting on some beautiful boy to
To save you from your old ways
You play forgiveness
Watch it now, here he comes

He doesn't look a thing like Jesus
But he talks like a gentlemen
Like you imagined when you were young
When you were young

I said he doesn't look a thing like Jesus
He doesn't look a thing like Jesus
But more than you'll ever know
68 changes: 68 additions & 0 deletions assets/three.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
Tonight I'm gonna have myself a real good time
I feel alive and the world I'll turn it inside out - yeah
And floating around in ecstasy
So don't stop me now don't stop me
'Cause I'm having a good time having a good time

I'm a shooting star leaping through the sky
Like a tiger defying the laws of gravity
I'm a racing car passing by like Lady Godiva
I'm gonna go go go
There's no stopping me

I'm burnin' through the sky yeah
Two hundred degrees
That's why they call me Mister Fahrenheit
I'm trav'ling at the speed of light
I wanna make a supersonic man out of you

Don't stop me now I'm having such a good time
I'm having a ball
Don't stop me now
If you wanna have a good time just give me a call
Don't stop me now ('Cause I'm having a good time)
Don't stop me now (Yes I'm havin' a good time)
I don't want to stop at all

Yeah, I'm a rocket ship on my way to Mars
On a collision course
I am a satellite I'm out of control
I am a sex machine ready to reload
Like an atom bomb about to
Oh oh oh oh oh explode

I'm burnin' through the sky yeah
Two hundred degrees
That's why they call me Mister Fahrenheit
I'm trav'ling at the speed of light
I wanna make a supersonic woman of you

Don't stop me don't stop me
Don't stop me hey hey hey
Don't stop me don't stop me
Ooh ooh ooh, I like it
Don't stop me don't stop me
Have a good time good time
Don't stop me don't stop me ah
Oh yeah
Alright

Oh, I'm burnin' through the sky yeah
Two hundred degrees
That's why they call me Mister Fahrenheit
I'm trav'ling at the speed of light
I wanna make a supersonic man out of you

Don't stop me now I'm having such a good time
I'm having a ball
Don't stop me now
If you wanna have a good time (wooh)
Just give me a call (alright)
Don't stop me now ('cause I'm having a good time - yeah yeah)
Don't stop me now (yes I'm havin' a good time)
I don't want to stop at all
La da da da daah
Da da da haa
Ha da da ha ha haaa
Ha da daa ha da da aaa
Ooh ooh ooh
57 changes: 57 additions & 0 deletions assets/two.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
I'm leaving this place behind
And I'm heading out on the road tonight
I'm off for the winter lands
Way up north to have taught you to stand
Before I commence my ride
I'm asking Lily to be my bride
I know there's another man
But he ain't gonna delay my plans

I know she's gonna be my wife
Gonna fall in love I'm gonna live my life with her
You know I bet he's not so tough
Ain't afraid of him cause I'm a fool for love

I've come far to find Big Jim
Well here I am and I guess you him
I see how you got your name
You're tall as hell and broad as a train
They say you a hard-broiled man
And the baddest guy in the whole wide land
Well I'm not afraid to fight
Let's step outside and I'll show you why

I'm humming like a revved up truck
Never mind the odds I'm gonna try my luck with her
Just tell me when you've had enough
I'm dangerous cause I'm a fool for love

You know you don't hit half bad
For my love I will lay in the grave tonight
Just wait until I catch my breath
Gonna send you off to an early death

I lie in the drifting snow
Bleeding out as it covers me up
If Spring comes before I'm found
Just throw my bones in a hole in the ground

I lost friends along my way
I knew I'd need them eventually
No I'm not afraid to die
Just mad I left Big Jim alive

I know I should've never looked back
But you ain't gonna win a woman's heart like that
I never should've called his bluff
I was born to lose cause I'm a fool for love

I stare into the endless sky
And I saw a tale of my life go by
I drift into the great unknown
I really don't know where I'm going

I stare into the endless sky
And I saw a tale of my life go by
I drift into the great unknown
I really don't know where I'm going
14 changes: 14 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
'use strict';

const fr = require('./lib/reader.js');

module.exports = exports = {};

exports.fileRunner = (err, data) => {
const filesNames = ['one.txt', 'two.txt', 'three.txt'];
filesNames.forEach((ele) => {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not guarantee that they will complete in order. If the first takes longer then the 2nd it could be different. They will probably come back in order because on your computer it happens so fast that it won't be super noticeable and the speeds won't vary much. Also you are passing through ele, and err which the ele is the path so that is fine but the err is actually the callback from the test. While technically this is correct because fileReader wants the callback you shouldn't be calling it error because that isn't what it is.

fr.fileReader(ele, err);
});
};
// NOTE: uncomment to run with node
// exports.fileRunner();
16 changes: 16 additions & 0 deletions lib/reader.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
'use strict';

const fs = require('fs');

module.exports = exports = {};

exports.fileReader = (file, callback) => {
fs.readFile(`${__dirname}/../assets/${file}`, (err, data) => {
if(err) return callback(err);
// making sure correct byte length
let byteLen = Buffer.alloc(8, data, 'hex');
console.log(Buffer.byteLength(byteLen));
// printing first 8 bytes in hex
return callback(console.log(file, Buffer.alloc(8, data, 'hex')), () => null);
});
};
27 changes: 27 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "03-parallel_file_system",
"version": "1.0.0",
"description": "![CF](https://camo.githubusercontent.com/70edab54bba80edb7493cad3135e9606781cbb6b/687474703a2f2f692e696d6775722e636f6d2f377635415363382e706e67) 04: Parallel File Processing ===",
"main": "index.js",
"directories": {
"test": "mocha"
},
"devDependencies": {
"chai": "^4.1.0",
"mocha": "^3.4.2"
},
"scripts": {
"test": "mocha"
},
"repository": {
"type": "git",
"url": "git+https://github.com/loganabsher/03-parallel_file_system.git"
},
"keywords": [],
"author": "",
"license": "MIT",
"bugs": {
"url": "https://github.com/loganabsher/03-parallel_file_system/issues"
},
"homepage": "https://github.com/loganabsher/03-parallel_file_system#readme"
}
Loading