Categories
Mastering Development

NodeJs : How to zip multiple URL files without file extensions?

We are trying to zip multiple URL files using zip-stream from Orthanc PACS server, it provides a URL to download the DICOM files, but the URL does not contain the file extension, but file downloads fine at browser. how can we get this file as Buffer in NodeJs? the direct file (with extension) is getting […]

Categories
Mastering Development

How do I return a file-stream from buffer?

I have stored my image, it’s size in bytes and its type on a mysql db. When I fetch it I am getting back a buffer for the image and now Im trying to figure out how to send it back to my client so that it renders the image? Code inside of my route: […]

Categories
Mastering Development

Nodejs pdfjs-dist: Unable to catch Bad end offset

I am implementing pdfjs-dist to extract text from pdf documents and I am encountering the above error for selected pdfs. When this error occurs, I would like to catch it and handle it accordingly but my implementation so far hasn’t been successful in catching this error. As a result, it has been crashing my Firebase […]

Categories
Development

Linkedin api V2 upload a video in node JS

I’m looking for uploading in node JS a video throught the linkedin API V2 , butI’m still receiving a status code 403. I correctly followed the steps in the documentation. (https://docs.microsoft.com/en-us/linkedin/marketing/integrations/community-management/shares/vector-asset-api#register-an-upload-for-video) let req = request(`https://assets.mixkit.co/videos/2125/2125-720.mp4`) .pipe(fs.createWriteStream(‘video.mp4’)); req.on(‘close’, ()=>{ request({ url: uploadUrl, method: ‘POST’, headers: { “x-amz-server-side-encryption-aws-kms-key-id”: “MY_ID”, “x-amz-server-side-encryption”: “aws:kms”, “Content-Type”: “application/octet-stream” }, encoding: null, body: […]

Categories
Development

discord bot not playing the music stream (playStream) (typescript)

It does everything perfectly until the point it’s supposed to play (line with playStream). import { BaseCommand } from “../BaseCommand”; import { Message } from “discord.js”; import { SnowcaloidClient } from “../../client/SnowcaloidClient”; import { getParameters } from “../../utils”; import * as ytdl from “ytdl-core”; export class Play extends BaseCommand { constructor(client: SnowcaloidClient) { super(client); this.name […]

Categories
Development Facebook Social Media

How to upload local image to facebook

I managed to upload an image to facebook using online URL but, when I try a local image using format file://path/to/imageI get the error {“error”:{“message”:”(#100) url should represent a valid URL”,”type”:”OAuthException”,”code”:100} is it doable ? or am doing it wrong ? async function upload_fb_image(photo) { return new Promise(resolve => { FB.api(PAGE_ID + ‘/photos’, ‘post’, { […]

Categories
Development

Passing a Text Stream from NodeJS to Browser

I am trying to stream a text file processed in NodeJS to a browser. The following is the text file before processing. The file is named dbUsers.json. {“userId”:443,”email”:”bob@gmail.com”,”hashedPassword”:”36583a77a098c02ef111e2f2521d77b58e420f2bc7e9bf930ec24b21d42ea2e0″,”timeStamp”:1567439821109,”deleted”:false} {“userId”:447,”email”:”alice@gmail.com”,”hashedPassword”:”36583a77a098c02ef111e2f2521d77b58e420f2bc7e9bf930ec24b21d42ea2e0″,”timeStamp”:1567439909013,”deleted”:false} {“userId”:451,”email”:”cliff@gmail.com”,”hashedPassword”:”36583a77a098c02ef111e2f2521d77b58e420f2bc7e9bf930ec24b21d42ea2e0″,”timeStamp”:1567443638340,”deleted”:false} … After processing I am able to stream the data to a new file on the NodeJS server with the following commands: // Create a […]