-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
96 additions
and
53 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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
'use strict' | ||
|
||
const toNdjsonBuf = (items) => { | ||
const chunks = [] | ||
let i = 0, bytes = 0 | ||
for (const item of items) { | ||
const sep = i++ === 0 ? '' : '\n' | ||
const buf = Buffer.from(sep + JSON.stringify(item), 'utf8') | ||
chunks.push(buf) | ||
bytes += buf.length | ||
} | ||
return Buffer.concat(chunks, bytes) | ||
} | ||
|
||
module.exports = toNdjsonBuf |
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,16 @@ | ||
'use strict' | ||
|
||
const {statSync} = require('fs') | ||
const allStations = require('vbb-stations/full.json') | ||
|
||
// We don't have access to the publish date+time of the npm package, | ||
// so we use the ctime of vbb-stations/full.json as an approximation. | ||
// todo: this is brittle, find a better way, e.g. a build script | ||
const timeModified = statSync(require.resolve('vbb-stations/full.json')).ctime | ||
|
||
// todo: station.stops? | ||
|
||
module.exports = { | ||
timeModified, | ||
data: allStations, | ||
} |
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 was deleted.
Oops, something went wrong.
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