
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
gtfs-sequelize
Advanced tools
A model of the static GTFS using sequelize.js.
Currently works only with PostgreSQL (including PostGIS), MySQL (with spatial capabilities) and sqlite (but NOT spatialite).
In order to use this library, you must also install the additional libraries in your project depending on the database that you use.
npm install pg --save
npm install pg-copy-streams --save
npm install pg-query-stream --save
npm install pg-hstore --save
You must also install the package promise-polyfill
and write additional code. See here for more details.
npm install mysql --save
npm install streamsql --save
npm install sqlite3 --save
npm install streamsql --save
Usage with SQLite requires that sqlite is installed and is available via a unix command line.
Create a new GTFS API.
Example:
var GTFS = require('gtfs-sequelize');
var pgConfig = {
database: 'postgres://gtfs_sequelize:gtfs_sequelize@localhost:5432/gtfs-sequelize-test',
downloadsDir: 'downloads',
gtfsFileOrFolder: 'google_transit.zip',
spatial: true,
sequelizeOptions: {
logging: false
}
}
var gtfs = GTFS(pgConfig);
gtfs.loadGtfs(function() {
//database loading has finished callback
});
Key | Value |
---|---|
database | A database connection string. You must specify a user and a database in your connection string. The database must already exist, but the tables within the db do not need to exist. |
downloadsDir | The directory where you want the feed zip fils downloaded to or where you're going to read the feed read from. |
gtfsFileOrFolder | The (zip) file or folder to load the gtfs from |
interpolateStopTimes | Default is undefined. If true, after loading the stop_times table, all stop_times with undefined arrival and departure times will be updated to include interpolated arrival and departure times. |
sequelizeOptions | Options to pass to sequelize. Note: to use a specific schema you'll want to pass something like this: { schema: 'your_schema' } |
spatial | Default is undefined. If true, spatial tables for the shapes and stops will be created. |
Return a sequelize api of the database.
Example:
var db = gtfs.connectToDatabase()
db.stop.findAll()
.then(stops => {
console.log(stops)
})
If a url is provided, the feed will be attempted to be downloaded. Works with http
, https
and ftp
.
Interpolate stop_times with undefined arrival and departure times. If you load a gtfs with the interpolateStopTimes
flag set to true, you don't need to call this.
Load the gtfs into the database.
FAQs
A model for the static GTFS using sequelize.
The npm package gtfs-sequelize receives a total of 1 weekly downloads. As such, gtfs-sequelize popularity was classified as not popular.
We found that gtfs-sequelize demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.