All Questions
5,708
questions
0
votes
0
answers
20
views
How to convert array to geotiff
For the code posted below, I am trying to find the difference between two .tiff files. The .contents is the raster representation. I placed some logs inside the .map operator to check the result of ...
0
votes
1
answer
26
views
Need to fix for loop in etherjs
hi im a newbie and i have a problem with for loops. my code is here
async function claims(epoch) {
let epochs = [];
for (let i = 0; i < 10; i++) {
rounds = epoch - i;
const claimable = ...
0
votes
2
answers
74
views
Array not resetting in JavaScript while reading from stream
I am trying to insert data coming from a remote CSV file in MongoDB (using Mongoose).
I would like to do so in bulk inserts of 100 items at a time.
Here's my code:
import csv from 'csv-parser'
import ...
0
votes
0
answers
29
views
How to Batch and Timeout Tasks with RabbitMQ in Node.js?
I'm working on a project that interacts with the blockchain using Node.js and RabbitMQ. I need to implement a system where tasks are batched into an array before being sent to the blockchain. The ...
0
votes
0
answers
33
views
I can not pass an array to Airtable create method in Nodejs
I am trying to use Airtable for the first time. I want to simply create a record into a table in Airtable. The record is an array of objects. When I had the data as an object, it went through. But it ...
0
votes
0
answers
36
views
How to see if object is in a list [duplicate]
How do I in Node.JS check if a object like {idx: X, idy: y} in is in a list?
I've tried with .index and other things, but I think because it is a object with multiple values it fail.
My list has the ...
-2
votes
1
answer
36
views
Does the concept of Index is available for LinkedList in DSA?
Does LinkedList have index to get accessed, as how we have it for array??
If yes, please let me know how the index work in LinkedList concept??
Thanks
I am beginner with LinkedList and wanted to ...
1
vote
0
answers
66
views
Variables from buffer in nodejs
I am studying pure nodejs, no express, no fastify and other frameworks that's why I don't need npm mutler and file-upload.
I am sending 2-3 mp3 files and two txt files from a client side to a nodejs ...
1
vote
0
answers
39
views
How to replace/fill div values in the Table.Cell React
I have a React table and I want to load all general data on the loading. And data that is not already loaded, I want it to be stored like empty lines.
For example, I have a Table.Cell in the Table.Row ...
0
votes
1
answer
21
views
React dynamically fill the select component and pic one selected value on form submit
using hook forms, I want to submit form data with a select option for department and these department filled dynamically from the server
I have a select component with is picking my selected values ...
-3
votes
1
answer
90
views
Converting 2-column text file to key/value pairs [closed]
I am currently learning Node.js and Express. I'm trying to convert a text file into key-value pairs.
My staircase program works like this:
The provided text file looks like this (with 300 lines):
I ...
0
votes
1
answer
37
views
NodeJS Changing all Instances of an Array inside a Nest Object
I have nested array of objects with an array inside of each object.
const nestedArray = [ objectTemp{foo: "", lines: []} ] <---- simplified example of the nested array structure.
I am ...
1
vote
2
answers
92
views
Problem when performing a push to a nested array in mongodb and nodejs
I am having a problem when performing a push to a nested array, I am trying to add one or more objects within the nested array "fieldList", when I execute the push it tells me ok but when I ...
0
votes
0
answers
36
views
How to convert array of arrays to formatted Excel file in React.js/Node.js?
I have an array of arrays representing a table. It looks something like this -
[
["Name", "Age", "Description"],
["John Doe", "26", "<div ...
0
votes
1
answer
58
views
Convert object to buffer and buffer to object
Demo
const result = [
{ // This is sample data BUT there can be multiple objects
"name": "object1",
"id": "1",
...
-1
votes
1
answer
66
views
Issues with my Javascript code to parse files
I am currently working on implementing a JavaScript code that aims to read and parse some numpy .npy files generated from Python's numpy, specified by a JSON file. These .npy files contain arrays of ...
1
vote
2
answers
67
views
how to pass json array in params to get rest api in nodejs
I have one GET API which is having array in the input.
I want to call that API through in my node.js project.
I have tried many options but none worked.
This is my REST Request.
let request = await ...
0
votes
0
answers
50
views
X-Forwarded-For in the request-ip package potential bug
I was reading the request-ip code. (Link here) and I noticed that when dealing with the X-Forwarded-For part it is treated as if it will only be a string always. when in reality it's very possible ...
0
votes
1
answer
92
views
how to convert a string to array of object in nodeJS
Hi all I have one string which I need to convert in array of object in node JS.
as :
var result = "[{'path': '/home/media/fileyear.jpg', 'vectors': [0.1234, 0.457, 0.234]},
{'path': '/home/media/...
0
votes
1
answer
50
views
I am getting 'files are empty' with a 400 code
I am trying to upload images to strapi, what am I doing wrong here? am I putting the fileArrayForUpload in the wrong place? the fileArrayForUpload is not empty.
handleCreateSubmit:
const [...
-3
votes
1
answer
55
views
How do I add an object at a specific location in an array with multiple nested objects
This is my Object:
[
{
"id": "1709408412689",
"name": "WB1",
"children": [
{
"id": &...
0
votes
1
answer
34
views
Line breaks in the vscode terminal output, disturbing the view. when used more than 6 elements in an array [duplicate]
Line breaks in the Vscode terminal output, disturbing the view. when more than 6 elements are in an array.
const a1 = [2,14,4,3,6,9]
console.log(a1)
Results (Console):
[ 2, 14, 4, 3, 6, 9 ]
BUT
If ...
0
votes
2
answers
37
views
How can I check filenames to avoid pushing them into array?
I have this code in my node script
const fs = require('fs-extra');
const backupPath = path.join( __dirname , 'wp-backup');
const excludedResources = ['.DS_Store', 'dep.js', 'node_modules'];
const ...
0
votes
1
answer
151
views
Joi schema: dynamic allow/items validation - "Method no longer accepts array arguments"
I have the need to "extend"/use the schema.items()/schema.allow() with a array, where items can be added.
const Joi = require("joi");
const allow = ["foo", "bar&...
1
vote
3
answers
67
views
Why is node not allowing a For loop?
I was trying to use a for loop to loop through an array of string and then use the string id_Arr[i] as a link partial to call an API. In regular JS/Angular all works well but in node the requests gets ...
1
vote
1
answer
162
views
how to add items into array in node js with mongodb?
i'm writing a bot that is able to randomly pick out a card from a .json file i have, and should add it into the user's card inventory. each card comes with it's own unique code. if the user had the ...
1
vote
4
answers
81
views
Combining relevant data in two different arrays
Can you help on how to combine data in two different arrays with different structures?
I take data via API, the first request:
[
{
"category_id": "12345",
"...
2
votes
1
answer
75
views
add data to an array within other arrays with a recursive function
I'm trying to add data to an element which inside it has an array, and that array others, and so on consecutively. I made a function to be able to traverse the entire element until finding the one I'm ...
0
votes
3
answers
91
views
Map function not returning all the arrays
So here I am trying to map through multiple arrays, and return all the data related to it. But only the first array is getting returned.
The strange thing here is that when I try console logging the ...
0
votes
0
answers
20
views
Retrieving data to an array returns empty [duplicate]
I created a simple application using Node, React and Mongo. When I try to retrieve the data from Mongo, the array to which I'm trying to populate the data returns an empty array.
Adding Data works ...
1
vote
1
answer
61
views
Updating object in deeply nested arrays mongoose
{
"_id": "659e76b929be316e566cdc36",
"main_array": [
{
"_id": "659e76b929be316e566cdc39",
"sub_array": [
[
...
0
votes
0
answers
78
views
Pass array from html to javascript
I'm trying to create a carousel so I can click through each element in csv file:
In a routes/index.js file I'm reading a csv file with film data in an array, and then loading this into the index.ejs ...
0
votes
1
answer
49
views
How do I read object properties in EJS?
I have an express server that has an API to fetch food items.
I have an ejs index file that I want to display the names of food.
In server.js I am fetching it like this
app.get('/', async (req, res) =&...
0
votes
1
answer
243
views
How to do custom order by string using sequelize
How to do custom order by using sequelize
I need to sort array of objects retrieved from db as ACTIVE, PENDING, INACTIVE
How to do using sequelize
Tried
sortOrder = [[Sequelize.literal(`CASE WHEN ...
0
votes
0
answers
34
views
I'm using mongoose in my Node JS project and I need to move an object from a certain array to another array
I have a collection in my database with the following data structure demonstrated in the code below. Basically, it is an array of lists and each list has its own array. I am currently using Node JS ...
0
votes
1
answer
92
views
How do I display an array that I have created in NodeJS in HTML?
Ok, so I am fairly new to this stuff so I'll try to be as cohesive as I can with my problem.
I have created a simple web scraper using NodeJS, Express and Axios. This web scraper scrapes text from a ...
-1
votes
1
answer
78
views
Node JS: evaluate value inside array of objects
I have data that looks like this
[
[ '@test','1.2.6' ],
[ '@test2','4.0.1' ],
[ '@test3','2.2.0-unstable' ],
...
]
and I would like to retrieve all the values that have appended -unstable and ...
2
votes
1
answer
124
views
Array update or add as new
I just want to update array value with matching value or add as new
Schema
imgs : ["imgPath1" , "imgPath2" , "imgPath3" ]
I tried with this code but not working
let ...
0
votes
1
answer
117
views
How do I generate Scratch Card Algorithm on NodeJS?
Greetings to everyone,
There is a game frequently played in Turkey. Its name is Scratch.
The rules of the game are as follows:
If the same three numbers appear in any matrix (3x3, 4x4, 4x3), that ...
1
vote
1
answer
50
views
Existing field of type array is not recognized by the mongodb operator "$in"
I am trying to do an aggregate query in mongodb but the "$in" operator says that the field I pass it is not recognized as an array.
here is my aggregate query.
[
{
'$match': {
'...
1
vote
1
answer
84
views
How to Handle complex payload in Node js FormData
I have the following JSON format which i need to send and save to DB.
[
{
"title": "Tilte",
"content": "Lorem Ipsum is simply dummy text of the printing ...
-1
votes
1
answer
100
views
Undefined Node.js filepath
I'm a bit of a novice at JavaScript coding in the Visual Studio Code script editor.
I'm trying to read in a .txt file as an array.
Below is my code:
const fs = require('fs');
function readFile(...
0
votes
1
answer
76
views
Modifying a array with two array of objects
I have two different arrays of objects. One array represents all the system modules while the other displays modules the user can access.
This is my full response currently I'm getting - https://...
-1
votes
1
answer
43
views
Is there any way for Node.js Double Quoted json array
I am writing an app for subtitle translate. But i have a problem. I will use Microsoft Translater Text Api and this api requires this type of request body;
Request body
The body of the request is a ...
0
votes
1
answer
98
views
In Node how to merge an array of objects into a new array where each object name has it's values in an array of strings?
I have an array of objects that looks like:
const arr = [
{
"name": "Day",
"value": "Monday"
},
{
"name": "...
0
votes
1
answer
68
views
How to make discord fetch faster for usernames for multiple users with discord.js
Here's my code:
const memberGroup = ["801555002664419350", "801555002664419351", "801555002664419352", "801555002664419353", "801555002664419354", &...
0
votes
3
answers
99
views
How to store multiple integers in an array from one prompt?
I cannot figure out how to store multiple integers in an array from one prompt
like
const prompt = require('prompt-sync')();
num_array = []
num_array.push(prompt("Enter x amount of integers: &...
0
votes
0
answers
28
views
How do i fix a typeError when using node.js to connect to Mongo db and is my code correct?
I have a database called Exams and inside Exams is a document called Math_Exams so I am trying to store that in an array but my connection to the database does not work and this error appears after ...
-1
votes
3
answers
86
views
Want to find the amount of unique and duplicate objects from an array and list them in a specific way
[
{ "id":5,
"name": "banana"
},
{ "id":5,
"name": "banana"
},
{ "id":4,
"name": "apple"
},
{ &...
0
votes
1
answer
24
views
Attempting to increase the counter, when the object's tag exist
In the following code I want to achieve, that whenever the tag value is new, it should be added to an Array. If the tag does not exist, the object comprising the tag and the counter will be added. ...