
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
DXF parser for node/browser.
Uses several ES6 features in the source code (import, classes, let, const, arrows) but is packaged using babel so you can use it in legacy JS environments.
Version 2.0 is a complete rewrite from the first attempt to write it in a SAX style, which wasn't really appropriate for a document with nested references (e.g inserts referencing blocks, nested inserts).
Version 3.0 converted the codebase to use standard JS, ES6 imports, stopped using Gulp, and updated & removed some dependencies.
Version 4.x is in progress and the aim is to use native SVG elements where possible, e.g. <circle />, <ellipse /> etc. 4.0 introduces the <circle /> element.
At this point in time, the important geometric entities are supported, but notably:
and some others are parsed, but are not supported for SVG rendering (see section below on SVG rendering)
There is an ES5 and ES6 example in the examples/ directory that show how to use the library. There are exposed functions for advanced users, but for the majority of users you can use the Helper object to get the data you're interested in (or convert to SVG):
const helper = new Helper(<DXF String>)
// The 1-to-1 object representation of the DXF
console.log('parsed:', helper.parsed)
// Denormalised blocks inserted with transforms applied
console.log('denormalised:', helper.denormalised)
// Create an SVG
console.log('svg:', helper.toSVG())
// Create polylines (e.g. to render in WebGL)
console.log('polylines:', helper.toPolylines())
Node ES5. Will write an SVG to examples/example.es5.svg:
$ node examples/example.es5.js
Node ES6. Will write an SVG to examples/example.es6.svg:
$ npx babel-node examples/example.es6.js
Browser. Compile to a browser bundle and open the example webpage:
$ npm run compile
$ open examples/dxf.html
Geometric elements are supported, but dimensions, text, hatches and styles (except for line colors) are not.
Native SVG elements are used as far as possible for curved entities (<circle />, <ellipse/> etc.), except for the SPLINE entity, which is interpolated.
Here's an example you will find in the functional test output:

The library supports outputting DXFs as interpolated polylines for custom rendering (e.g. WebGL) or other applications, by using:
> helper.toPolylines()
There is a command-line utility (courtesy of @Joge97) for converting DXF files to SVG:
$ npm i -g dxf
$ dxf-to-svg
Usage: dxf-to-svg [options] <dxfFile> [svgFile]
Converts a dxf file to a svg file.
Options:
-V, --version output the version number
-v --verbose Verbose output
-h, --help output usage information
Running
$ npm test
will execute the unit tests.
$ npm run test:functional will run the functional tests in a browser. Please open toSVG.html when the file listing loads in the browser (or open http://localhost:8030/toSVG.html#/).
FAQs
DXF parser for node/browser
The npm package dxf receives a total of 6,677 weekly downloads. As such, dxf popularity was classified as popular.
We found that dxf demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.