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

ymlify

v1.0.0

Published

Convert JSON, XML, CSV, TOML, and ENV files to YAML format

Readme

🔄 ymlify

Convert JSON, XML, CSV, TOML, and ENV files to YAML format with ease.

🚀 Installation

Global Installation

npm install -g ymlify

Local Installation

npm install ymlify

📖 Usage

CLI Usage

After global installation:

ymlify openapi.json
ymlify config.xml config.yml
ymlify data.csv
ymlify settings.toml
ymlify .env environment.yml

With npx (no installation required):

npx ymlify openapi.json

Programmatic Usage

import { ymlify, ymlifyString } from "ymlify";

// Convert file
ymlify("config.json", "config.yml");

// Convert string
const yamlString = ymlifyString('{"name": "value"}', "json");
console.log(yamlString);

// With options
ymlify("data.json", "data.yml", {
  indent: 4,
  lineWidth: 80,
  noRefs: true,
});

🎯 Supported Formats

  • JSON (.json) - JavaScript Object Notation
  • XML (.xml) - Extensible Markup Language
  • CSV (.csv) - Comma-Separated Values
  • TOML (.toml) - Tom's Obvious, Minimal Language
  • ENV (.env) - Environment Variables

🔧 API

ymlify(inputPath, outputPath?, options?)

Converts a file to YAML format.

  • inputPath (string): Path to the input file
  • outputPath (string, optional): Path to the output YAML file. Defaults to input filename with .yml extension
  • options (object, optional):
    • indent (number): Number of spaces for indentation (default: 2)
    • lineWidth (number): Maximum line width (default: -1, unlimited)
    • noRefs (boolean): Don't use anchors/references (default: true)
    • detectFormat (boolean): Auto-detect file format (default: true)

Returns: The output file path

ymlifyString(input, format, options?)

Converts a string to YAML format.

  • input (string): Content to convert
  • format (string): Format type ('json', 'xml', 'csv', 'toml', 'env')
  • options (object, optional): Same as above

Returns: YAML string

💡 Examples

Convert OpenAPI JSON to YAML

ymlify openapi.json openapi.yml

Convert XML configuration

ymlify config.xml

Convert CSV data

ymlify users.csv users.yml

Convert TOML settings

ymlify Cargo.toml

Convert ENV file

ymlify .env config.yml

Programmatic usage with TypeScript

import { ymlify, ymlifyString } from "ymlify";

// Convert a JSON file
const output = ymlify("./data.json");
console.log(`Created: ${output}`);

// Convert JSON string
const jsonStr = '{"server": {"port": 3000, "host": "localhost"}}';
const yaml = ymlifyString(jsonStr, "json");
console.log(yaml);

// Convert XML string
const xmlStr = "<config><port>3000</port></config>";
const yamlFromXml = ymlifyString(xmlStr, "xml");
console.log(yamlFromXml);

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

📄 License

MIT

🐛 Issues

Found a bug? Please report it at the issues page.