0

I am working on React Serverless App using AWS I want to access Node JS specific package into React js what are possible alternatives to access node js package without using Node JS on the backend

font-list is a Node.js package for listing the fonts available on your system. I want to access this package on the frontend side.

365体育足球滚球比分Need Help!!

  • What package you want to use? If that package make file system request, it will not possible because React is in browser – Radonirina Maminiaina Mar 31 at 18:16
  • @RadonirinaMaminiaina the author said it's font-list. And I belive they're aware that it does not work in browser. – Marko Grešak Mar 31 at 18:17
  • For this specific task, you would have to implement font detection, which is not trivial. See how does it. – Marko Grešak Mar 31 at 18:19
  • after installing font in the system, Figma UI designing tool on the Web developed on the React detects it, and render it on the web. Using XHR on network tab Request URL: how they are doing this ? – Ali Syed Mar 31 at 18:33
0

To answer the broader question, a package meant for node will more than likely work only in the node eco system.

In the case of font-list365体育足球滚球比分, it looks like it's running a vbs script to get available fonts (in the case of windows). Running external scripts like that, or accessing local file systems is not something you can do in a browser environment due do security constraints.

So to get a list of fonts in a browser will require a its own solution. You cannot just use a Node.js package, even though it's all still js.

| improve this answer | |
  • I am working on a Font Manager app using React JS on frontend and Serverless Lambda on the backend I want to access system fonts using react what are possible ways to access system fonts into React JS app. do I have to use NodeJS with React and Lambda or any possible alternative to access system file/directories? or how to access System fonts directory using javascript. Need Help – Ali Syed Mar 31 at 19:00
  • @AliSyed You will not be able to access system fonts using the browser. It simply doesn't have access. The closest thing you can do is detect what fonts the browser has available. There are ways of doing that as someone commented on your answer. – SpeedOfRound Mar 31 at 19:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.