New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

nexusflow

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

nexusflow

Library for uploading and downloading files from Firebase Storage.

  • 4.6.2
  • latest
  • Source
  • npm
  • Socket score

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

Nexusflow

Nexusflow adalah library Node JS untuk mempermudah upload file menggunakan firebase storage.

Instalasi

Nexusflow membutuhkan Node.js v4+ untuk berjalan.

Install dependencies dan devDependencies dan jalankan server.

$ npm install nexusflow

Cara Penggunaan

Melakukan configurasi pada file app.js, dan contoh kode untuk mengambil list file di storage.

Development Menggunakan File

const nexusflow = require('nexusflow');

const app = new nexusflow().ConnectionApp({
  apiKey: // API KEY,
  authDomain: // AUTH DOMAIN,
  projectId: // PROJECT ID,
  storageBucket: // STORAGE BUCKET,
  messagingSenderId: // MESSAGING SENDER ID,
  appId: // APP ID,
  measurementId: // MEASUREMENT ID,
});

const main = async () => {
    try {
        const result = await app.getFiles();

        console.log(result);
    } catch (error) {
        console.log("Error: ", error.message);
    }
};

main();

Mengambil link file berdasarkan path file yang di upload.

const nexusflow = require('nexusflow');

// Connection App

const main = async () => {
    try {
        const result = await main.getLinkFilesByPath({
            path: 'example.txt'
        });
        
        console.info(result);
    } catch (error) {
        console.log("Error: ", error.message);
    }
};

main();

Get Buffer Files Path

Mengambil buffer file berdasarkan path file yang di upload.

const nexusflow = require('nexusflow');

// Connection App

const main = async () => {
    try {
     const result = await main.getBufferFileByPath({
        path: 'example.txt'
     });
     
     console.info(result);
    } catch (error) {
       console.info(error.message);
    }
};

main();

Upload File Menggunakan Buffer

Upload file ke dalam firebase menggunakan buffer.

const nexusflow = require('nexusflow');

// Connection App

const main = async () => {
    try {
     const nameFile = 'example.txt';
     const file = await fs.readFileSync(nameFile);
     const stat = await fs.statSync(nameFile);
     
     const result = await main.uploadFile({
        path: 'example.txt',
        file: file,
        size: stat.size, 
        maxSizeMb: 3
     });
     
       console.info(result);
    } catch (error) {
       console.info(error.message);
    }
};

main();

Update File Berdasarkan Path

Update file berdasarkan path file yang di upload.

const nexusflow = require('nexusflow');

// Connection App

const main = async () => {
    try {
     const nameFile = 'example.txt';
     const file = await fs.readFileSync(nameFile);
     const stat = await fs.statSync(nameFile);
     
     const result = await main.updateFile({
        path: 'example.txt',
        file: file,
        size: stat.size,
        maxSizeMb: 3,
        oldFile: 'file.txt'
     });
     
      console.info(result);
    } catch (error) {
       console.info(error.message);
    }
};

main();

Delete File Berdasarkan Path

Delete file berdasarkan path file yang di upload.

const nexusflow = require('nexusflow');

// Connection App

const main = async () => {
     try {
        const result = await main.deleteFile({
           nameFile: 'example.txt',
        });

        console.info(result);
     } catch (error) {
        console.info(error.message);
     }
};

main();

Development Menggunakan Media

const nexusflow = require('nexusflow');

const app = new nexusflow().ConnectionApp({
  apiKey: // API KEY,
  authDomain: // AUTH DOMAIN,
  projectId: // PROJECT ID,
  storageBucket: // STORAGE BUCKET,
  messagingSenderId: // MESSAGING SENDER ID,
  appId: // APP ID,
  measurementId: // MEASUREMENT ID,
});

const main = async () => {
    try {
        const result = await app.getMedia();

        console.log(result);
    } catch (error) {
        console.log("Error: ", error.message);
    }
};

main();

Mengambil link media berdasarkan path media yang di upload.

const nexusflow = require('nexusflow');

// Connection App

const main = async () => {
    try {
        const result = await main.getLinkMediaByPath({
            path: 'example.png'
        });
        
        console.info(result);
    } catch (error) {
        console.log("Error: ", error.message);
    }
};

main();

Get Buffer Media Path

Mengambil buffer media berdasarkan path media yang di upload.

const nexusflow = require('nexusflow');

// Connection App

const main = async () => {
    try {
     const result = await main.getBufferMediaByPath({
        path: 'example.png'
     });
     
     console.info(result);
    } catch (error) {
       console.info(error.message);
    }
};

main();

Upload Media Menggunakan Buffer

Upload media ke dalam firebase menggunakan buffer.

const nexusflow = require('nexusflow');

// Connection App

const main = async () => {
    try {
     const nameFile = 'example.png';
     const file = await fs.readFileSync(nameFile);
     const stat = await fs.statSync(nameFile);
     
     const result = await main.uploadMedia({
        path: 'example.png',
        file: file,
        size: stat.size,
        maxSizeMb: 3
     });
     
       console.info(result);
    } catch (error) {
       console.info(error.message);
    }
};

main();

Update Media Berdasarkan Path

Update media berdasarkan path media yang di upload.

const nexusflow = require('nexusflow');

// Connection App

const main = async () => {
    try {
     const nameFile = 'example.png';
     const file = await fs.readFileSync(nameFile);
     const stat = await fs.statSync(nameFile);
     
     const result = await main.updateMedia({
        path: 'example.png',
        file: file,
        size: stat.size,
        maxSizeMb: 3,
        oldFile: 'file.png'
     });
     
      console.info(result);
    } catch (error) {
       console.info(error.message);
    }
};

main();

Delete Media Berdasarkan Path

Delete media berdasarkan path media yang di upload.

const nexusflow = require('nexusflow');

// Connection App

const main = async () => {
    try {
      const result = await main.deleteMedia({
         nameFile: 'example.png',
      });

      console.info(result);
    } catch (error) {
      console.info(error.message);
    }
};

main();

Keywords

FAQs

Package last updated on 01 Jan 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