Registry / database / txt-to-sql

txt-to-sql

JSON →
library0.1.2jsnpmunverified

txt-to-sql is a command-line tool and Node.js library for converting delimited text data (e.g., CSV, TSV) into SQL INSERT/UPDATE statements. Version 0.1.2 is an early-stage release labeled 'designing' by its stability badge, indicating breaking changes are likely. It provides both a CLI (with options for fast streaming and default export) and a programmatic API using promises. There are few alternatives in this niche, but the package is unmaintained (last commit in 2016) and should be considered experimental.

npm install txt-to-sql
INSTALL
IMPORT
SIG · TXT-TO-SQL
T
txt-to-sql
databasejavascriptv0.1.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

generateScripts
✓ var txtToSql = require('txt-to-sql'); txtToSql.generateScripts(path);
✗ import { generateScripts } from 'txt-to-sql';
The package uses CommonJS; no ES module export is available. Named function is accessed via the default require object.
default import
✓ var txtToSql = require('txt-to-sql');
✗ import txtToSql from 'txt-to-sql';
No default ES import exists; use require() only.
CLI usage
✓ require('txt-to-sql') via CLI (global install) or local npx
✗ const cli = require('txt-to-sql').cli;
There is no programmatic CLI object; the tool is intended to be used via command line or the generateScripts function.

Demonstrates programmatic usage: reads a text file and generates SQL statements via the generateScripts function.

const txtToSql = require('txt-to-sql'); const path = require('path'); txtToSql.generateScripts('./data.txt') .then(function(generated) { console.log('SQL output:'); console.log(generated.rawSql); }) .catch(function(err) { console.error('Error:', err); });
Debug
Known issues
deprecatedPackage is marked as 'designing' stability; API may change without notice. Last update in 2016, unmaintained.
fix
Consider alternatives like csvkit or writing custom converters.
affects: all
gotchaCLI option --fast uses streams but may produce incomplete output for large files due to buffering issues.
fix
Use default mode (without --fast) or chunk input manually.
affects: 0.1.0 - 0.1.2
gotchagenerateScripts returns a promise that resolves to an object with rawSql; may be undefined for empty input.
fix
Always check generated.rawSql or use try/catch.
affects: all
breakingPackage uses require('txt-to-sql') but does not expose a constructor; all functions are static on the module object.
fix
Use require('txt-to-sql') and access .generateScripts directly.
affects: all
Errors
Common errors & fixes
txt-to-sql --prepare file.txt generates: Error: Cannot find module 'yamljs'
Missing dependency yamljs (required for --prepare).
fix
Install yamljs globally: npm install -g yamljs
UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'rawSql' of undefined
generateScripts resolves but no file found or input empty.
fix
Ensure the input file exists and contains data; check rejected promise.
txt-to-sql: command not found
Package not installed globally or not in PATH.
fix
Run npm install -g txt-to-sql or use npx txt-to-sql.
Upgrade
Version history
0.1.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
20 hits · last 30 days
node
16
OpenAI (training)
2
Amazon
1
Resources
txt-to-sql — npm install txt-to-sql · libregistry