File tree Expand file tree Collapse file tree 3 files changed +9
-5
lines changed
Expand file tree Collapse file tree 3 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -2,8 +2,7 @@ const fs = require('fs');
22const path = require ( 'path' ) ;
33const config = require ( './config' ) ;
44const yaml = require ( 'read-yaml' ) ;
5- const Hashids = require ( 'hashids' ) ;
6- const hashids = new Hashids ( ) ;
5+ const hash = require ( 'hash-sum' ) ;
76
87const globalConfigDir = process . env [ ( process . platform == 'win32' ) ? 'USERPROFILE' : 'HOME' ] + '/.gtt' ;
98const globalConfigFile = globalConfigDir + '/config.yml' ;
@@ -82,16 +81,16 @@ class fileConfig extends config {
8281 }
8382
8483 _cacheGet ( key ) {
85- let file = this . cacheDir + '/' + hashids . encode ( key ) ;
84+ let file = this . cacheDir + '/' + hash ( key ) ;
8685 if ( ! fs . existsSync ( file ) ) return false ;
8786
8887 return JSON . parse ( fs . readFileSync ( file ) ) ;
8988 }
9089
9190 _cacheSet ( key , value ) {
92- let file = this . cacheDir + '/' + hashids . encode ( key ) ;
91+ let file = this . cacheDir + '/' + hash ( key ) ;
9392 if ( fs . existsSync ( file ) ) fs . unlinkSync ( file ) ;
94- fs . appendFileSync ( file , JSON . stringify ( value ) ) ;
93+ fs . appendFile ( file , JSON . stringify ( value ) , ( ) => { } ) ;
9594
9695 return value ;
9796 }
Original file line number Diff line number Diff line change 2525 "commander" : " ^2.9.0" ,
2626 "csv-string" : " ^2.3.2" ,
2727 "find-in-files" : " ^0.4.0" ,
28+ "hash-sum" : " ^1.0.2" ,
2829 "hashids" : " ^1.1.1" ,
2930 "markdown-pdf" : " ^8.0.0" ,
3031 "markdown-table" : " ^1.1.0" ,
Original file line number Diff line number Diff line change @@ -370,6 +370,10 @@ has-ansi@^2.0.0:
370370 dependencies :
371371 ansi-regex "^2.0.0"
372372
373+ hash-sum@^1.0.2 :
374+ version "1.0.2"
375+ resolved "https://registry.yarnpkg.com/hash-sum/-/hash-sum-1.0.2.tgz#33b40777754c6432573c120cc3808bbd10d47f04"
376+
373377hasha@~2.2.0 :
374378 version "2.2.0"
375379 resolved "https://registry.yarnpkg.com/hasha/-/hasha-2.2.0.tgz#78d7cbfc1e6d66303fe79837365984517b2f6ee1"
You can’t perform that action at this time.
0 commit comments