Skip to content

Commit e449e83

Browse files
committed
Complete Blob translation
1 parent 8863394 commit e449e83

File tree

1 file changed

+41
-41
lines changed

1 file changed

+41
-41
lines changed

4-binary/03-blob/article.md

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -116,87 +116,87 @@ Ancak tıklanabilir bir HTML linki bulunan önceki örnekte `URL.revokeObjectURL
116116

117117
## Blob'tan base64'e
118118

119-
An alternative to `URL.createObjectURL` is to convert a blob into a base64-encoded string.
119+
`URL.createObjectURL`'a bir alternatif de blob'u base64 olarak kodlanmış bir karakter dizisine dönüştürmek.
120120

121-
That encoding represents binary data as a string of ultra-safe "readable" characters with ASCII-codes from 0 to 64. And what's more important -- we can use this encoding in "data-urls".
121+
Bu kodlama, ikili veriyi oldukça güvenilir şekilde 0'dan 64'e ASCII kodlarından oluşan "okunabilir" karakterlerle temsil eder ve daha da önemlisi bu kodlamayı "veri URL'leri" içinde kullanabiliriz.
122122

123-
A [data url](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) has the form `data:[<mediatype>][;base64],<data>`. We can use such urls everywhere, on par with "regular" urls.
123+
Bir [veri URL'i](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) `data:[<mediatype>][;base64],<data>` formundadır. Bu tür URL'leri sıradan URL'lerle birebir aynı şekilde her yerde kullanabiliriz.
124124

125-
For instance, here's a smiley:
125+
Örneğin bu bir gülümseme ifadesi:
126126

127127
```html
128128
<img src="data:image/png;base64,R0lGODlhDAAMAKIFAF5LAP/zxAAAANyuAP/gaP///wAAAAAAACH5BAEAAAUALAAAAAAMAAwAAAMlWLPcGjDKFYi9lxKBOaGcF35DhWHamZUW0K4mAbiwWtuf0uxFAgA7">
129129
```
130130

131-
The browser will decode the string and show the image: <img src="data:image/png;base64,R0lGODlhDAAMAKIFAF5LAP/zxAAAANyuAP/gaP///wAAAAAAACH5BAEAAAUALAAAAAAMAAwAAAMlWLPcGjDKFYi9lxKBOaGcF35DhWHamZUW0K4mAbiwWtuf0uxFAgA7">
131+
Tarayıcı bu karakter dizisini çözecek ve resmi gösterecek: <img src="data:image/png;base64,R0lGODlhDAAMAKIFAF5LAP/zxAAAANyuAP/gaP///wAAAAAAACH5BAEAAAUALAAAAAAMAAwAAAMlWLPcGjDKFYi9lxKBOaGcF35DhWHamZUW0K4mAbiwWtuf0uxFAgA7">
132132

133133

134-
To transform a blob into base64, we'll use the built-in `FileReader` object. It can read data from Blobs in multiple formats. In the [next chapter](info:file) we'll cover it more in-depth.
134+
Blob'u base64'e çevirmek için `FileReader` yerleşik objesini kullanacağız. Bu, blob'lardan birçok formatta veri okuyabilmekte. [bir sonraki bölümde](info:file) bunu daha derinlemesine ele alacağız.
135135

136-
Here's the demo of downloading a blob, now via base-64:
136+
Aşağıdaki bir blob indirmenin şimdi base64 ile olan bir demosu:
137137

138138
```js run
139139
let link = document.createElement('a');
140-
link.download = 'hello.txt';
140+
link.download = 'merhaba.txt';
141141

142-
let blob = new Blob(['Hello, world!'], {type: 'text/plain'});
142+
let blob = new Blob(['Merhaba Dünya'], {type: 'text/plain'});
143143

144144
*!*
145145
let reader = new FileReader();
146-
reader.readAsDataURL(blob); // converts the blob to base64 and calls onload
146+
reader.readAsDataURL(blob); // blob'u base64'e çevirir ve onload'ı çağırır
147147
*/!*
148148

149149
reader.onload = function() {
150-
link.href = reader.result; // data url
150+
link.href = reader.result; // veri URL'i
151151
link.click();
152152
};
153153
```
154154

155-
Both ways of making an URL of a blob are usable. But usually `URL.createObjectURL(blob)` is simpler and faster.
155+
Bir blog oluşturmanın bu iki yolu da kullanılabilir ancak genellikle `URL.createObjectURL(blob)` daha basit ve hızlıdır.
156156

157-
```compare title-plus="URL.createObjectURL(blob)" title-minus="Blob to data url"
158-
+ We need to revoke them if care about memory.
159-
+ Direct access to blob, no "encoding/decoding"
160-
- No need to revoke anything.
161-
- Performance and memory losses on big blobs for encoding.
157+
```compare title-plus="URL.createObjectURL(blob)" title-minus="Blob'tan veri URL'i"
158+
+ Hafızaya önem veriyorsak kaldırmamız gerekiyor..
159+
+ Blob'a doğrudan erişim. "Kodlama/çözme" yok.
160+
- Herhangi bir şey kaldırmamız gerekmiyor.
161+
- Performans ve hafıza büyük blob'ların kodlanması için harcanır.
162162
```
163163

164-
## Image to blob
164+
## Resim'den blob'a
165165

166-
We can create a blob of an image, an image part, or even make a page screenshot. That's handy to upload it somewhere.
166+
Bir resmin blob'unu oluşturabiliriz, bir resim parçası olabilir veya sayfanın ekran görüntüsünü dahi oluşturabiliriz. Bir yerlere yükleme yapmak için oldukça kullanışlı.
167167

168-
Image operations are done via `<canvas>` element:
168+
Resim işlemleri `<canvas>` öğesi aracılığıyla yapılır:
169169

170-
1. Draw an image (or its part) on canvas using [canvas.drawImage](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/drawImage).
171-
2. Call canvas method [.toBlob(callback, format, quality)](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob) that creates a blob and runs `callback` with it when done.
170+
1. Canvas üzerinde [canvas.drawImage](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/drawImage) kullanarak bir resim çiz (veya bir parçasını).
171+
2. Canvas'ın bir blob oluşturan ve tamamlandığında `callback`ini çalıştıran [.toBlob(callback, format, quality)](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob) metodunu çağır.
172172

173-
In the example below, an image is just copied, but we could cut from it, or transform it on canvas prior to making a blob:
173+
Aşağıdaki örnekte resim henüz kopyalanmış ancak bu durumda onu kesebiliriz veya bir blob oluşturmadan önce dönüştürebiliriz:
174174

175175
```js run
176-
// take any image
176+
// bir resim al
177177
let img = document.querySelector('img');
178178

179-
// make <canvas> of the same size
179+
// aynı boyutlarda <canvas> oluştur
180180
let canvas = document.createElement('canvas');
181181
canvas.width = img.clientWidth;
182182
canvas.height = img.clientHeight;
183183

184184
let context = canvas.getContext('2d');
185185

186-
// copy image to it (this method allows to cut image)
186+
// resmi içine kopyala (bu metot resmi kesmeye izin verir)
187187
context.drawImage(img, 0, 0);
188-
// we can context.rotate(), and do many other things on canvas
188+
// context.rotate() yapabiliriz ve canvas üzerinde birçok başka işlemde bulunabiliriz
189189

190-
// toBlob is async opereation, callback is called when done
190+
// toBlob asenkron bir işlem, tamamlandığında callback çağırılacak
191191
canvas.toBlob(function(blob) {
192-
// blob ready, download it
192+
// blob hazır, indir
193193
let link = document.createElement('a');
194194
link.download = 'example.png';
195195

196196
link.href = URL.createObjectURL(blob);
197197
link.click();
198198

199-
// delete the internal blob reference, to let the browser clear memory from it
199+
// tarayıcının hafızadan temizleyebilmesi için iç blob referansını sil
200200
URL.revokeObjectURL(link.href);
201201
}, 'image/png');
202202
```
@@ -208,14 +208,14 @@ let blob = await new Promise(resolve => canvasElem.toBlob(resolve, 'image/png'))
208208

209209
For screenshotting a page, we can use a library such as <https://github.com/niklasvh/html2canvas>. What it does is just walks the page and draws it on `<canvas>`. Then we can get a blob of it the same way as above.
210210

211-
## From Blob to ArrayBuffer
211+
## Blob'tan ArrayBuffer'a
212212

213-
The `Blob` constructor allows to create a blob from almost anything, including any `BufferSource`.
213+
`Blob` kurucu metodu, herhangi bir `BufferSource` içeren neredeyse her şeyden bir blob yaratabilmeye olanak sağlar.
214214

215-
But if we need to perform low-level processing, we can get the lowest-level `ArrayBuffer` from it using `FileReader`:
215+
Yine de düşük seviye bir işleme ihtiyacımız varsa `FileReader`ı kullanarak en düşük seviyeli `ArrayBuffer`ı alabiliriz:
216216

217217
```js
218-
// get arrayBuffer from blob
218+
// blob'tan fileReader al
219219
let fileReader = new FileReader();
220220

221221
*!*
@@ -228,15 +228,15 @@ fileReader.onload = function(event) {
228228
```
229229

230230

231-
## Summary
231+
## Özet
232232

233-
While `ArrayBuffer`, `Uint8Array` and other `BufferSource` are "binary data", a [Blob](https://www.w3.org/TR/FileAPI/#dfn-Blob) represents "binary data with type".
233+
`ArrayBuffer`, `Uint8Array` ve diğer `BufferSource`lar "ikili veri"ler iken [Blob](https://www.w3.org/TR/FileAPI/#dfn-Blob) "tipi olan ikili veri"yi temsil eder.
234234

235-
That makes Blobs convenient for upload/download operations, that are so common in the browser.
235+
Bu, Blob'ları tarayıcıda çok yaygın olan indirme/yükleme işlemleri için uygun hale getirir.
236236

237-
Methods that perform web-requests, such as [XMLHttpRequest](info:xmlhttprequest), [fetch](info:fetch-basics) and so on, can work with `Blob` natively, as well as with other binary types.
237+
[XMLHttpRequest](info:xmlhttprequest), [fetch](info:fetch-basics) gibi web isteği gerçekleştiren metotlar, diğer ikili verilerle olduğu gibi `Blob` ile de doğal olarak çalışabilir.
238238

239-
We can easily convert betweeen `Blob` and low-level binary data types:
239+
`Blob` ve düşük seviye ikili veri tiplerini kolayca birbiri arasında dönüştürebiliriz:
240240

241-
- We can make a Blob from a typed array using `new Blob(...)` constructor.
242-
- We can get back `ArrayBuffer` from a Blob using `FileReader`, and then create a view over it for low-level binary processing.
241+
- `new Blob(...)` kurucu metodunu kullanarak tipli bir diziden bir blob oluşturabiliriz.
242+
- Blob'tan `ArrayBuffer`a `FileReader` kullanarak dönebiliriz ve ardından düşük seviye ikili veri işleme işlemleri için bir view oluşturabiliriz.

0 commit comments

Comments
 (0)