-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- output to file based on format data.{format} - more documentation
- Loading branch information
Showing
15 changed files
with
465 additions
and
60 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#!/usr/bin/env bash | ||
mkdir -p out | ||
wget -O out/test.pdf -nc https://github.com/mozilla/pdf.js/raw/master/web/compressed.tracemonkey-pldi-09.pdf | ||
node gd.js -i './out/test.pdf' -f json > out/test.json | ||
node gd.js -i './out/test.pdf' -f text > out/test.txt | ||
node gd.js -i './out/test.pdf' -f json | ||
node gd.js -i './out/test.pdf' -f text |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
const fs = require('fs'); | ||
|
||
/** | ||
* Save file data to directory | ||
* @param fpath - path to file with extension | ||
* @param data - file content | ||
* @returns {Promise<void>} | ||
*/ | ||
const saveFileAsync = async (fpath, data) => { | ||
const stream = fs.createWriteStream(fpath); | ||
await stream.write(data); | ||
await stream.end(); | ||
} | ||
|
||
/** | ||
* Make directory if not exists in given path | ||
* @param path - directory path | ||
*/ | ||
const mkdirNotExists = (path) => { | ||
if(!fs.existsSync(path)) { | ||
fs.mkdirSync(path); | ||
} | ||
} | ||
|
||
module.exports = { | ||
saveFileAsync, | ||
mkdirNotExists, | ||
} |
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.