npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

csv2xbrl

v0.3.9

Published

A library to transform xBRL-CSV files into xBRL-XML instance documents

Readme

CSV2XBRL

A javascript / typescript library designed to transform xBRL-CSV files into xBRL-XML instance documents.

Installation

First, make sure you have Node.js and npm installed on your machine. Then, install the package with npm or your favourite package manager:

npm install csv2xbrl

Usage

The following piece code shows the basic usage of the library:

import { csv2xbrl, loadPackages } from "csv2xbrl";

async function main() {

    const resolver = await loadPackages(["mytaxonomy.zip", "xbrl-org.zip"]);
    const output = fs.createWriteStream("output.xbrl");

    await csv2xbrl("file:///path/to/metadata.json", output, resolver);
}
  1. It first calls the loadPackages function with two zip files following the taxonomy package format. This function produces a resolver: a function that, given a URL with the official location of a file and a mime-type, takes care of loading such file.

    In this case, taxonomy packages provide a local copy of resources available on the internet, like a the set of files of a taxonomy or the normative files published by XBRL international. The resolver will be used later by the csv2xbrl function to load files.

    Since loadpackages returns a Promise to a resolver object, the await keyword is used to pause the execution of the function until the Promise is resolved.

  2. It then creates a writable stream to a file named "output.xbrl" using Node.js's fs.createWriteStream method. This stream will be used to write the output XBRL file.

  3. Finally, it calls the csv2xbrl function with three arguments: a URL to the JSON file, the writable stream, and the resolver object. This function is also expected to return a Promise, and the await keyword is used to pause the execution of the function until this Promise is resolved.

Limitations

The following features in the specification are not supported by the current implementation:

  • Footnotes
  • Row ids

Description of main classes

TaxonomyCatalog

The taxonomy catalog is the class responsible for managing the access to taxonomy files. The simples way to create a taxonomy catalog is using the build method, which takes an array of file paths to taxonomy packages:

const catalog = await TaxonomyCatalog.build(["taxonomyPackage1.zip", "taxonomyPackage2.zip"]);

Once the catalog is built, it is possible to load a taxonomy providing an entry point (an URL to a taxonomy module or an array to multiple ones):

const taxonomy = await catalog.loadTaxonomy("http://www.eba.europa.eu/eu/fr/xbrl/crr/fws/mrel/its-006-2020/2024-02-29/mod/mrel_tlac.xsd");

Additionally, the catalog provides a method to load an individual file. It supports both XML and JSON files by indicating the corresponding mime type ('application/json' or 'application/xml'):

const doc = await catalog.resolveDocument("http://www.eba.europa.eu/eu/fr/xbrl/crr/fws/mrel/its-006-2020/2024-02-29/tab/m_01.00/m_01.00.json", "application/json")

Mind that the URLs provided must be the normative ones (not local ones), since the catalog takes care of resolving the files to their location in taxonomy packages.

The provided taxonomy object provides some methods to obtain information about the elements in the taxonomy. So far, basic functionality just meant to cover the needs of the CSV to XBRL conversion.