score:0
solution :
both the backend and frontend code needed to be reworked; the solution is clearly simple.
1.backend :
the filerouter route is no more necessary. express is used. targeted file is in a public/ directory created at the root of the backend directory.
app.js:
express.static.mime.define({'application/x-xpinstall' : ['xpi']})
app.use('/download' , express.static('public'))
2. frontend :
long story short : declare your component then the solution is only html really...
const download = () =>{
return(
<a href='https://yourwebsite.com/download/yourfirefoxextension.xpi'>
download the extension
</a>
)
}
postscript :
the extension is directly installed by firefox after the user accepts it. no need for setting-up an express.router(). i'm still curious to know if the first way i tried had any chance to work (if you feel you have the answer, don't hesitate).
Source: stackoverflow.com
Related Query
- NodeJS/React install xpi file instead of downloading it
- Converting Object into JSON and downloading as a .json file in React
- My React app is using values from the .env file instead of the .env.local file
- what is proper way to import multiple components from same file in react instead of getting each component imported
- React - Downloading a Zip File from API Response Body in Bytes String?
- Import all json files placed inside folder instead of import every file and export in Create React App?
- Anchor tag with download attribute opens file instead of downloading
- Nodejs - React download file from s3 bucket using pre-signed url
- React with NodeJS and Webpack - bundled js big file size
- How to send file + JSON in single request from react to nodejs
- Downloading a video from an API in React using Axios creates an empty mp4 file
- how to download an excel file in react from NodeJS
- Download file stored in S3 bucket directly to React client, instead of passing through Node.js server
- playing s3 audio and downloading the file in react component
- Download CSV file from browser after making axios call from React to Nodejs Api
- Using markdown-loader on react page to render markdown file. Getting data:text/x-markdown;base64,IyMgRHVkZQ== instead of rendered file
- How to open a pdf file in browser instead of downloading it?
- Is it possible to embed a dynamic react component into a separate html file without downloading a file or using a server?
- Getting Expected an assignment or function call and instead saw an expression no-unused-expressions, when import a file in React
- react dropzone and nodejs file upload
- d3 React JS: d3.csv is importing index.html instead of csv file
- How to Pass token(data) in react-Nodejs web application (from nodejs file to react tsx file)
- file not uploading in react js and nodejs using multer
- Downloading a zip file from a given path in express api + react
- I am trying to implement a file downloading app in react but its not downloading
- Not getting image file in nodejs after posting from react
- React and NodeJS upload file with Multer can`t set filename and termination
- I have downloaded nodejs for react but when my powershell open to install external tools it gives error shown in the image:-
- Upload File Api request works in postman but not in nodejs and react MERN
- Adding an .env file to React Project
More Query from same tag
- children with useContext() not rerendered with current value
- Avoid not needed requests on Saga
- React + Webpack HMR is refreshing the page (not hot loading)
- React, Enzyme: Testing a state update-Functional Component
- Property 'current' does not exist on type '((instance: HTMLDivElement | null) => void) | RefObject<HTMLDivElement>'
- How do i stop concatenation between two state values
- Wordpress to React REST API : Objects are not valid as a React child (found: object with keys {rendered})
- Create dynamic grid (row and col) for data coming from API call
- HTML JavaScript React: Front-End React Component Throwing react-dom.development.js:506 Warning
- How to set a dynamic class in react js and retrieve it in Jquery
- react/jsx-no-bind: how to pass args
- Reactjs+Flow: SyntheticKeyboardEvent and passing functions as props
- Type 'ChangeEvent<HTMLInputElement>' is not assignable to type 'ChangeEvent<HTMLSelectElement>' in React js?
- Pass Image path from JSON in react
- Prevent re-rendering when state is changed multiple times during useEffect
- TypeError: Class constructor ESLintWebpackPlugin cannot be invoked without 'new'
- Updating state of array2 after a drag and drop, updates array1 which is the source of the drag and drop
- How to stop react component from infinite re-render
- Union type doesn't allow if statement with Typescript and React
- Why does using then() callback in ExpressJS after a promise giving me an Error?
- React - Create multiple useRefs in one line using object or array
- How to get another component when I click h1 tag in react using hooks?
- NextJS type error while passing props to children
- Want to test for size of an array constant in React
- MapStateToPros returning undefined in reactJS
- ReactJS component hiding for React developer tools
- How to customize and change color of a menu in ant design?
- How does React.createRef() actually work?
- Cannot access this.props as id in firebase firestore request (react native)
- Updating a page at refresh AND change of state