@editorialapp/datatools
A collection of dependencies organized into useful tools for working with data in ways that are common in data cleaning and in building news apps.
These tools assume they will be used as part of scripts run with Node.js.
Turn a directory of markdown into a sqlite3 table
An example taken from the tests:
import { markdownDirectoryToTable } from '@editorialapp/datatools'
import * as dirname from 'desm'
const markdownDirectory = dirname.join(import.meta.url, './fixtures/markdown')
const db = await markdownDirectoryToTable({
directoryFilepath: markdownDirectory,
tableName: 'markdown',
columns: {
title: 'TEXT',
content: 'TEXT'
}
})
const rows = await db.prepare('SELECT * FROM markdown;').all()
console.log(rows)
License
Apache-2.0