New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

pptx2json

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pptx2json

Parse a Powerpoint file to a Json.

latest
npmnpm
Version
0.0.10
Version published
Weekly downloads
17K
-26.79%
Maintainers
1
Weekly downloads
 
Created
Source

pptx2json

Node.js CI npm MIT License

Operating Powerpoint file (Microsoft Office 2007 and later) as Office Open XML without external tools, just pure Javascript.
Providing two main functions:

  • Parse from a PowerPoint file to Json
  • Parse from a Json to PowerPoint

The images, movies, audio files and so on in a PowerPoint are treated as binary.
This is strongly inspired from pptx-compose.

Installation

$ npm install pptx2json

Usage

Parse a PowerPoint file to Json

const PPTX2Json = require('pptx2json');
const pptx2json = new PPTX2Json();

const json = await pptx2json.toJson('path/to/pptx');

Rebuild a PowerPoint from Json

If you want to get a buffer below:

const PPTX2Json = require('pptx2json');
const pptx2json = new PPTX2Json();

const json = await pptx2json.toJson('path/to/pptx');
:
// return buffer to pptx 
const pptx = await pptx2json.toPPTX(json);

Otherwise want to write a file below:

const PPTX2Json = require('pptx2json');
const pptx2json = new PPTX2Json();

const json = await pptx2json.toJson('path/to/pptx');
:
// write pptx to the path 
await pptx2json.toPPTX(json, {'file': 'path/to/output.pptx'});

Get max id, rid in slides.

const PPTX2Json = require('pptx2json');
const pptx2json = new PPTX2Json();

const json = await pptx2json.toJson(testPPTX);
const ids = pptx2json.getMaxSlideIds(json);
// {'id': 5, 'rid': 3}

Get slideLayoutType Hash.

const PPTX2Json = require('pptx2json');
const pptx2json = new PPTX2Json();

const json = await pptx2json.toJson(testPPTX);
const table = pptx2json.getSlideLayoutTypeHash(json);
// {
//    'title': 'ppt/slideLayouts/slideLayout1.xml',
//    'blank': 'ppt/slideLayouts/slideLayout7.xml'
// }

Dependencies

Reference

Keywords

powerpoint

FAQs

Package last updated on 07 Jul 2024

Did you know?

Socket

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.

Install

Related posts