A simple node module for reading SWF format.
$ npm install swf-readervar SWFReader = require('swf-reader');
SWFReader.read( 'swf_path.swf', function(err, swf) {
if ( err ) {
// handle error
...
}
console.log(swf);
});Returns a SWF Object to callback function. If it's not possible to read the SWF, an error object is passed as the first argument of callback.
Returns a SWF Object to the caller. If it's not possible to read the SWF, an Exception is thrown.
The file parameter of both methods may be either a file path or a buffer of the SWF file.
The SWF Object method has the following properties :
version: The SWF version.fileLength: An Object containing the following properties :compressed: The SWF compressed size in bytes.uncompressed: The SWF uncompressed size in bytes.
frameSize: An Object containing thewidthandheightof the SWF.frameRate: The SWF framerate.frameCount: Number of frames in the SWF.backgroundColor: The background color of the SWF in the format#XXXXXX.fileAttributes: FileAtributtes defines characteristics of the SWF file.useNetwork: Iftrue, the SWF file is given network file access when loaded locally.as3: Iftrue, the SWF uses ActionScript 3.0. Otherwise it uses ActionScript 1.0 or 2.0.hasMetaData: Iftrue, the SWF file contains the Metadata tag.useGPU: Iftrue, the SWF file uses GPU compositing features when drawing graphics.useDirectBlit: Iftrue, the SWF file uses hardware acceleration to blit graphics to the screen.
metadata: The metadata describes the SWF file to and external process.tags: An array oftag. Each item in the array is an object with aheaderproperty with the folowing properties:code: A number indicating the type of the tag. (see SWF format for more information)length: The length of the tag in bytes.
To run the test invoke the following command within the repo directory :
$ npm test- Read tags fields.
- Write in tags block.
Author: Rafael Leal Dias
MIT