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

104
Views
Chrome extension local file overwriting

How to (If possible) make a function inside a chrome extension that rewrites a file?

Files in directory : manifest.json background.js ls.txt (background.js obviously always running when chrome is open, in the background)

Example: a function that writes text to a file when the user makes any request

chrome.webRequest.onBeforeRequest.addListener(details => {
   const anytext = "anytext"
   const filedir = "ls.txt"
   //how do I delete everything from ls.txt and write "anytext" to ls.txt, simply, how do I overwrite ls.txt?
},{ urls: ["<all_urls>"] },['requestBody']);

Boring backstory: I've tried looking for this online, but every result either shows me how to download a file or how to read it, maybe there is no way to modify a file? But then how do I save personal configurations between computer reboots if I can't save them to local files? And for anyone asking, this is definitely not why I'm making the plugin, I used this code as an example and not to make a plugin that writes text to a file every time a user makes a request.

about 4 years ago · Juan Pablo Isaza
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!