node.js

connect-busboy on('file') event not firing

和自甴很熟 提交于 2021-02-20 04:46:26
问题 I'm having issues with uploading files. I have the following code: App.js var bodyParser = require('body-parser'); var busboy = require('connect-busboy'); app.use(bodyParser.urlencoded({extended: false})); app.use(bodyParser.json()); app.use(busboy({immediate: true, limits: {fileSize: 25 * 1024 * 1024}})); Attachments.js router.post('/:table/:id', function (req, res) { req.busboy.on('file', function (fieldname, file, filename, encoding, mimetype) { //Do stuff.. }); }); The 'file' event is not

How to disconnect all connection on a session?

那年仲夏 提交于 2021-02-20 04:25:25
问题 I wanna to disconnect all connection on a session from server but i just find how to dissconnect a connection by using forceDisconnect. Besides, I wanna destroy session when all connection disconnected and destroy token when a connection disconnected 回答1: Opentok SDET here, You can use forceDisconnect , if you want to trigger the disconnection from a single point, or use disconnect and capture StreamDestroyed events in remote peers, to act accordingly. Regarding sessions, you don't need to

How to disconnect all connection on a session?

淺唱寂寞╮ 提交于 2021-02-20 04:25:05
问题 I wanna to disconnect all connection on a session from server but i just find how to dissconnect a connection by using forceDisconnect. Besides, I wanna destroy session when all connection disconnected and destroy token when a connection disconnected 回答1: Opentok SDET here, You can use forceDisconnect , if you want to trigger the disconnection from a single point, or use disconnect and capture StreamDestroyed events in remote peers, to act accordingly. Regarding sessions, you don't need to

I have used “cors” but I found “Access to XMLHttpRequest has been blocked”. Why?

ε祈祈猫儿з 提交于 2021-02-20 03:41:42
问题 I have an express API running and when I make a request I get this message. Error: Access to XMLHttpRequest at 'http://localhost:9000/api/courses' from origin 'http://localhost:4222' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. I am using cors in my API here is my code: import * as express from 'express'; import {Application} from "express"; import {getAllCourses, getCourseById} from "./get-courses.route"; import {searchLessons

I have used “cors” but I found “Access to XMLHttpRequest has been blocked”. Why?

假装没事ソ 提交于 2021-02-20 03:41:27
问题 I have an express API running and when I make a request I get this message. Error: Access to XMLHttpRequest at 'http://localhost:9000/api/courses' from origin 'http://localhost:4222' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. I am using cors in my API here is my code: import * as express from 'express'; import {Application} from "express"; import {getAllCourses, getCourseById} from "./get-courses.route"; import {searchLessons

writing text on image with npm node-canvas in custom language

你说的曾经没有我的故事 提交于 2021-02-20 03:39:40
问题 I am trying to write on image with hindi language. I am using node-canvas library. There is some problem with my output. Can someone help me ? const { createCanvas, loadImage, registerFont} = require('canvas') const canvas = createCanvas(400, 400) const ctx = canvas.getContext('2d') var str= "यह. मिसिसिपी है"; console.log(str); loadImage('missisippi.jpg').then((image) => { console.log(image); ctx.drawImage(image, 0 , 0, 400, 400); ctx.fillText(str,100,40); var body = canvas.toDataURL(),

writing text on image with npm node-canvas in custom language

萝らか妹 提交于 2021-02-20 03:38:32
问题 I am trying to write on image with hindi language. I am using node-canvas library. There is some problem with my output. Can someone help me ? const { createCanvas, loadImage, registerFont} = require('canvas') const canvas = createCanvas(400, 400) const ctx = canvas.getContext('2d') var str= "यह. मिसिसिपी है"; console.log(str); loadImage('missisippi.jpg').then((image) => { console.log(image); ctx.drawImage(image, 0 , 0, 400, 400); ctx.fillText(str,100,40); var body = canvas.toDataURL(),

writing text on image with npm node-canvas in custom language

好久不见. 提交于 2021-02-20 03:37:27
问题 I am trying to write on image with hindi language. I am using node-canvas library. There is some problem with my output. Can someone help me ? const { createCanvas, loadImage, registerFont} = require('canvas') const canvas = createCanvas(400, 400) const ctx = canvas.getContext('2d') var str= "यह. मिसिसिपी है"; console.log(str); loadImage('missisippi.jpg').then((image) => { console.log(image); ctx.drawImage(image, 0 , 0, 400, 400); ctx.fillText(str,100,40); var body = canvas.toDataURL(),

node.js - Archiving folder using archiver generate an empty zip

佐手、 提交于 2021-02-20 02:59:29
问题 I am trying to archive a folder using archiver, the path of the folder that i'd like to archive look like this : Project | app.js | tmp | folderToArchive │file1.txt │file2.txt │file3.txt my server side code where the zip file will be generated look like this : var archiver = require("archiver"); app.get("/download/:folder", (req, res) => { var FolderName = req.params.folder; var zipName = FolderName + ".zip"; var source = path.join(__dirname, "tmp", FolderName); var out = path.join(__dirname,

node.js - Archiving folder using archiver generate an empty zip

∥☆過路亽.° 提交于 2021-02-20 02:59:07
问题 I am trying to archive a folder using archiver, the path of the folder that i'd like to archive look like this : Project | app.js | tmp | folderToArchive │file1.txt │file2.txt │file3.txt my server side code where the zip file will be generated look like this : var archiver = require("archiver"); app.get("/download/:folder", (req, res) => { var FolderName = req.params.folder; var zipName = FolderName + ".zip"; var source = path.join(__dirname, "tmp", FolderName); var out = path.join(__dirname,