mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-15 06:35:20 -07:00
Stream JSON lists to file one line at a time
This commit is contained in:
parent
ea40288bea
commit
d497c12c99
1 changed files with 4 additions and 7 deletions
|
|
@ -51,6 +51,9 @@ import {
|
|||
import {
|
||||
cliOptions
|
||||
} from '~/helpers/cli-options.js'
|
||||
import {
|
||||
streamToJson
|
||||
} from '~/helpers/json.js'
|
||||
|
||||
// Setup dotenv
|
||||
dotenv.config()
|
||||
|
|
@ -279,13 +282,7 @@ class BuildLists {
|
|||
|
||||
const saveableList = saveMethod( this.lists[listOptions.name] )
|
||||
|
||||
// console.log('saveableList', typeof saveableList)
|
||||
|
||||
// Stringify one at a time to allow for large lists
|
||||
const saveableListJSON = '[' + saveableList.map(el => JSON.stringify(el)).join(',') + ']'
|
||||
|
||||
// Write the list to JSON
|
||||
await fs.writeFile(listFullPath, saveableListJSON)
|
||||
await streamToJson( saveableList, listFullPath )
|
||||
|
||||
return
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue