Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

186
Views
import FileHandle across Node.js versions

Is there a way to import FileHandle across stable Node.js versions?

I mean in Node.js v14 an v16 following code works fine

import { FileHandle } from "fs/promises";

but in Node.js v12 it doesn't work, so I tried with

import { promises } from "fs";
const { FileHandle } = promises;

but this doesn't work on Node.js v16.

According with Node.js Release v12 is still supported.

So: how can I import FileHandle in a package and make the package compliant with all supported Node.js versions?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

ES6 imports are an experimental feature within Node v12. If you want to make your application compatible with Node v12, you could use require

const fileHandle = require("fs").promises;

which works in Node versions v12, v14, and v16

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!