Skip to content

A simple node module for reading SWF format

License

Notifications You must be signed in to change notification settings

Javran/swf-extract

Repository files navigation

SWF Extract

Extract resources from SWF files.

For now this project aims at extracting image data from SWF files. More things would be implemented in future.

Installation

$ npm install swf-extract

Usage

const {readFromBufferP, extractImages} = require('swf-extract')

// `rawData` could come from file, network, etc.
// as long as it end up being a Buffer.
const rawData = fs.readFileSync(<path-to-your-file>)

(async () => {
  const swf = await readFromBufferP(rawData)
  // the result of calling `extractImages` resolves to an Array of Promises
  const ts = await Promise.all(extractImages(swf.tags))
  console.log(ts)
})()

Acknowledgement

This project cannot be possible without work from the following 3 packages:

The original author is Rafael Leal Dias, who works out most of the parsing logics. Then it's modified & improved by Gizeta to include many supports and bug fixes, who is also the author of swf-image-extractor, which provides the original implementation of image extraction from SWF files.

License

MIT