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 🙏

© 2024 – Pkg Stats / Ryan Hefner

factorio-blueprint-reader

v0.0.4

Published

Library for reading, creating and manipulating factorio blueprint strings

Downloads

5

Readme

UNDER CONSTRUCTION

Factorio blueprint reader

Factorio blueprint reader is a library that can read, create and manipulate factorio blueprints. It works both on node.js and browser.

Examples

const { Reader } = require('factorio-blueprint-reader');

// Reader also accepts legacy blueprints (prior to 0.15)
// To be consistent, Reader will always return a BlueprintBook
const blueprintBook = Reader.read(`
0eNqd0+FqwyAQAOB3ud8G1GZt5quMMUx7G4Ia8exoCHn3mqSUQV3b9Jeo5+cdxw3Q2iOGaHwCNYDZd55AfQxA5sdrO52lPiAoMAkdMPDaTTs8hYhEVYraU+hiqlq0CUYGxh/wBEqMnwzQJ5MMLuK86b/80bUYc8DVIqetrax2Ifuho/yk89PPmalyWJ8XOY7shpBPEfeEzaOCbhOSM8dLWv2qJkra23pNXDQGBxNxv1xtC/b2an9rSg9h/n/Nu9VZFpOUBbpZTfNn639fTd9pu+AvarnteUjmwVJ/5pDBL0Zacq9ruRMb3jT55zPpqj52
`);

console.log('Blueprint object:', blueprintBook.toObject());
console.log('Blueprint string:', blueprintBook.toString());

blueprintBook.forEach(blueprint => {
    // do something with the blueprint
});

const blueprint = blueprintBook.first();

console.log('Item requirements:', blueprint.requirements());
console.log('Raw ingredients:', blueprint.ingredients());
/**
 * More soon
 * /
const { Recipe } = require('factorio-blueprint-reader');

// Return the expensive recipe if possible
const expensive = true;

console.log(
    'Ingredients:', 
    Recipe.getIngredients('assembling-machine-2', expensive)
)

console.log(
    'Raw ingredients:', 
    Recipe.getRawIngredients('assembling-machine-2', expensive)
)

console.log(
    'Tree of required ingredients:',
    Recipe.getItemTree('assembling-machine-2', expensive)
)

Using in browser

If you're planning on using factorio blueprint reader in browser, all neccessary classes will be available under FBR variable.

    var Recipe = FBR.Recipe;
    var Reader = FBR.Reader;
    // etc ...

Installation

This library will be published on npm when the first stable version gets released. (soon tm)

Contributing

Pull requests and issues are welcome.
Before commiting or making pull requests, make sure the run the linter with npm run lint