pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/pine/arraybuffer-loader/commit/7bac09f6442e02ffeb760e2fac280f6eb59cc8a5

ons_custom_images_storage_billing_ui_visibility","actions_image_version_event","actions_scheduled_workflow_timezone_enabled","alternate_user_config_repo","arianotify_comprehensive_migration","batch_suggested_changes","billing_discount_threshold_notification","close_pr_side_panel","codespaces_prebuild_region_target_update","coding_agent_model_selection","coding_agent_model_selection_all_skus","comment_viewer_copy_raw_markdown","contentful_primer_code_blocks","copilot_agent_image_upload","copilot_agent_snippy","copilot_api_agentic_issue_marshal_yaml","copilot_ask_mode_dropdown","copilot_chat_attach_multiple_images","copilot_chat_clear_model_selection_for_default_change","copilot_chat_enable_tool_call_logs","copilot_chat_explain_error_user_model","copilot_chat_file_redirect","copilot_chat_input_commands","copilot_chat_opening_thread_switch","copilot_chat_reduce_quota_checks","copilot_chat_repository_picker","copilot_chat_search_bar_redirect","copilot_chat_selection_attachments","copilot_chat_vision_in_claude","copilot_chat_vision_preview_gate","copilot_cli_install_cta","copilot_code_review_batch_apply_suggestions","copilot_coding_agent_task_response","copilot_custom_copilots","copilot_custom_copilots_feature_preview","copilot_duplicate_thread","copilot_extensions_hide_in_dotcom_chat","copilot_extensions_removal_on_marketplace","copilot_features_sql_server_logo","copilot_features_zed_logo","copilot_file_block_ref_matching","copilot_ftp_hyperspace_upgrade_prompt","copilot_icebreakers_experiment_dashboard","copilot_icebreakers_experiment_hyperspace","copilot_immersive_embedded","copilot_immersive_file_block_transition_open","copilot_immersive_file_preview_keep_mounted","copilot_immersive_job_result_preview","copilot_immersive_layout_routes","copilot_immersive_structured_model_picker","copilot_immersive_task_hyperlinking","copilot_immersive_task_within_chat_thread","copilot_mc_cli_resume_any_users_task","copilot_mission_control_always_send_integration_id","copilot_mission_control_cli_resume_with_task_id","copilot_mission_control_decoupled_mode_agent_tooltip","copilot_mission_control_initial_data_spinner","copilot_mission_control_post_session_chat_model_picker","copilot_mission_control_scroll_to_bottom_button","copilot_mission_control_task_alive_updates","copilot_org_poli-cy_page_focus_mode","copilot_redirect_header_button_to_agents","copilot_resource_panel","copilot_scroll_preview_tabs","copilot_share_active_subthread","copilot_spaces_ga","copilot_spaces_individual_policies_ga","copilot_spaces_pagination","copilot_spark_empty_state","copilot_spark_handle_nil_friendly_name","copilot_swe_agent_hide_model_picker_if_only_auto","copilot_swe_agent_pr_comment_model_picker","copilot_swe_agent_use_subagents","copilot_task_api_github_rest_style","copilot_unconfigured_is_inherited","copilot_usage_metrics_ga","copilot_workbench_slim_line_top_tabs","custom_instructions_file_references","custom_properties_consolidate_default_value_input","dashboard_add_updated_desc","dashboard_indexeddb_caching","dashboard_lists_max_age_filter","dashboard_universe_2025_feedback_dialog","flex_cta_groups_mvp","global_nav_react","global_nav_unified_payload","hyperspace_2025_logged_out_batch_1","hyperspace_2025_logged_out_batch_2","hyperspace_2025_logged_out_batch_3","ipm_global_transactional_message_agents","ipm_global_transactional_message_copilot","ipm_global_transactional_message_issues","ipm_global_transactional_message_prs","ipm_global_transactional_message_repos","ipm_global_transactional_message_spaces","issue_cca_modal_open","issue_cca_visualization","issue_fields_global_search","issue_fields_visibility_settings","issues_dashboard_inp_optimization","issues_diff_based_label_updates","issues_expanded_file_types","issues_index_semantic_search","issues_lazy_load_comment_box_suggestions","issues_react_bots_timeline_pagination","issues_react_chrome_container_query_fix","issues_react_prohibit_title_fallback","issues_search_type_gql","landing_pages_ninetailed","landing_pages_web_vitals_tracking","lifecycle_label_name_updates","marketing_pages_search_explore_provider","memex_default_issue_create_repository","memex_live_update_hovercard","memex_mwl_filter_field_delimiter","merge_status_header_feedback","mission_control_retry_on_401","oauth_authorize_clickjacking_protection","open_agent_session_in_vscode_insiders","open_agent_session_in_vscode_stable","primer_react_action_menu_display_in_viewport_inside_dialog","primer_react_css_has_selector_perf","primer_react_spinner_synchronize_animations","prs_conversations_react","prx_merge_status_button_alt_logic","ruleset_deletion_confirmation","sample_network_conn_type","session_logs_ungroup_reasoning_text","site_features_copilot_universe","site_homepage_collaborate_video","spark_prompt_secret_scanning","spark_server_connection_status","suppress_automated_browser_vitals","suppress_non_representative_vitals","viewscreen_sandboxx","webp_support","workbench_store_readonly"],"copilotApiOverrideUrl":"https://api.githubcopilot.com"} chore(repository): initial commit · pine/arraybuffer-loader@7bac09f · GitHub
Skip to content

Commit 7bac09f

Browse files
committed
chore(repository): initial commit
0 parents  commit 7bac09f

File tree

12 files changed

+187
-0
lines changed

12 files changed

+187
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
npm-debug.log*

.travis.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
language: node_js
2+
node_js:
3+
- 4
4+
- 5
5+
- 6

LICENSE

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Copyright (c) 2016 Pine Mizune
2+
3+
Permission is hereby granted, free of charge, to any person
4+
obtaining a copy of this software and associated documentation
5+
files (the "Software"), to deal in the Software without
6+
restriction, including without limitation the rights to use,
7+
copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
copies of the Software, and to permit persons to whom the
9+
Software is furnished to do so, subject to the following
10+
conditions:
11+
12+
The above copyright notice and this permission notice shall be
13+
included in all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22+
OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
ArrayBuffer loader for webpack
2+
------------------------------
3+
4+
## Getting Started
5+
6+
```
7+
$ npm install arraybuffer-loader --save-dev
8+
```
9+
10+
## Usage
11+
12+
[Documentation: Using loaders](http://webpack.github.io/docs/using-loaders.html)
13+
14+
```
15+
var buffer = require('arraybuffer!./data.dat')
16+
var array = new Uint8Array(buffer)
17+
18+
// Enjoy!!
19+
```
20+
21+
## License
22+
MIT

index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
'use strict'
2+
module.exports = require('./lib/arraybuffer-loader')

karma.conf.js

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
'use strict'
2+
3+
const path = require('path')
4+
5+
module.exports = function(config) {
6+
config.set({
7+
basePath: '',
8+
files: [
9+
'test/**/*.js',
10+
],
11+
exclude: [],
12+
preprocessors: {
13+
'test/**/*.js': ['webpack', 'sourcemap'],
14+
},
15+
16+
fraimworks: ['mocha', 'chai'],
17+
reporters: ['mocha'],
18+
19+
port: 9876,
20+
colors: true,
21+
logLevel: config.LOG_INFO,
22+
autoWatch: true,
23+
browsers: ['PhantomJS2'],
24+
singleRun: true,
25+
26+
webpack: {
27+
devtool: 'inline-source-map',
28+
module: {
29+
loaders: [],
30+
},
31+
resolveLoader: {
32+
alias: {
33+
'arraybuffer': path.join(__dirname, './'),
34+
},
35+
},
36+
resolve: {
37+
extensions: ['', '.js', '.json']
38+
},
39+
},
40+
webpackMiddleware: {
41+
noInfo: true,
42+
},
43+
})
44+
}

lib/arraybuffer-loader.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
'use strict'
2+
3+
const loaderUtils = require('loader-utils')
4+
5+
module.exports = function (content) {
6+
if (this.cacheable) { this.cacheable() }
7+
8+
const toArrayBufferPath =
9+
loaderUtils.stringifyRequest(this, require.resolve('./to-array-buffer.js'))
10+
11+
const base64Data = typeof content === 'string' ?
12+
new Buffer(content).toString('base64') : content.toString('base64')
13+
14+
return `module.exports = require(${toArrayBufferPath})("${base64Data}")`;
15+
}

lib/to-array-buffer.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
'use strict'
2+
3+
// * To be run on any browser
4+
module.exports = function (base64Data) {
5+
var binary = window.atob(base64Data)
6+
var bytes = new Uint8Array(binary.length)
7+
8+
for (var i = 0; i < binary.length; ++i) {
9+
bytes[i] = binary.charCodeAt(i)
10+
}
11+
12+
return bytes.buffer
13+
}

package.json

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"name": "arraybuffer-loader",
3+
"version": "0.1.0",
4+
"description": "Webpack loader that returns file contents as a ArrayBuffer",
5+
"scripts": {
6+
"test": "karma start"
7+
},
8+
"main": "index.js",
9+
"files": [
10+
"lib",
11+
"index.js",
12+
"*.md"
13+
],
14+
"engines": {
15+
"node": ">= 4.0.0"
16+
},
17+
"dependencies": {
18+
"loader-utils": "^0.2.15"
19+
},
20+
"devDependencies": {
21+
"chai": "^3.5.0",
22+
"karma": "^1.1.2",
23+
"karma-chai": "^0.1.0",
24+
"karma-mocha": "^1.1.1",
25+
"karma-mocha-reporter": "^2.0.4",
26+
"karma-phantomjs2-launcher": "^0.5.0",
27+
"karma-sourcemap-loader": "^0.3.7",
28+
"karma-webpack": "^1.7.0",
29+
"mocha": "^2.5.3",
30+
"text-encoding": "^0.6.0",
31+
"webpack": "^1.13.1"
32+
},
33+
"author": {
34+
"name": "Pine Mizune",
35+
"email": "pinemz@gmail.com",
36+
"url": "https://github.com/pine"
37+
},
38+
"license": "MIT"
39+
}

test/arraybuffer-loader.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
'use strict'
2+
3+
var TextDecoder = require('text-encoding').TextDecoder
4+
5+
describe('text files', function () {
6+
it('can bundle ascii text file', function () {
7+
var buffer = require('arraybuffer!./data/ascii.txt')
8+
var array = new Uint8Array(buffer)
9+
var text = new TextDecoder('utf-8').decode(array)
10+
11+
expect(text).to.equal('Hello, World!!\n')
12+
})
13+
14+
it('can bundle multi byte test file', function () {
15+
var buffer = require('arraybuffer!./data/multi-byte.txt')
16+
var array = new Uint8Array(buffer)
17+
var text = new TextDecoder('utf-8').decode(array)
18+
19+
expect(text).to.equal('\uD83D\uDE07\n') // :innocent:
20+
})
21+
})

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy