Skip to content

Commit 6cfe135

Browse files
CobusTmbostock
andauthored
Updated readme with xml and html for FileAttachment (#252)
* updated readme with xml and html for FileAttachment * updated html example * Update README.md * Update README.md Co-authored-by: Mike Bostock <[email protected]>
1 parent 466685d commit 6cfe135

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,22 @@ Returns a promise to the file loaded as a [SQLite database client](https://obser
379379
const db = await FileAttachment("chinook.db").sqlite();
380380
```
381381

382+
<a href="#attachment_xml" name="attachment_xml">#</a> *attachment*.<b>xml</b>() [<>](https://github.com/observablehq/stdlib/blob/master/src/fileAttachment.js "Source")
383+
384+
Returns a promise to an [XMLDocument](https://developer.mozilla.org/en-US/docs/Web/API/XMLDocument) containing the contents of the file.
385+
386+
```js
387+
const document = await FileAttachment("cars.xml").xml();
388+
```
389+
390+
<a href="#attachment_html" name="attachment_html">#</a> *attachment*.<b>html</b>() [<>](https://github.com/observablehq/stdlib/blob/master/src/fileAttachment.js "Source")
391+
392+
Returns a promise to an [HTMLDocument](https://developer.mozilla.org/en-US/docs/Web/API/HTMLDocument) containing the contents of the file.
393+
394+
```js
395+
const document = await FileAttachment("index.html").html();
396+
```
397+
382398
<a href="#FileAttachments" name="FileAttachments">#</a> <b>FileAttachments</b>(<i>resolve</i>) [<>](https://github.com/observablehq/stdlib/blob/master/src/fileAttachment.js "Source")
383399

384400
*Note: this function is not part of the Observable standard library (in notebooks), but is provided by this module as a means for defining custom file attachment implementations when working directly with the Observable runtime.*

0 commit comments

Comments
 (0)