cdcae2d9bcf97dabbe409e8d8d18c9836b64f4fe7389a1f7859bc303c09cd426047759ff7b965151acd4dfeaf30d22f6b9a06e8aae4b842dd3f7b03baff320 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. # data-view-buffer <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
  2. [![github actions][actions-image]][actions-url]
  3. [![coverage][codecov-image]][codecov-url]
  4. [![License][license-image]][license-url]
  5. [![Downloads][downloads-image]][downloads-url]
  6. [![npm badge][npm-badge-png]][package-url]
  7. Get the ArrayBuffer out of a DataView, robustly.
  8. This will work in node <= 0.10 and < 0.11.4, where there's no prototype accessor, only a nonconfigurable own property.
  9. It will also work in modern engines where `DataView.prototype.buffer` has been deleted after this module has loaded.
  10. ## Example
  11. ```js
  12. const dataViewBuffer = require('data-view-buffer');
  13. const assert = require('assert');
  14. const ab = new ArrayBuffer(0);
  15. const dv = new DataView(ab);
  16. assert.equal(dataViewBuffer(dv), ab);
  17. ```
  18. ## Tests
  19. Simply clone the repo, `npm install`, and run `npm test`
  20. [package-url]: https://npmjs.org/package/data-view-buffer
  21. [npm-version-svg]: https://versionbadg.es/inspect-js/data-view-buffer.svg
  22. [deps-svg]: https://david-dm.org/inspect-js/data-view-buffer.svg
  23. [deps-url]: https://david-dm.org/inspect-js/data-view-buffer
  24. [dev-deps-svg]: https://david-dm.org/inspect-js/data-view-buffer/dev-status.svg
  25. [dev-deps-url]: https://david-dm.org/inspect-js/data-view-buffer#info=devDependencies
  26. [npm-badge-png]: https://nodei.co/npm/data-view-buffer.png?downloads=true&stars=true
  27. [license-image]: https://img.shields.io/npm/l/data-view-buffer.svg
  28. [license-url]: LICENSE
  29. [downloads-image]: https://img.shields.io/npm/dm/data-view-buffer.svg
  30. [downloads-url]: https://npm-stat.com/charts.html?package=data-view-buffer
  31. [codecov-image]: https://codecov.io/gh/inspect-js/data-view-buffer/branch/main/graphs/badge.svg
  32. [codecov-url]: https://app.codecov.io/gh/inspect-js/data-view-buffer/
  33. [actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/data-view-buffer
  34. [actions-url]: https://github.com/inspect-js/data-view-buffer/actions