@devcodex-labs/extraction-runtime is a small, extensible runtime for parsing files and extracting text, metadata, and structured sections.
npm install @devcodex-labs/extraction-runtimeimport { extract } from "@devcodex-labs/extraction-runtime";
const result = await extract("./README.md");
console.log(result.text);
console.log(result.metadata);- Local file paths
URLobjects that point to local filesBuffer,Uint8Array, andArrayBuffer- Node.js readable streams
- Plain text:
.txt - Markdown:
.md,.markdown - JSON:
.json - CSV:
.csv - HTML:
.html,.htm
Extracts text, metadata, and structured sections from a file-like input.
const result = await extract(buffer, {
filename: "data.json",
mimeType: "application/json"
});Detects the likely file type from filename, MIME type, and lightweight content sniffing.
Registers a parser at runtime.
import { registerParser } from "@devcodex-labs/extraction-runtime";
registerParser({
id: "custom",
extensions: [".custom"],
async parse(context) {
return {
text: context.content.toString("utf8"),
metadata: {},
sections: [],
pages: [],
warnings: [],
source: context.source
};
}
});Versions are published from GitHub Actions when a semver tag is pushed:
git tag v0.1.0
git push origin v0.1.0The publish workflow is configured for npm trusted publishing with GitHub Actions OIDC. Configure the package trusted publisher on npm before pushing the first release tag.