Socket
Socket
Sign inDemoInstall

ocf-converter-sdk

Package Overview
Dependencies
9
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    ocf-converter-sdk

SDK for onlineconvertfree.com file conversion API


Version published
Weekly downloads
4
increased by300%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

ocf-converter-sdk for TypeScript

SDK for onlineconvertfree.com file conversion API.

Installation & Usage

Requirements

Node.js 16.15.1.

Install

npm install ocf-converter-sdk

Getting Started

Please follow the installation procedure and then start from the following:

import * as fs from 'fs';
import * as https from 'https';
import { OcfClient } from 'ocf-converter-sdk';

const apiKey = 'myApiKey';

const client = new OcfClient(apiKey);

const filePath = '/path/to/file/to/convert.png';
const extensionToConvertTo = 'pdf';

const task = await client.uploadFile(filePath, extensionToConvertTo);

const result = await task.waitForConversion();

if (result.isSuccess()) {
    const resultUrl = result.getResultingFileUrl() as string;

    https.get(resultUrl, (response => {
        const path = `${__dirname}/result.${extensionToConvertTo}`;
        const filePath = fs.createWriteStream(path);
        response.pipe(filePath);
        filePath.on('finish', async () => {
            filePath.close();

            await result.deleteFile();
        });
    }));
}

License

SDK is made available under the MIT License (MIT). Please see License File for more information.

Contribution

OpenAPI Typescript Codegen is used for the client generation.

Requirements

OpenAPI Typescript Codegen is required for the client generation.

Client generation

To regenerate the client do the following:

  • run generation command:
npm run api-codegen
  • reformat the generated code with your IDE.

Keywords

FAQs

Last updated on 16 Nov 2022

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc