Forge SVF Extractor in Node.js

July 10, 2017

Extracting SVF format to download viewer resources locally seems to be a pretty popular topic among Forge developers. Cyrille's extractor has been around for a while now:

You can look up its source code at, more specifically the part of the server code that is performing the extraction is available there: bubble.js

However when I tried to integrate that in my own application, I found it difficult to read and to decouple from some other dependencies in that project.

It took me a couple of days to work out the code below, so I hope you will find it useful: It's a clean rewrite of bubble.js in ES6, using promises and async code with no internal dependency to the project.  

Here is an example of use:

// name of model to download
const name = 'MyForgeModel'

// URN of model to download
const urn = 'dXGhsujdj .... '

// Get Forge service
const forgeSvc = ServiceManager.getService(

// getToken async function
const getToken = () => forgeSvc.get2LeggedToken()

// Get Extractor service
const extractorSvc = ServiceManager.getService(

// target path to download SVF
const dir = path.resolve(__dirname, `${name}`)

// perform download
const files = await
  getToken, urn, dir)

// target zipfile
const zipfile = dir + '.zip'

// zip all files
await extractorSvc.createZip(
  dir, zipfile, name, files)

// remove downloaded resources directory

You can also test that live in the gallery section of my sample at

Upload your model and hit "Download SVF"

Download SVF on the forge-rcdb Gallery


Posts by author

Philippe Leefsma
Cloud Fellow

I write JavaScript for the future 3D World Wide Web, A.K.A Forge Platform