Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a01f3cd09c | ||
|
|
ed4f398062 |
@@ -12,7 +12,7 @@
|
||||
"type": "git",
|
||||
"url": "git://github.com/Godzil/crunchyroll.js.git"
|
||||
},
|
||||
"version": "1.1.17",
|
||||
"version": "1.1.18",
|
||||
"bin": {
|
||||
"crunchy": "./bin/crunchy"
|
||||
},
|
||||
|
||||
@@ -9,6 +9,21 @@ import url = require('url');
|
||||
import log = require('./log');
|
||||
const persistent = '.crpersistent';
|
||||
|
||||
/**
|
||||
* Check if a file exist..
|
||||
*/
|
||||
function fileExist(path: string)
|
||||
{
|
||||
try
|
||||
{
|
||||
fs.statSync(path);
|
||||
return true;
|
||||
} catch (e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Streams the series to disk.
|
||||
*/
|
||||
@@ -17,7 +32,10 @@ export default function(config: IConfig, address: string, done: (err: Error) =>
|
||||
const persistentPath = path.join(config.output || process.cwd(), persistent);
|
||||
|
||||
/* Make a backup of the persistent file in case of */
|
||||
fse.copySync(persistentPath, persistentPath + '.backup');
|
||||
if (fileExist(persistentPath))
|
||||
{
|
||||
fse.copySync(persistentPath, persistentPath + '.backup');
|
||||
}
|
||||
|
||||
fs.readFile(persistentPath, 'utf8', (err: Error, contents: string) =>
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user