- Does the code work?
- Description of the project status is included.
- Code is easily understand.
- Code is written following the coding standarts/guidelines (React in our case).
- Code is in sync with existing code patterns/technologies.
- DRY. Is the same code duplicated more than twice?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const progress = async (flag = '=') => { | |
const sleep = (timeout) => { | |
return new Promise((resovle) => { setTimeout(resovle, timeout) }); | |
} | |
const total = 100; | |
for (let j = 1; j <= total; j++) { | |
process.stdout.write(`\u001b[${10000}D`); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import fs from 'fs'; | |
const fileToBuffer = async (filePath) => { | |
return new Promise((resovle, reject) => { | |
fs.readFile(filePath, (error, data) => { | |
if (error) { | |
reject(error); | |
} else { | |
resovle(data); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const streamToBuffer = (readableStream) => { | |
if (!readableStream) { | |
throw new Error('Error: readableStream can not be null') | |
} | |
return new Promise((resovle, reject) => { | |
const buffers = []; | |
readableStream.on('data', (chunks) => { | |
buffers.push(chunks); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import http from 'http'; | |
import https from 'https'; | |
import fs from 'fs'; | |
export default async (url, dest) => { | |
const protocol = url.indexOf('https') === 0 ? https : http; | |
const fileStream = fs.createWriteStream(dest); | |
return new Promise((resovle, reject) => { | |
// http.IncomingMessage | |
const request = protocol.get(url, (response) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ip = require('ip'); | |
export default () => ip.address() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import crypto from 'crypto'; | |
import fs from 'fs'; | |
import http from 'http'; | |
import https from 'https'; | |
export const getFileMD5 = async (filePath, encoding='hex') => { | |
const hash = crypto.createHash('md5'); | |
hash.setEncoding(encoding); | |
return new Promise((resolve, reject) => { | |
fs.createReadStream(filePath) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import http from 'http'; | |
/** | |
* @see https://stackoverflow.com/questions/38533580/nodejs-how-to-promisify-http-request-reject-got-called-two-times | |
*/ | |
export default async (options, postData) => { | |
return new Promise((resolve, reject) => { | |
let body = []; | |
const request = http.request(options, (res) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"content_scripts": [ | |
{ | |
"matches": ["http://*/*", "https://*/*"], | |
"js": ["inject.js"], | |
"all_frames": true | |
} | |
], | |
"web_accessible_resources": [ | |
"content.js" |
NewerOlder