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

3dstojs

v0.1.0

Published

nodejs module to parse 3D Studio (.3ds) files to javascript and/or JSON

Downloads

25

Readme

3dstojs

A nodejs module to parses 3D Studio (.3ds) files to javascript or JSON.

Overview

Parse 3D Studio file (.3ds) to a javascript object or JSON.

Option to save the parsed data to a JSON file or break down the data to segments and save each segment to it's own JSON file (Materials, Objects/Mesh, Key Framer, etc...).

Due to .3ds file specifications not being public this parse does not parse everything in a .3ds file. To help with unknown chunks logs can be created during parsing and configured to capture unparseable to help update parsing ability.

Installation

npm install 3dstojs

Usage:

Returns a js object.

var parser = require("3dstojs");
var data = parser.parse("C:/3d/models/sample.3ds");

Returns a JSON string.

var parser = require("3dstojs");
var jsonStr = parser.parseToJson("C:/3d/models/sample.3ds");

Note: Both parse() and parseToJson() are synchronous calls

Methods

Parse - Takes in a filepath and optional options object. Returns a js objected of the parsed data. Options to save JSON and log information to a file. For options See below

parse(file, [options])

ParseToJson - Takes in a filepath and optional options. Returns a JSON string of the parsed data. Options to save JSON and log information to a file. For Options see below.

parseToJson(file, [options])

Help - Writes help text to the console. Same content as what is found in the "Options" section below.

help()

Parameters

These are the parameters for methods...

parse(file, options) and parseToJson(file, options)

file - - full path to the .3ds file."); options - - flags for events such as logging, saving to JSON files, etc...

Options

Is a js object that contains configurations for logging, saving JSON files, etc...

saveJson - bool (default: false) - flag to save parsed object to a JSON file. saveOptions - object - Contains the following properties for saving to files (JSON, log, etc...)  path - string (default: string directory of 3ds file.) - Location to save files.  jsonPerItem - bool (default: false) - Save objects as separate JSON files.  unparsedToFile - bool (default: false) - Saves the unparsable chunk to a file. logging - bool (default: false) - Creates a log file of parsing events. logOptions - object - Contains the follow flags on what is to be logged.  read - bool (default: true) - Logs header chunks read from the file.  parsing - bool (default: true) - Logs parsing of identifiable chunks.  unparsed - bool (default: true) - Logs identifiable ids but not enough info to parse.  unknown - bool (default: true) - Logs unknown chunk ids.  jumping - bool (default: false) - Logs any position movement in the read file.  files - bool (default: true) - Logs the json files saved to disk. verbose - bool (default: false) - Prints the parsing progress and stats to the console. verboseOptions - object - Contains the follow flags on what to write to the console.  onlyStats: bool (default: false) - Shows only the stats on completion. trackUnparsed - bool (default: false) - returns an object

Default Option object if the options parameter is omitted...

options = {
  saveJson: false,
  saveOptions:{
    path: '<directory of 3ds file>',
    jsonPerItem: false,
    unparsedToFile: false
  },
  logging: false,
  logOptions:{
    read: true,
    parsing: true,
    unparsed: true,
    unknown: true,
    jumping: false,
    files: true
  },
  verbose: false,
  verboseOptions:{
    onlyStats: false
  },
  trackUnparsed: false
}

Notes

Since the .3ds file format isn't publicly available this parser might not parse all data in your .3ds file. If you feel like not all of the data in the file was parse; use the options parameter to help figure out what chunks were not parsed.

The best option setup for unparsed/unkown chunks:

var options = {
  saveToJson: true,
  saveOptions: {
    unparsedToFile:true
  },
  logging: true,
  logOptions: {
    unparsed: true,
    unknown: true
  }
}

License

MIT