score:1
function base64tobuffer(base4) {
const str = atob(base64);
const bin = [...str].map(char => char.charcodeat(0));
const arr = new uint8array(bin);
const { buffer } = arr;
return buffer;
}
const base64 = '/9j/4aaqskzjrgabaqeayabgaad/4qborxhpzgaatu0akgaaaagabaeaaauaaaabaaaapgebaauaaaabaaaargeoaamaaaabaaiaaaexaaiaaaaraaaatgaaaaaaaabgaaaaaqaaagaaaaabcgfpbnqubmv0idqumi4xmgaa/9saqwbyt1zkvkdyzf1kgxlyikv/uqudnav/+v/p/////////////////////////////////////////////////////9saqwf5gygrlqv/urr//////////////////////////////////////////////////////////////////////////8aaeqgaiqagaweiaairaqmraf/eab8aaaefaqebaqebaaaaaaaaaaabagmebqyhcakkc//ealuqaaibawmcbamfbqqeaaabfqecawaeequsitfbbhnryqcicrqygzghccncscevuthwjdnicoijchyxgbkajsynkckqndu2nzg5okneruzhselku1rvvldywvpjzgvmz2hpann0dxz3ehl6g4sfhoeiiyqsk5svlpeymzqio6slpqeoqaqys7s1tre4ubrcw8tfxsfiycrs09tv1tfy2drh4upk5ebn6onq8flz9px29/j5+v/eab8baambaqebaqebaqeaaaaaaaabagmebqyhcakkc//ealuraaibagqeawqhbqqeaaecdwabagmrbauhmqysqvehyxetijkbcbrckagxwqkjm1lwfwjy0qowjdthjfexgbkajicokso1njc4otpdrevgr0hjslnuvvzxwflay2rlzmdoawpzdhv2d3h5eokdhiwgh4ijipktljwwl5izmqkjpkwmp6ipqrkztlw2t7i5usldxmxgx8jjytlt1nxw19jz2ulj5oxm5+jp6vlz9px29/j5+v/aaawdaqaceqmrad8afkt5i459qaopxcr2ps3zb8zzwo/rsrhm6jp0/waaaglqom4dvresxbix/ku44vuoyfb/aapa3zbsyxww/kaagdaf/iq8e4qubwcmmdmg+tkyk3xqohqmzrim89rxnp5uapo1xjoomsfsouok/watnn2fooxydppu8yx+dskir06nqaahvhn/qzrrqaq/6svjrrqb/9k=';
const buffer = base64tobuffer(base64);
const file = new file([buffer], 'tiger.jpg', { type: 'image/jpeg' });
console.log(file);
Source: stackoverflow.com
Related Query
- Get FileInput object from base64 using javascript or React
- How to reduce and get value from object array using javascript
- How to get value from object property in React or Javascript
- How to get nested Object from JSON File using React JS
- Fill an object (in React js) using results from get request using axios
- Get object data and target element from onClick event in react js
- How import object from external JS file in React JS using web pack
- Modify React Component's State using jQuery/Plain Javascript from Chrome Extension
- Get first object from array of objects in react
- How to delete object from array using object property - React
- get parameter value from url using React Router
- How do I access data returned from an axios get to display on a web page using react js?
- How to get contacts from phone using react native expo
- I can not get the state from react router Link component using useLocation. So how can I pass it?
- React remove object from list of objects without unique value, using hooks
- How do I correctly add data from multiple endpoints called inside useEffect to the state object using React Hooks and Context API?
- React failing to update DOM after a element was moved using javaScript from another library
- How can I get data from query string using route in react js
- getting a field from a json object using a "address string" in JavaScript
- How to make a list from json object using React
- Get object array from axios and using return value call another axios function and append the output to first result
- browser says " request has been blocked by CORS policy" when calling to a spring boot get method from react js using axios
- Is there a way to get "this.lastID" from sqlite.run() callback using es6 and react classes
- How to get data from table row click using Semantic's React Table Component
- Using base64 Encoding When Passing Data from Node to React to Construct PDF
- Get object from another class in component react
- How to get access to a specific reducer variables as props from react without using routes
- select option from dropdown using API and get that selected value but i am getting last value which i have not selected in react
- How to access data from get request made by a React functional component to localhost server using Axios?
- React useEffect - Why property from closure object does't get updated?
More Query from same tag
- How to use React Redux state for conditionally showing and Disabling a Button
- undo 'npm run eject' in react
- How to export all components in index.js?
- Toggle component in react on button click
- Warning: Component(...): No `render` method found on the returned component instance: you may have forgotten to define `render`
- Why my colors is not output on the screen under a rafce react environtment
- Passing an object from one component to another using props
- Why is my asynchronous input undefined in useEffect?
- ReactJs cannot read property 'map' of undefined despite the initial state is set?
- JavaScript sort handler not sorting my table
- CSSTransition from react-transition-group does not exit
- Typescript prop discrimination in react functional component
- React CSS class gets override automatically on production server
- How do I combine useLocation() with useSelector()?
- Order validation failed: personalDetails.gift: Cast to Boolean failed for value "No" at path "personalDetails.gift"
- React open mailto E-Mail client onClick with body from textarea
- How do I return an input tag from a function?
- How to rewrite this simple component tree to take advantage of React.memo?
- react-custom-scrollbars jumps to top on any action
- Select matched option with React Bootstrap Typeahead
- What is the type of data-testid in React and TypeScript?
- What is the best way to redirect to another page after successful action in Redux?
- Creating a component in react and typescript
- React Hooks useState Array empty with states rendered in the component
- React.js what is the best technique to show to the user different pages according to there role
- Dynamically change value in Formik when a state changes
- Client Routing (using react-router) and Server-Side Routing
- Jest configuration error in React+Typescript+Webpack project
- useFormik, handlesubmit doesn't work with validationschema
- React-Redux - Getting errors on dispatch - TypeError