Closed Bug 1657647 Opened 4 years ago Closed 4 years ago

Support reading/writing utf-8 text files with IOUtils

Categories

(Toolkit Graveyard :: OS.File, task)

Tracking

(firefox82 fixed)

RESOLVED FIXED
82 Branch
Tracking Status
firefox82 --- fixed

People

(Reporter: mail, Assigned: mail)

References

Details

Attachments

(1 file)

OS.File read and writeAtomic methods can optionally return/accept strings instead of byte arrays if the encoding option is passed. See options for writeAtomic for more detail.

The vast majority of cases where the encoding option is used, it is called with encoding: 'utf-8'.

IOUtils should support these use cases with two new methods:

  1. Promise<unsigned long long> writeAtomicUTF8(DOMString path, DOMString data, ...)
  2. Promise<DOMString> readUTF8(DOMString path)
Assignee: nobody → krourke

This change introduces two new methods to the IOUtils interface:

  1. readUTF8 will read an entire file as an UTF-8 encoded text
  2. writeAtomicUTF8 will encode a provided DOMString to UTF-8 and write it
    to file
Attachment #9169938 - Attachment description: Bug 1657647: Implement IOUtils methods to read and write UTF-8 text r?barret,Gijs! → Bug 1657647: Implement IOUtils methods to read and write UTF-8 text r?barret!,froydnj!
Pushed by brennie@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/dc0d90b3e135
Implement IOUtils methods to read and write UTF-8 text r=barret,froydnj
Pushed by brennie@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/672c791323ae
Implement IOUtils methods to read and write UTF-8 text r=barret,froydnj
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 82 Branch
Product: Toolkit → Toolkit Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: