diff options
author | Ryan Johnson <rjohnson@mozilla.com> | 2021-04-29 16:16:42 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-29 16:16:42 -0700 |
commit | 95aca4b4d8fa62815d4bd412fff1a364f842814a (patch) | |
tree | 5e57661720fe9058d5c7db637e764800b50f9060 /files/pt-pt/web/api/blob | |
parent | ee3b1c87e3c8e72ca130943eed260ad642246581 (diff) | |
download | translated-content-95aca4b4d8fa62815d4bd412fff1a364f842814a.tar.gz translated-content-95aca4b4d8fa62815d4bd412fff1a364f842814a.tar.bz2 translated-content-95aca4b4d8fa62815d4bd412fff1a364f842814a.zip |
remove retired locales (#699)
Diffstat (limited to 'files/pt-pt/web/api/blob')
-rw-r--r-- | files/pt-pt/web/api/blob/blob/index.html | 77 | ||||
-rw-r--r-- | files/pt-pt/web/api/blob/index.html | 157 | ||||
-rw-r--r-- | files/pt-pt/web/api/blob/size/index.html | 73 | ||||
-rw-r--r-- | files/pt-pt/web/api/blob/type/index.html | 83 |
4 files changed, 0 insertions, 390 deletions
diff --git a/files/pt-pt/web/api/blob/blob/index.html b/files/pt-pt/web/api/blob/blob/index.html deleted file mode 100644 index a00a527076..0000000000 --- a/files/pt-pt/web/api/blob/blob/index.html +++ /dev/null @@ -1,77 +0,0 @@ ---- -title: Blob() -slug: Web/API/Blob/Blob -tags: - - API - - Blob - - Construtor - - File API - - Referencia -translation_of: Web/API/Blob/Blob ---- -<div>{{APIRef("File API")}}</div> - -<p><span class="seoSummary">O construtor <code>Blob()</code> devolve um novo objeto {{domxref("Blob")}}. O conteúdo do objeto <code>Blob</code> consiste na concatenação dos valores na matriz do primeiro parâmetro.</span></p> - -<h2 id="Sintaxe">Sintaxe</h2> - -<pre class="syntaxbox notranslate">var <var>novoBlob</var> = new Blob(<var>array</var>, <var>options</var>); -</pre> - -<h3 id="Parâmetros">Parâmetros</h3> - -<dl> - <dt><code><var>array</var></code></dt> - <dd>Uma {{jsxref("Array")}} de {{jsxref("ArrayBuffer")}}, {{domxref("ArrayBufferView")}}, {{domxref("Blob")}}, {{domxref("USVString")}}, {{domxref("USVString")}}, ou uma mistura de quaisquer desses objetos, que serão colocados dentro do objeto {{domxref("Blob")}}. Os objetos <code>USVString</code> são codificados como UTF-8.</dd> - <dt><code><var>options</var></code> {{optional_inline}}</dt> - <dd> - <p>Um objeto opcional do tipo {{domxref("BlobPropertyBag")}} que pode especificar qualquer uma das seguintes propriedades:</p> - - <dl> - <dt><code>type</code> {{optional_inline}}</dt> - <dd>O {{Glossary("MIME type", "tipo MIME")}} dos dados que serão armazenados no <em>blob</em>. O valor predefinido é uma string vazia, (<code>""</code>).</dd> - <dt><code>endings</code> {{optional_inline}} {{non-standard_inline}}</dt> - <dd>Como interpretar os caracteres de nova linha (<code>\n</code>), se os dados são textos. O valor predefinido, <code>transparent</code>, copia os caracteres da nova linha para o <em>blob</em> sem os alterar. Para converter as novas linhas para a convenção nativa do sistema anfitrião, use o valor <code>native</code>.</dd> - </dl> - </dd> -</dl> - -<h3 id="Valor_devolvido">Valor devolvido</h3> - -<p>Um novo objeto {{domxref("Blob")}} que contém os dados especificados.</p> - -<h2 id="Exemplo">Exemplo</h2> - -<pre class="brush: js language-js notranslate">var dadosParaFicheiro = ['<a id="a"><b id="b">hey!</b></a>']; // uma matriz constituída por uma única DOMString -var oMeuBlob = new Blob(dadosParaFicheiro, {type : 'text/html'}); // o <em>blob</em></pre> - -<h2 id="Specification" name="Specification">Especificações</h2> - -<table class="standard-table"> - <thead> - <tr> - <th scope="col">Especificação</th> - <th scope="col">Estado</th> - <th scope="col">Comentário</th> - </tr> - </thead> - <tbody> - <tr> - <td>{{SpecName('File API', '#constructorBlob', 'Blob()')}}</td> - <td>{{Spec2('File API')}}</td> - <td>Definição inicial.</td> - </tr> - </tbody> -</table> - -<h2 id="Compatibilidade">Compatibilidade</h2> - - - -<p>{{Compat("api.Blob.Blob")}}</p> - -<h2 id="Ver_também">Ver também</h2> - -<ul> - <li>A interface obsoleta {{domxref("BlobBuilder")}} que este construtor substitui.</li> -</ul> diff --git a/files/pt-pt/web/api/blob/index.html b/files/pt-pt/web/api/blob/index.html deleted file mode 100644 index 878bc85e5e..0000000000 --- a/files/pt-pt/web/api/blob/index.html +++ /dev/null @@ -1,157 +0,0 @@ ---- -title: Blob -slug: Web/API/Blob -tags: - - API - - Blob - - File API - - Interface - - NeedsTranslation - - Raw - - Reference - - TopicStub - - data -translation_of: Web/API/Blob ---- -<div>{{APIRef("File API")}}</div> - -<p>The <strong><code>Blob</code></strong> object represents a blob, which is a file-like object of immutable, raw data; they can be read as text or binary data, or converted into a {{DOMxRef("ReadableStream")}} so its methods can be used for processing the data.</p> - -<p>Blobs can represent data that isn't necessarily in a JavaScript-native format. The {{DOMxRef("File")}} interface is based on <code>Blob</code>, inheriting blob functionality and expanding it to support files on the user's system.</p> - -<h2 id="Using_blobs">Using blobs</h2> - -<p>To construct a <code>Blob</code> from other non-blob objects and data, use the {{DOMxRef("Blob.Blob", "Blob()")}} constructor. To create a blob that contains a subset of another blob's data, use the {{DOMxRef("Blob.slice()", "slice()")}} method. To obtain a <code>Blob</code> object for a file on the user's file system, see the {{DOMxRef("File")}} documentation.</p> - -<p>The APIs accepting <code>Blob</code> objects are also listed in the {{DOMxRef("File")}} documentation.</p> - -<h2 id="Constructor">Constructor</h2> - -<dl> - <dt>{{DOMxRef("Blob.Blob", "Blob()")}}</dt> - <dd>Returns a newly created <code>Blob</code> object which contains a concatenation of all of the data in the array passed into the constructor.</dd> -</dl> - -<h2 id="Instance_properties">Instance properties</h2> - -<dl> - <dt>{{DOMxRef("Blob.prototype.size")}} {{readonlyinline}}</dt> - <dd>The size, in bytes, of the data contained in the <code>Blob</code> object.</dd> - <dt>{{DOMxRef("Blob.prototype.type")}} {{readonlyinline}}</dt> - <dd>A string indicating the MIME type of the data contained in the <code>Blob</code>. If the type is unknown, this string is empty.</dd> -</dl> - -<h2 id="Instance_methods">Instance methods</h2> - -<dl> - <dt>{{DOMxRef("Blob.prototype.arrayBuffer()")}}</dt> - <dd>Returns a promise that resolves with an {{DOMxRef("ArrayBuffer")}} containing the entire contents of the <code>Blob</code> as binary data.</dd> - <dt>{{DOMxRef("Blob.prototype.slice()")}}</dt> - <dd>Returns a new <code>Blob</code> object containing the data in the specified range of bytes of the blob on which it's called.</dd> - <dt>{{DOMxRef("Blob.prototype.stream()")}}</dt> - <dd>Returns a {{DOMxRef("ReadableStream")}} that can be used to read the contents of the <code>Blob</code>.</dd> - <dt>{{DOMxRef("Blob.prototype.text()")}}</dt> - <dd>Returns a promise that resolves with a {{DOMxRef("USVString")}} containing the entire contents of the <code>Blob</code> interpreted as UTF-8 text.</dd> -</dl> - -<h2 id="Examples">Examples</h2> - -<h3 id="Creating_a_blob">Creating a blob</h3> - -<p>The {{DOMxRef("Blob.Blob", "Blob()")}} constructor can create blobs from other objects. For example, to construct a blob from a JSON string:</p> - -<pre class="brush: js notranslate">const obj = {hello: 'world'}; -const blob = new Blob([JSON.stringify(obj, null, 2)], {type : 'application/json'});</pre> - -<h3 id="Creating_a_URL_representing_the_contents_of_a_typed_array">Creating a URL representing the contents of a typed array</h3> - -<p>The following code creates a JavaScript <a href="/en-US/docs/Web/JavaScript/Typed_arrays">typed array</a> and creates a new <code>Blob</code> containing the typed array's data. It then calls {{DOMxRef("URL.createObjectURL()")}} to convert the blob into a {{glossary("URL")}}.</p> - -<h4 id="HTML">HTML</h4> - -<pre class="brush: html notranslate"><p>This example creates a typed array containing the ASCII codes - for the space character through the letter Z, then converts it - to an object URL. A link to open that object URL is created. - Click the link to see the decoded object URL.</p></pre> - -<h4 id="JavaScript">JavaScript</h4> - -<p>The main piece of this code for example purposes is the <code>typedArrayToURL()</code> function, which creates a <code>Blob</code> from the given typed array and returns an object URL for it. Having converted the data into an object URL, it can be used in a number of ways, including as the value of the {{HTMLElement("img")}} element's {{htmlattrxref("src", "img")}} attribute (assuming the data contains an image, of course).</p> - -<pre class="brush: js notranslate">function typedArrayToURL(typedArray, mimeType) { - return URL.createObjectURL(new Blob([typedArray.buffer], {type: mimeType})) -} - -const bytes = new Uint8Array(59); - -for(let i = 0; i < 59; i++) { - bytes[i] = 32 + i; -} - -const url = typedArrayToURL(bytes, 'text/plain'); - -const link = document.createElement('a'); -link.href = url; -link.innerText = 'Open the array URL'; - -document.body.appendChild(link);</pre> - -<h4 id="Result">Result</h4> - -<p>Click the link in the example to see the browser decode the object URL.</p> - -<p>{{EmbedLiveSample("Creating_a_URL_representing_the_contents_of_a_typed_array", 600, 200)}}</p> - -<h3 id="Extracting_data_from_a_blob">Extracting data from a blob</h3> - -<p>One way to read content from a <code>Blob</code> is to use a {{DOMxRef("FileReader")}}. The following code reads the content of a <code>Blob</code> as a typed array:</p> - -<pre class="brush: js notranslate">const reader = new FileReader(); -reader.addEventListener('loadend', () => { - // reader.result contains the contents of blob as a typed array -}); -reader.readAsArrayBuffer(blob);</pre> - -<p>Another way to read content from a <code>Blob</code> is to use a {{domxref("Response")}}. The following code reads the content of a <code>Blob</code> as text:</p> - -<pre class="brush: js notranslate">const text = await (new Response(blob)).text(); -</pre> - -<p>Or by using {{DOMxRef("Blob.prototype.text()")}}:</p> - -<pre class="brush: js notranslate">const text = await blob.text();</pre> - -<p>By using other methods of <code>FileReader</code>, it is possible to read the contents of a Blob as a string or a data URL.</p> - -<h2 id="Specifications">Specifications</h2> - -<table class="standard-table"> - <tbody> - <tr> - <th scope="col">Specification</th> - <th scope="col">Status</th> - <th scope="col">Comment</th> - </tr> - <tr> - <td>{{SpecName('File API', '#blob-section', 'The <code>Blob</code> interface')}}</td> - <td>{{Spec2('File API')}}</td> - <td>Initial definition.</td> - </tr> - </tbody> -</table> - -<h2 id="Browser_compatibility">Browser compatibility</h2> - - - -<p>{{Compat("api.Blob")}}</p> - -<h2 id="See_also">See also</h2> - -<ul> - <li>{{DOMxRef("BlobBuilder")}}</li> - <li>{{DOMxRef("FileReader")}}</li> - <li>{{DOMxRef("File")}}</li> - <li>{{DOMxRef("URL.createObjectURL")}}</li> - <li><a href="/en-US/docs/Web/API/File/Using_files_from_web_applications">Using files from web applications</a></li> -</ul> diff --git a/files/pt-pt/web/api/blob/size/index.html b/files/pt-pt/web/api/blob/size/index.html deleted file mode 100644 index fc6423a199..0000000000 --- a/files/pt-pt/web/api/blob/size/index.html +++ /dev/null @@ -1,73 +0,0 @@ ---- -title: Blob.size -slug: Web/API/Blob/size -tags: - - API - - Blob - - Bytes - - Ficheiros - - File API - - Propriedade - - Referencia - - length - - size -translation_of: Web/API/Blob/size ---- -<div>{{APIRef("File API")}}</div> - -<p>A propriedade <strong><code>size</code></strong> da interface do {{domxref("Blob")}} retorna o tamanho do {{domxref("Blob")}} ou {{domxref("File")}} em <em>bytes</em>.</p> - -<h2 id="Sintaxe">Sintaxe</h2> - -<pre class="syntaxbox notranslate">var <em>sizeInBytes</em> = <em>blob</em>.size -</pre> - -<h3 id="Valor">Valor</h3> - -<p>O número de <em>bytes</em> de dados contidos dentro do <code>Blob</code> (ou do objeto baseado em <code>Blob</code>, como um {{domxref("File")}}).</p> - -<h2 id="Exemplo">Exemplo</h2> - -<p>Este exemplo usa um {{HTMLElement("input")}} com os atributos <code>type="file"</code> e <code>multiple</code> para receber do utilizador um grupo de ficheiros, e depois um iterar sobre os ficheiros que emitem os seus nomes e comprimentos em <em>bytes</em>.</p> - -<pre class="brush:js notranslate">// fileInput is a HTMLInputElement: <input type="file" multiple id="myfileinput"> -var fileInput = document.getElementById("myfileinput"); - -// files is a FileList object (simliar to NodeList) -var files = fileInput.files; - -for (var i = 0; i < files.length; i++) { - console.log(files[i].name + " has a size of " + files[i].size + " Bytes"); -}</pre> - -<h2 id="Especificações">Especificações</h2> - -<table class="standard-table"> - <tbody> - <tr> - <th scope="col">Especificação</th> - <th scope="col">Estado</th> - <th scope="col">Comentário</th> - </tr> - <tr> - <td>{{SpecName('File API', '#dfn-size', 'Blob.size')}}</td> - <td>{{Spec2('File API')}}</td> - <td>Definição inicial</td> - </tr> - </tbody> -</table> - -<h2 id="Compatibilidade">Compatibilidade</h2> - -<div> - - -<p>{{Compat("api.Blob.size")}}</p> -</div> - -<h2 id="Ver_também">Ver também</h2> - -<ul> - <li>{{domxref("Blob")}}</li> - <li><a href="/en-US/docs/Web/API/File/Using_files_from_web_applications">Usar ficheiros de aplicações web</a></li> -</ul> diff --git a/files/pt-pt/web/api/blob/type/index.html b/files/pt-pt/web/api/blob/type/index.html deleted file mode 100644 index 5744a80a5b..0000000000 --- a/files/pt-pt/web/api/blob/type/index.html +++ /dev/null @@ -1,83 +0,0 @@ ---- -title: Blob.type -slug: Web/API/Blob/type -tags: - - API - - Blob - - DOM - - File - - File API - - Formato - - MIME - - MIME Type - - Propriedade - - Referencia - - tipo -translation_of: Web/API/Blob/type ---- -<div>{{APIRef("File API")}}</div> - -<p><span class="seoSummary">A propriade <strong><code>type</code></strong> do objeto {{domxref("Blob")}} devolve o {{Glossary("MIME type")}} do ficheiro.</span></p> - -<h2 id="Sintaxe">Sintaxe</h2> - -<pre class="syntaxbox notranslate">var <em>mimetype</em> = <em>blob</em>.type</pre> - -<h3 id="Valor">Valor</h3> - -<p>Uma {{domxref("DOMString")}} que contem o MIME do ficheiro, ou uma <em>string</em> vazia se o tipo não consegue ser determinado.</p> - -<h2 id="Exemplo">Exemplo</h2> - -<p>Este exemplo pede ao utilizador que selecione uma série de ficheiros, depois verifica cada ficheiro para se certificar de que é um de um determinado conjunto de tipos de ficheiros de imagem.</p> - -<pre class="brush:js notranslate">var i, fileInput, files, allowedFileTypes; - -// fileInput é um HTMLInputElement: <input type="file" multiple id="myfileinput"> -fileInput = document.getElementById("myfileinput"); - -// files é um objeto FileList (parecido ao NodeList) -files = fileInput.files; - -// a nossa aplicação só aceita imagens GIF, PNG, e JPEG -allowedFileTypes = ["image/png", "image/jpeg", "image/gif"]; - -for (i = 0; i < files.length; i++) { - // Testar se file.type é um dos MIME types permitidos. - if (allowedFileTypes.indexOf(<strong>files[i].type</strong>) > -1) { - // file.type é válido - } -}); -</pre> - -<h2 id="Especificações">Especificações</h2> - -<table class="standard-table"> - <tbody> - <tr> - <th scope="col">Especificação</th> - <th scope="col">Estado</th> - <th scope="col">Comentário</th> - </tr> - <tr> - <td>{{SpecName('File API', '#dfn-type', 'Blob.type')}}</td> - <td>{{Spec2('File API')}}</td> - <td>Definição inicial.</td> - </tr> - </tbody> -</table> - -<h2 id="Compatibilidade">Compatibilidade</h2> - -<div> - - -<p>{{Compat("api.Blob.type")}}</p> -</div> - -<h2 id="Ver_também">Ver também</h2> - -<ul> - <li>{{domxref("Blob")}}</li> - <li><em><a href="/en-US/docs/Web/API/File/Using_files_from_web_applications">Using files from web applications</a></em></li> -</ul> |