Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jun 02 06:16
    @ljharb banned @frank-dspeed
  • Apr 27 2018 01:23
    @MylesBorins banned @fjeddy
  • Feb 24 2016 08:26
    @rvagg banned @jonathanenbe
Jordan Harband
@ljharb
no, the registry is largely immutable. https://unpkg.com/browse/electron@6.1.2/ exists jut fine
Jakub Barczyk
@jakubbarczyk
Hi everyone, I've noticed here https://docs.npmjs.com/cli/v7/commands/npx#compatibility-with-older-npx-versions a typo in the --parseable --> should be --parsable right?
Jordan Harband
@ljharb
why would it be that?
the english word is "parseable", not "parsable"
Jakub Barczyk
@jakubbarczyk
@ljharb alright then ^__^ brain fart I guess.
Romil
@theromie
I am trying to download a file to react from the server which is in node js. Nodejs send response in createReadStream pipe() and in react I am sending AXIOS request with responseType to blob but after download file I am getting when opening file with Failed to load PDF
//React Code
await axios
      .get(`URL`, {
        responseType: 'blob',
      })
      .then(res => {
        setDownloadLoader(-1);
        fileDownload(res.data, fileName, fileType);
      })
      .catch(err => {
        console.log(err);
        setDownloadLoader(-1);
        const msg = (err && err.response && err.response.statusText) || 'Something went wrong';
        notify.show(`Opps! ${msg}`, 'error', 1500);
      });

//Nodejs

res.setHeader(
        'Content-disposition',
        `attachment; filename=${fileBaseName}`,
      );
      res.setHeader('Content-type', 'none');
      const stats = fs.statSync(filePath);
      res.setHeader('Content-Length', stats.size);

      const filestream = fs.createReadStream(filePath);
      filestream.pipe(res);
Romil
@theromie
const filePath = `./11162020115809Test.pdf`;
  if (fs.existsSync(filePath)) {
}
always returns false even file is present
Jordan Harband
@ljharb
@theromie fs.existsSync(path.join(__dirname, filePath))?
Isheke Peter
@peterishek
Hey guys I'm looking to hire blockchain developers and a software programmer. Please anyone interested can DM me
Guilherme C. Souza
@GCSBOSS
Hello! Anyone there ever worked with HTTPS server's SNICallback? I wanted to know when precisely it's called. I can see it's not in EVERY request. So I'm guessing only the first request for a given domain and after that it repeats the secure context. Does it account any expiry time at all? Thanks for your time.
Mile Mijatović
@mijatovicmile
Hello
How to properly show schema validation message in postman ?
Example
const userSchema = new Schema({
  email: {
    type: String,
    unique: true,
    validate: {
      validator: validateEmail,
      message: 'Unesite ispravnu e-mail adresu'
    },
    required: [true, 'Unesite ispravnu e-mail adresu']
  },
  password: {
    type: String,
    required: 'Lozinka je obavezna',
    minlength: [4, 'Lozinka mora da sadrži minimalno 4 karaktera']
  }
});
but in Postman I get this
ValidationError: User validation failed: email: Unesite ispravnu e-mail adresu etc. etc. etc.
exports.userSignup = (req, res, next) => {
  const user = new User({
    email: req.body.email,
    password: req.body.password
  });

  // Save the user
  user
    .save()
    .then((result) => {
      res.status(201).json({
        message: 'Novi korisnik je dodat',
        result: result
      });
    })
    .catch((err) => {
      if (err.code == 11000) {
        res
          .status(422)
          .send([
            'Korisnik s unesenom e-mail adresom već postoji u bazi. Molimo vas provjerite e-mail adresu i pokušajte ponovo.'
          ]);
      } else {
        return next(err);
      }
    });
};
this validation message works fine
Mile Mijatović
@mijatovicmile
But how to do the same from schema
Mile Mijatović
@mijatovicmile
Hmm, I noticed that when I sent post request , validation from mongoose schema has Content-Type : html / text
should be application / json
I have defined res.setHeader('Content-Type', 'application/json'); but does not work in this case
Anyone ?
Ilya Revenko
@irevenko
I've built a CLI for generating optional Node boilerplate
https://github.com/irevenko/forge-node-app
Can you please give some feedback on it?
Available on npm with: npx forge-node-app
Roman Kushyn
@romeerez

@irevenko tested it, great work, respect!
Minor thing: while installing something I see static icon, I'd like to see animated one
Personally I wish to have an option in eslint (or prettier) to remove semicolons, I suppose many other devs also customize eslint for this

How about more detailed project setup, like if it's web project it would suggest to choose between express, nest and other web libraries;
It could suggest database libraries, would be perfect to have brief description for each option, including download stats, github stars, open issues count etc

Again in case of web project it could kind of boilerplate, user can choose "3-layered architecture", or "domain based architecture", and it will generate some basic crud.
Maybe it's too much and it's not what you wanted to achieve

Ilya Revenko
@irevenko
@romeerez I want this CLI to serve general purpose Node app, not web specific.
You can remove semicolons with one rule which is - semi or just use Standard lint cfg
I think it would be better to create another CLI like forge-x-app where x is express or others
Jordan Harband
@ljharb
don’t remove semicolons. They’re required - so much so that the language tried to fix your mistake
but yes, eslint and prettier both support removing semicolons if you’re a glutton for punishment
(semicolons are punctuation; punctuation matters)
Jakub Barczyk
@jakubbarczyk
@ljharb well said, Sir!
Roman Kushyn
@romeerez
@ljharb semicolons is matter of taste. I agree that many developers prefer to have them, but I also worked on a big project where eslint was configured to remove them and I was like "oh, I'm not the only one!"
On other hand, if you don't know where they are required, it's better to always have them. As I know, it's only one case: ;(before expression in parentheses), so it's very easy to remember
Jordan Harband
@ljharb
@romeerez see, you’re wrong :-) it’s before (, [, a backtick, and a number of other places
and, the language will be adding more places eventually
Roman Kushyn
@romeerez
@ljharb ya, really, I was wrong, because I use rarely (expressions in "()"), but never used [such] or such as standalone expressions, did you?
For example, sometimes I write (window as any).foo = footo debug something in console, but what use cases may be for [] or ``?
Jordan Harband
@ljharb
i occasionally have an array literal that i promptly forEach or map over
backticks would be a tagged template literal, with a newline after the tag - not something i write, but something ASI can accidentally make happen
the point isn’t whether you’re likely to want these patterns, it’s that it’s more to think about that can break your code.
the rules you have to remember when using semicolons are simpler and fewer.
KeyboardScript
@SampathKumar27896
Hi, all I want to build a video group chat application based on Selective forwarding unit(SFU) architecture using mediasoup , when I googled it I saw the terms webrtc, socket.io, mediasoup. I am beginner in node js. Could anyone tell me diff between webrtc, socket.io, mediasoup?
@all
William Roseberry
@RoseberryPi

Is there a direct (or close enough) equivalent to C#'s Parallel.For() loop in JavaScript?

I'm wanting to do this something like this: Parallel.For(0, someArray.Count, i => resultArray[i] = someMethod(param1[i], param2[i]))

Jake
@JakeDVirus

Please help!
After adding passport strategy in my express app, and doing npm start i get following error in my console

0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'start' ]
2 info using npm@6.14.8
3 info using node@v14.14.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle server@1.0.0~prestart: server@1.0.0
6 info lifecycle server@1.0.0~start: server@1.0.0
7 verbose lifecycle server@1.0.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle server@1.0.0~start: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/run/media/jakegiri/Volume 1/codingUdemy/fullStack/NWR_emaily_2/server/node_modules/.bin:/home/jakegiri/.local/bin:/home/jakegiri/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin
9 verbose lifecycle server@1.0.0~start: CWD: /run/media/jakegiri/Volume 1/codingUdemy/fullStack/NWR_emaily_2/server
10 silly lifecycle server@1.0.0~start: Args: [ '-c', 'node index.js' ]
11 silly lifecycle server@1.0.0~start: Returned: code: 1  signal: null
12 info lifecycle server@1.0.0~start: Failed to exec start script
13 verbose stack Error: server@1.0.0 start: `node index.js`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:315:20)
13 verbose stack     at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:315:20)
13 verbose stack     at maybeClose (internal/child_process.js:1048:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
14 verbose pkgid server@1.0.0
15 verbose cwd /run/media/jakegiri/Volume 1/codingUdemy/fullStack/NWR_emaily_2/server
16 verbose Linux 5.8.15-301.fc33.x86_64
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "start"
18 verbose node v14.14.0
19 verbose npm  v6.14.8
20 error code ELIFECYCLE
21 error errno 1
22 error server@1.0.0 start: `node index.js`
22 error Exit status 1
23 error Failed at the server@1.0.0 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

I even tried

1- cleaning cache, deleting node_modules and package-lock.json and followed by npm install
2- npm config set unsafe-perm true

But i m still getting the same error. Please help me, already wasted hours on it

Neil Duffy
@skiv71
experienced dev looking for extra work...
Samarth Saxena
@ItsSamarth

Hey guys,
I need some advice on interservice communication in micro-services
Right new we are making rest API calls but that is inefficient so I thought of migrating it to kafka for interservice communication.
But I have a problem suppose I got an API call from the user and one of my microservices is relaying on other microservice to return the data which I cannot fulfill using kafka.

Later on the data which I got from microservice 2 will then be processed and sent back to the user

what is the optimal way to do it and how can I unblock this scenerio
alderson-digital
@alderson-digital

Hi all,

I'm in the process of using the Janea library within an iOS app.

At present the AppDelegate.swift calls NodeRunner.m (as per the Janea documentation). Unfortunately, when the runner attempts to call node_start(argument_count,argv); the whole app dies and would appear to do so without providing any error messages.

Have any of you encountered anything similar?

Also, do any of you have any experience of using XCode / Janea within Bug Sur?

Abu Syeed Sajid Ahmed
@Sajid576
I want to make a system that whenever a data is written on mongodb database, my local database in flutter application will be automatically updated. How can i do that
Jordan Harband
@ljharb
@hinell no trolling.
hinell
@hinell
@ljharb Nooooooooooo
Isheke Peter
@peterishek
Hey guys! I'm looking to hire blockchain developers and a software programmer anyone interested can hit me up. I'm creating a crypto utility marketplace and a smart contract for operation. A market for the stock and cryptocurrency or project development