File and FileReader by longo-andrea · Pull Request #296 · javascript-tutorial/it.javascript.info

@longo-andrea

@CLAassistant

Dorin-David

Dorin-David

Dorin-David

- **`lastModified`** -- the timestamp (integer date) of last modification.
- **`fileParts`**, è una array di valori di tipo Blob/BufferSource/String.
- **`fileName`**, il nome del file.
- **`options`**, oggetto opzionale:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- **`options`**, oggetto opzionale:
- **`options`** - oggetto opzionale:

Dorin-David

- **`fileParts`**, è una array di valori di tipo Blob/BufferSource/String.
- **`fileName`**, il nome del file.
- **`options`**, oggetto opzionale:
- **`lastModified`**, il timestamp dell'ultima modifica (un intero).

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- **`lastModified`**, il timestamp dell'ultima modifica (un intero).
- **`lastModified`** - il timestamp dell'ultima modifica (un intero).

Dorin-David

Dorin-David

- `name` -- the file name,
- `lastModified` -- the timestamp of last modification.
Poiché `File` eredita da `Blob`, gli oggetti di tipo `File` possiedono le stesse proprietà, con l'aggiunta di:
- `name`, il nome del file,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- `name`, il nome del file,
- `name` - il nome del file,

Dorin-David

- `name` -- the file name,
- `lastModified` -- the timestamp of last modification.
Poiché `File` eredita da `Blob`, gli oggetti di tipo `File` possiedono le stesse proprietà, con l'aggiunta di:
- `name`, il nome del file,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- `name`, il nome del file,
- `name` - il nome del file,

Dorin-David

- `lastModified` -- the timestamp of last modification.
Poiché `File` eredita da `Blob`, gli oggetti di tipo `File` possiedono le stesse proprietà, con l'aggiunta di:
- `name`, il nome del file,
- `lastModified`, il timestamp dell'ultima modifica.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- `lastModified`, il timestamp dell'ultima modifica.
- `lastModified` - il timestamp dell'ultima modifica.

Dorin-David

- **`readAsText(blob, [encoding])`** -- read the data as a text string with the given encoding (`utf-8` by default).
- **`readAsDataURL(blob)`** -- read the binary data and encode it as base64 data url.
- **`abort()`** -- cancel the operation.
- **`readAsArrayBuffer(blob)`**, legge i dati in formato binario da `ArrayBuffer`.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- **`readAsArrayBuffer(blob)`**, legge i dati in formato binario da `ArrayBuffer`.
- **`readAsArrayBuffer(blob)`** - legge i dati in formato binario da `ArrayBuffer`.

Dorin-David

- **`readAsDataURL(blob)`** -- read the binary data and encode it as base64 data url.
- **`abort()`** -- cancel the operation.
- **`readAsArrayBuffer(blob)`**, legge i dati in formato binario da `ArrayBuffer`.
- **`readAsText(blob, [encoding])`**, legge i dati come stringa di testo con uno specifico encoding (`utf-8` di default).

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- **`readAsText(blob, [encoding])`**, legge i dati come stringa di testo con uno specifico encoding (`utf-8` di default).
- **`readAsText(blob, [encoding])`** - legge i dati come stringa di testo con uno specifico encoding (`utf-8` di default).

Dorin-David

- **`abort()`** -- cancel the operation.
- **`readAsArrayBuffer(blob)`**, legge i dati in formato binario da `ArrayBuffer`.
- **`readAsText(blob, [encoding])`**, legge i dati come stringa di testo con uno specifico encoding (`utf-8` di default).
- **`readAsDataURL(blob)`**, legge i dati in formato binario e li codifica come URL in base64.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- **`readAsDataURL(blob)`**, legge i dati in formato binario e li codifica come URL in base64.
- **`readAsDataURL(blob)`** - legge i dati in formato binario e li codifica come URL in base64.

Dorin-David

Comment on lines +60 to 61

- **`abort()`**, annulla l'operazione.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- **`abort()`**, annulla l'operazione.
- **`abort()`** - annulla l'operazione.

Dorin-David

Dorin-David

- `readAsArrayBuffer` -- for binary files, to do low-level binary operations. For high-level operations, like slicing, `File` inherits from `Blob`, so we can call them directly, without reading.
- `readAsText` -- for text files, when we'd like to get a string.
- `readAsDataURL` -- when we'd like to use this data in `src` for `img` or another tag. There's an alternative to reading a file for that, as discussed in chapter <info:blob>: `URL.createObjectURL(file)`.
- `readAsArrayBuffer`, per file di tipo binario, per eseguire operazioni a basso livello. Per operazioni ad alto livello, come la rimozione di porzioni di file, `File` eredita da `Blob`, quindi possiamo invocare i suoi metodi direttamente, senza iniziare la lettura.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- `readAsArrayBuffer`, per file di tipo binario, per eseguire operazioni a basso livello. Per operazioni ad alto livello, come la rimozione di porzioni di file, `File` eredita da `Blob`, quindi possiamo invocare i suoi metodi direttamente, senza iniziare la lettura.
- `readAsArrayBuffer` - per file di tipo binario, per eseguire operazioni a basso livello. Per operazioni ad alto livello, come la rimozione di porzioni di file, `File` eredita da `Blob`, quindi possiamo invocare i suoi metodi direttamente, senza iniziare la lettura.

Dorin-David

- `readAsText` -- for text files, when we'd like to get a string.
- `readAsDataURL` -- when we'd like to use this data in `src` for `img` or another tag. There's an alternative to reading a file for that, as discussed in chapter <info:blob>: `URL.createObjectURL(file)`.
- `readAsArrayBuffer`, per file di tipo binario, per eseguire operazioni a basso livello. Per operazioni ad alto livello, come la rimozione di porzioni di file, `File` eredita da `Blob`, quindi possiamo invocare i suoi metodi direttamente, senza iniziare la lettura.
- `readAsText`, per file di tipo testuale, per ottenerli sotto forma di stringa.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- `readAsText`, per file di tipo testuale, per ottenerli sotto forma di stringa.
- `readAsText` - per file di tipo testuale, per ottenerli sotto forma di stringa.

Dorin-David

- `readAsDataURL` -- when we'd like to use this data in `src` for `img` or another tag. There's an alternative to reading a file for that, as discussed in chapter <info:blob>: `URL.createObjectURL(file)`.
- `readAsArrayBuffer`, per file di tipo binario, per eseguire operazioni a basso livello. Per operazioni ad alto livello, come la rimozione di porzioni di file, `File` eredita da `Blob`, quindi possiamo invocare i suoi metodi direttamente, senza iniziare la lettura.
- `readAsText`, per file di tipo testuale, per ottenerli sotto forma di stringa.
- `readAsDataURL`, quando siamo interessati da utilizzare questi dati come `src` su un `img` o un altro tag. In questo caso c'è un ulteriore alternativa , che abbiamo discusso nel capitolo <info:blob>: `URL.createObjectURL(file)`.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- `readAsDataURL`, quando siamo interessati da utilizzare questi dati come `src` su un `img` o un altro tag. In questo caso c'è un ulteriore alternativa , che abbiamo discusso nel capitolo <info:blob>: `URL.createObjectURL(file)`.
- `readAsDataURL` - quando siamo interessati da utilizzare questi dati come `src` su un `img` o un altro tag. In questo caso c'è un ulteriore alternativa , che abbiamo discusso nel capitolo <info:blob>: `URL.createObjectURL(file)`.

Dorin-David

- `error` -- error has occurred.
- `loadend` -- reading finished with either success or failure.
Mentre il processo di lettura prosegue, vengono emessi degli eventi:
- `loadstart`, la lettura è iniziata.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- `loadstart`, la lettura è iniziata.
- `loadstart` - la lettura è iniziata.

Dorin-David

- `loadend` -- reading finished with either success or failure.
Mentre il processo di lettura prosegue, vengono emessi degli eventi:
- `loadstart`, la lettura è iniziata.
- `progress`, durante la lettura.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- `progress`, durante la lettura.
- `progress` - durante la lettura.

Dorin-David

Mentre il processo di lettura prosegue, vengono emessi degli eventi:
- `loadstart`, la lettura è iniziata.
- `progress`, durante la lettura.
- `load`, nessun errore, lettura completata.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- `load`, nessun errore, lettura completata.
- `load` - nessun errore, lettura completata.

Dorin-David

- `loadstart`, la lettura è iniziata.
- `progress`, durante la lettura.
- `load`, nessun errore, lettura completata.
- `abort`, invocato `abort()`.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- `abort`, invocato `abort()`.
- `abort` - invocato `abort()`.

Dorin-David

- `progress`, durante la lettura.
- `load`, nessun errore, lettura completata.
- `abort`, invocato `abort()`.
- `error`, si è verificato un errore.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- `error`, si è verificato un errore.
- `error` - si è verificato un errore.

Dorin-David

- `load`, nessun errore, lettura completata.
- `abort`, invocato `abort()`.
- `error`, si è verificato un errore.
- `loadend`, lettura completata con o senza errori.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- `loadend`, lettura completata con o senza errori.
- `loadend` - lettura completata con o senza errori.

Dorin-David

- `readAsText(blob, [encoding])` -- to string (an alternative to `TextDecoder`),
- `readAsDataURL(blob)` -- to base64 data url.
Possiamo utilizzarlo per convertire un `Blob` in un altro formato:
- `readAsArrayBuffer(blob)`, per convertirlo ad `ArrayBuffer`,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- `readAsArrayBuffer(blob)`, per convertirlo ad `ArrayBuffer`,
- `readAsArrayBuffer(blob)` - per convertirlo ad `ArrayBuffer`,

Dorin-David

- `readAsDataURL(blob)` -- to base64 data url.
Possiamo utilizzarlo per convertire un `Blob` in un altro formato:
- `readAsArrayBuffer(blob)`, per convertirlo ad `ArrayBuffer`,
- `readAsText(blob, [encoding])`, per convertirlo a string (un'alternativa a `TextDecoder`),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- `readAsText(blob, [encoding])`, per convertirlo a string (un'alternativa a `TextDecoder`),
- `readAsText(blob, [encoding])` - per convertirlo a string (un'alternativa a `TextDecoder`),

Dorin-David

Possiamo utilizzarlo per convertire un `Blob` in un altro formato:
- `readAsArrayBuffer(blob)`, per convertirlo ad `ArrayBuffer`,
- `readAsText(blob, [encoding])`, per convertirlo a string (un'alternativa a `TextDecoder`),
- `readAsDataURL(blob)`, per convertirlo ad url in base64.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- `readAsDataURL(blob)`, per convertirlo ad url in base64.
- `readAsDataURL(blob)` - per convertirlo ad url in base64.

Dorin-David

Dorin-David

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Piccole modifiche e suggerimenti

@longo-andrea @Dorin-David

Co-authored-by: Dorin David <70648503+Dorin-David@users.noreply.github.com>

@javascript-translate-bot

Thank you 💖 I updated the Progress Issue #1 🎉 🎉 🎉