Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

doctrack

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

doctrack

Library for injecting tracking (spy) pixel url into Office Documents (Office Open XML)

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
decreased by-57.14%
Maintainers
1
Weekly downloads
 
Created
Source

Doctrack

Actions Status Coverage

Library for injecting tracking (spy) pixel url into Office Documents (Office Open XML).

Support formats:

  • docx
  • docm
  • dotm
  • dotx
  • xlsx
  • xlsm
  • xltm
  • xltx
npm i doctrack -S

Example

import { DocTrack, Docx, Docm, Dotm, Dotx, Xlsx, Xlsm, Xltm, Xltx } from 'doctrack';

const inputFilePath = './input.docx';
const outputFilePath = './output.docx';
const trackingPixelUrl = 'http://localhost:5001/tracking';

// xlsx - new Xlsx, docm - new Docm and etc
const doctrack = new DocTrack(new Docx(inputFilePath), trackingPixelUrl);

// Write result document to file
await doctrack.writeResultToFile(outputFilePath);

After open result document (output.docx) with office editor will be requested url: http://localhost:5001/tracking.

Input data

You can pass input file as buffer, stream or file:

import fsPromise from 'node:fs/promises';

// As file
const doctrack = new DocTrack(new Docx('./input.docx'), trackingPixelUrl);

// As Buffer
const fileBuffer = await fsPromise.readFile('./input.docx');
const doctrack = new DocTrack(new Docx(fileBuffer), trackingPixelUrl);

// As Stream
const fileStream = fs.createReadStream('./input.docx');
const doctrack = new DocTrack(new Docx(fileStream), trackingPixelUrl);

Output data

You get result file as buffer, stream or file:

// Write result document to file
await doctrack.writeResultToFile('./output.docx');

// Write result document to buffer
const buffer = await doctrack.writeResultToBuffer();

// Write result document to stream
const stream = await doctrack.writeResultToStream();

Keywords

FAQs

Package last updated on 04 Jun 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc