CloudFront Functions를 위한 JavaScript 런타임 2.0 기능
CloudFront Functions JavaScript 런타임 환경은 ECMAScript(ES) 버전 5.1
핵심 기능
ES의 다음과 같은 핵심 기능이 지원됩니다.
- 유형
-
모든 ES 5.1 유형이 지원됩니다. 여기에는 부울 값, 숫자, 문자열, 객체, 배열, 함수, 정규 표현식이 포함됩니다.
- 연산자
-
모든 ES 5.1 연산자가 지원됩니다.
ES 7 거듭제곱 연산자(
**)가 지원됩니다. - Statement
-
다음 ES 5.1 문이 지원됩니다.
-
break -
catch -
continue -
do-while -
else -
finally -
for -
for-in -
if -
label -
return -
switch -
throw -
try -
var -
while
다음 ES 6 문이 지원됩니다.
-
const -
let
다음 ES 8 문이 지원됩니다.
async-
await
참고
async,await,const및let가 JavaScript 런타임 2.0에서 지원됩니다.await는async함수 내에서만 사용할 수 있습니다.async인수 및 종료는 지원되지 않습니다. -
- 리터럴
-
ES 6 템플릿 리터럴은 여러 줄 문자열, 표현식 보간 및 중첩 템플릿에 대해 지원됩니다..
- 함수
-
모든 ES 5.1 함수 기능이 지원됩니다.
ES 6 화살표 함수가 지원되며 ES 6 나머지 파라미터 구문이 지원됩니다.
- 유니코드
-
소스 텍스트 및 문자열 리터럴에는 유니코드로 인코딩된 문자가 포함될 수 있습니다. 6자의 유니코드 코드 포인트 이스케이프 시퀀스(예:
\uXXXX)도 지원됩니다. - 엄격 모드
-
함수는 기본적으로 엄격 모드에서 작동하므로 함수 코드에
use strict명령문을 추가할 필요가 없습니다. 이것은 변경할 수 없습니다.
기본 객체
ES의 다음과 같은 기본 객체가 지원됩니다.
- 객체
-
객체에 대해 다음과 같은 ES 5.1 메서드가 지원됩니다.
-
Object.create()(속성 목록 제외) -
Object.defineProperties() -
Object.defineProperty() -
Object.freeze() -
Object.getOwnPropertyDescriptor() -
Object.getOwnPropertyDescriptors() -
Object.getOwnPropertyNames() -
Object.getPrototypeOf() -
Object.isExtensible() -
Object.isFrozen() -
Object.isSealed() -
Object.keys() -
Object.preventExtensions() -
Object.seal()
객체에 대해 다음 ES 6 메서드가 지원됩니다.
-
Object.assign()
객체에 대해 다음과 같은 ES 8 메서드가 지원됩니다.
-
Object.entries() -
Object.values()
객체에 대해 다음과 같은 ES 5.1 프로토타입 메서드가 지원됩니다.
-
Object.prototype.hasOwnProperty() -
Object.prototype.isPrototypeOf() -
Object.prototype.propertyIsEnumerable() -
Object.prototype.toString() -
Object.prototype.valueOf()
객체에 대해 다음과 같은 ES 6 프로토타입 메서드가 지원됩니다.
-
Object.prototype.is() -
Object.prototype.setPrototypeOf()
-
- String
-
문자열에 대해 다음 ES 5.1 메서드가 지원됩니다.
String.fromCharCode()
문자열에 대해 다음 ES 6 메서드가 지원됩니다.
String.fromCodePoint()
문자열에 대해 다음 ES 5.1 프로토타입 메서드가 지원됩니다.
-
String.prototype.charAt() -
String.prototype.concat() -
String.prototype.indexOf() -
String.prototype.lastIndexOf() -
String.prototype.match() -
String.prototype.replace() -
String.prototype.search() -
String.prototype.slice() -
String.prototype.split() -
String.prototype.substr() -
String.prototype.substring() -
String.prototype.toLowerCase() -
String.prototype.trim() -
String.prototype.toUpperCase()
문자열에 대해 다음 ES 6 프로토타입 메서드가 지원됩니다.
-
String.prototype.codePointAt() -
String.prototype.endsWith() -
String.prototype.includes() -
String.prototype.repeat() -
String.prototype.startsWith()
문자열에 대해 다음 ES 8 프로토타입 메서드가 지원됩니다.
-
String.prototype.padStart() -
String.prototype.padEnd()
문자열에 대해 다음 ES 9 프로토타입 메서드가 지원됩니다.
-
String.prototype.trimStart() -
String.prototype.trimEnd()
문자열에 대해 다음 ES 12 프로토타입 메서드가 지원됩니다.
String.prototype.replaceAll()참고
String.prototype.replaceAll()이 JavaScript 런타임 2.0에 새로 추가되었습니다.
- 숫자
-
모든 ES 5.1 숫자가 지원됩니다.
숫자에 대해 다음 ES 6 속성이 지원됩니다.
Number.EPSILON-
Number.MAX_SAFE_INTEGER -
Number.MIN_SAFE_INTEGER -
Number.MAX_VALUE -
Number.MIN_VALUE -
Number.NaN -
Number.NEGATIVE_INFINITY -
Number.POSITIVE_INFINITY
숫자에 대해 다음 ES 6 메서드가 지원됩니다.
-
Number.isFinite() -
Number.isInteger() -
Number.isNaN() -
Number.isSafeInteger() -
Number.parseInt() -
Number.parseFloat()
숫자에 대해 다음 ES 5.1 프로토타입 메서드가 지원됩니다.
-
Number.prototype.toExponential() -
Number.prototype.toFixed() -
Number.prototype.toPrecision()
ES 12 숫자 구분자가 지원됩니다.
참고
ES 12 숫자 구분자가 JavaScript 런타임 2.0에 새로 추가되었습니다.
기본 제공 객체
ES의 다음 내장 객체가 지원됩니다.
- 수학 연산
-
모든 ES 5.1 수학 메서드가 지원됩니다.
참고
CloudFront 함수 런타임 환경에서
Math.random()구현은 함수가 실행될 때의 타임스탬프와 함께 시드된 OpenBSDarc4random을(를) 사용합니다.다음 ES 6 수학 속성이 지원됩니다.
-
Math.E -
Math.LN10 -
Math.LN2 -
Math.LOG10E -
Math.LOG2E -
Math.PI -
Math.SQRT1_2 -
Math.SQRT2
다음 ES 6 수학 메서드가 지원됩니다.
-
Math.abs() -
Math.acos() -
Math.acosh() -
Math.asin() -
Math.asinh() -
Math.atan() -
Math.atan2() -
Math.atanh() -
Math.cbrt() -
Math.ceil() -
Math.clz32() -
Math.cos() -
Math.cosh() -
Math.exp() -
Math.expm1() -
Math.floor() -
Math.fround() -
Math.hypot() -
Math.imul() -
Math.log() -
Math.log1p() -
Math.log2() -
Math.log10() -
Math.max() -
Math.min() -
Math.pow() -
Math.random() -
Math.round() -
Math.sign() -
Math.sinh() -
Math.sin() -
Math.sqrt() -
Math.tan() -
Math.tanh() -
Math.trunc()
-
- 날짜
-
모든 ES 5.1
Date기능이 지원됩니다.참고
보안상의 이유로 단일 함수 실행의 수명 동안
Date은(는) 항상 동일한 값(함수의 시작 시간)을 반환합니다. 자세한 내용은 제한된 기능 단원을 참조하세요. - 함수
-
다음 ES 5.1 프로토타입 메서드가 지원됩니다.
Function.prototype.apply()-
Function.prototype.bind() -
Function.prototype.call()
함수 생성자는 지원되지 않습니다.
- 정규식
-
모든 ES 5.1 정규 표현식 기능이 지원됩니다. 정규 표현식 언어는 Perl과 호환됩니다.
다음 ES 5.1 프로토타입 접근자 속성이 지원됩니다.
-
RegExp.prototype.global -
RegExp.prototype.ignoreCase -
RegExp.protoype.multiline -
RegExp.protoype.source -
RegExp.prototype.sticky -
RegExp.prototype.flags참고
RegExp.prototype.sticky,RegExp.prototype.flags가 JavaScript 런타임 2.0에 새로 추가되었습니다.
다음 ES 5.1 프로토타입 메서드가 지원됩니다.
-
RegExp.prototype.exec() -
RegExp.prototype.test() -
RegExp.prototype.toString() -
RegExp.prototype[@@replace]() -
RegExp.prototype[@@split]()참고
RegExp.prototype[@@split]()이 JavaScript 런타임 2.0에 새로 추가되었습니다.
다음 ES 5.1 인스턴스 속성이 지원됩니다.
-
lastIndex
ES 9 명명된 캡처 그룹이 지원됩니다.
-
- JSON
-
다음 ES 5.1 메서드가 지원됩니다.
-
JSON.parse() -
JSON.stringify()
-
- 배열
-
배열에 대해 다음 ES 5.1 메서드가 지원됩니다.
-
Array.isArray()
배열에 대해 다음 ES 6 메서드가 지원됩니다.
-
Array.of()
다음 ES 5.1 프로토타입 메서드가 지원됩니다.
-
Array.prototype.concat() -
Array.prototype.every() -
Array.prototype.filter() -
Array.prototype.forEach() -
Array.prototype.indexOf() -
Array.prototype.join() -
Array.prototype.lastIndexOf() -
Array.prototype.map() -
Array.prototype.pop() -
Array.prototype.push() -
Array.prototype.reduce() -
Array.prototype.reduceRight() -
Array.prototype.reverse() -
Array.prototype.shift() -
Array.prototype.slice() -
Array.prototype.some() -
Array.prototype.sort() -
Array.prototype.splice() -
Array.prototype.unshift()
다음 ES 6 프로토타입 메서드가 지원됩니다.
-
Array.prototype.copyWithin() -
Array.prototype.fill() -
Array.prototype.find() -
Array.prototype.findIndex()
다음 ES 7 프로토타입 메서드가 지원됩니다.
Array.prototype.includes()
-
- 형식화된 배열
-
다음 ES 6 형식화된 배열 생성자가 지원됩니다.
-
Float32Array -
Float64Array -
Int8Array -
Int16Array -
Int32Array -
Uint8Array -
Uint8ClampedArray -
Uint16Array -
Uint32Array
다음 ES 6 메서드가 지원됩니다.
-
TypedArray.from() -
TypedArray.of()참고
TypedArray.from(),TypedArray.of()가 JavaScript 런타임 2.0에 새로 추가되었습니다.
다음 ES 6 프로토타입 메서드가 지원됩니다.
-
TypedArray.prototype.copyWithin() -
TypedArray.prototype.every() -
TypedArray.prototype.fill() -
TypedArray.prototype.filter() -
TypedArray.prototype.find() -
TypedArray.prototype.findIndex() -
TypedArray.prototype.forEach() -
TypedArray.prototype.includes() -
TypedArray.prototype.indexOf() -
TypedArray.prototype.join() -
TypedArray.prototype.lastIndexOf() -
TypedArray.prototype.map() -
TypedArray.prototype.reduce() -
TypedArray.prototype.reduceRight() -
TypedArray.prototype.reverse() -
TypedArray.prototype.some() -
TypedArray.prototype.set() -
TypedArray.prototype.slice() -
TypedArray.prototype.sort() -
TypedArray.prototype.subarray() -
TypedArray.prototype.toString()참고
TypedArray.prototype.every(),TypedArray.prototype.fill(),TypedArray.prototype.filter(),TypedArray.prototype.find(),TypedArray.prototype.findIndex(),TypedArray.prototype.forEach(),TypedArray.prototype.includes(),TypedArray.prototype.indexOf(),TypedArray.prototype.join(),TypedArray.prototype.lastIndexOf(),TypedArray.prototype.map(),TypedArray.prototype.reduce(),TypedArray.prototype.reduceRight(),TypedArray.prototype.reverse(),TypedArray.prototype.some()이 JavaScript 런타임 2.0에 새로 추가되었습니다.
-
- 배열 버퍼
-
ArrayBuffer에 대해 다음 ES 6 메서드가 지원됩니다.
-
isView()
ArrayBuffer에 대해 다음 ES 6 프로토타입 메서드가 지원됩니다.
-
ArrayBuffer.prototype.slice()
-
- Promise
-
프로미스에 대해 다음 ES 6 메서드가 지원됩니다.
-
Promise.all() -
Promise.allSettled() -
Promise.any() -
Promise.reject() -
Promise.resolve() -
Promise.race()참고
Promise.all(),Promise.allSettled(),Promise.any(),Promise.race()가 JavaScript 런타임 2.0에 새로 추가되었습니다.
프로미스에 대해 다음 ES 6 프로토타입 메서드가 지원됩니다.
-
Promise.prototype.catch() -
Promise.prototype.finally() -
Promise.prototype.then()
-
- DataView
-
다음 ES 6 프로토타입 메서드가 지원됩니다.
-
DataView.prototype.getFloat32() -
DataView.prototype.getFloat64() -
DataView.prototype.getInt16() -
DataView.prototype.getInt32() -
DataView.prototype.getInt8() -
DataView.prototype.getUint16() -
DataView.prototype.getUint32() -
DataView.prototype.getUint8() -
DataView.prototype.setFloat32() -
DataView.prototype.setFloat64() -
DataView.prototype.setInt16() -
DataView.prototype.setInt32() -
DataView.prototype.setInt8() -
DataView.prototype.setUint16() -
DataView.prototype.setUint32() -
DataView.prototype.setUint8()참고
모든 Dataview ES 6 프로토타입 메서드가 JavaScript 런타임 2.0에 새로 추가되었습니다.
-
- Symbol
-
다음 ES 6 메서드가 지원됩니다.
-
Symbol.for() -
Symbol.keyfor()참고
모든 Symbol ES 6 메서드가 JavaScript 런타임 2.0에 새로 추가되었습니다.
-
- 텍스트 디코더
-
다음 프로토타입 메서드가 지원됩니다.
-
TextDecoder.prototype.decode()
다음 프로토타입 접근자 속성이 지원됩니다.
-
TextDecoder.prototype.encoding -
TextDecoder.prototype.fatal -
TextDecoder.prototype.ignoreBOM
-
- 텍스트 인코더
-
다음 프로토타입 메서드가 지원됩니다.
-
TextEncoder.prototype.encode() -
TextEncoder.prototype.encodeInto()
-
오류 유형
다음과 같은 오류 객체가 지원됩니다.
-
Error -
EvalError -
InternalError -
RangeError -
ReferenceError -
SyntaxError -
TypeError -
URIError
Globals
globalThis 객체가 지원됩니다.
다음 ES 5.1 전역 함수가 지원됩니다.
-
decodeURI() -
decodeURIComponent() -
encodeURI() -
encodeURIComponent() -
isFinite() -
isNaN() -
parseFloat() -
parseInt()
다음 ES 6 전역 함수가 지원됩니다.
atob()-
btoa()참고
atob(),btoa()가 JavaScript 런타임 2.0에 새로 추가되었습니다.
다음과 같은 글로벌 제약이 지원됩니다.
-
NaN -
Infinity -
undefined -
arguments
기본 제공 모듈
다음 기본 제공 모듈이 지원됩니다.
Buffer
이 모듈은 다음과 같은 메서드를 제공합니다.
-
Buffer.alloc(size[, fill[, encoding]])Buffer를 할당합니다.-
size: 버퍼 크기입니다. 정수를 입력합니다. -
fill: 선택 사항입니다. 문자열,Buffer, Uint8Array 또는 정수를 입력합니다. 기본값은0입니다. -
encoding: 선택 사항입니다.fill가 문자열인 경우utf8,hex,base64,base64url중 하나를 입력합니다. 기본값은utf8입니다.
-
-
Buffer.allocUnsafe(size)초기화되지 않은
Buffer값을 할당합니다.-
size: 정수를 입력합니다.
-
-
Buffer.byteLength(value[, encoding])값의 길이를 바이트 단위로 반환합니다.
-
value: 문자열,Buffer, TypedArray, Dataview 또는 Arraybuffer입니다. -
encoding: 선택 사항입니다.value가 문자열인 경우utf8,hex,base64,base64url중 하나를 입력합니다. 기본값은utf8입니다.
-
-
Buffer.compare(buffer1, buffer2)두
Buffer를 비교하면 배열을 정렬하는 데 도움이 됩니다. 두 값이 같으면0,buffer1이 먼저 오면-1,buffer2가 먼저 오면1을 반환합니다.-
buffer1:Buffer를 입력합니다. -
buffer2: 다른Buffer를 입력합니다.
-
-
Buffer.concat(list[, totalLength])여러 개의
Buffer를 연결합니다. 없으면0을 반환합니다.totalLength까지 반환합니다.-
list:Buffer목록을 입력합니다. 이 항목은totalLength기준으로 잘려서 표시된다는 점에 유의하세요. -
totalLength: 선택 사항입니다. 부호 없는 정수를 입력합니다. 비어 있는 경우 목록에 있는Buffer인스턴스의 합계를 사용하세요.
-
-
Buffer.from(array)배열에서
Buffer를 생성합니다.-
array:0에서255까지 바이트 배열을 입력합니다.
-
-
Buffer.from(arrayBuffer, byteOffset[, length]))byteOffset오프셋에서 시작하여length길이를 기준으로arrayBuffer에서 뷰를 생성합니다.-
arrayBuffer:Buffer배열을 입력합니다. -
byteOffset: 정수를 입력합니다. -
length: 선택 사항입니다. 정수를 입력합니다.
-
-
Buffer.from(buffer)Buffer의 사본을 생성합니다.-
buffer:Buffer를 입력합니다.
-
-
Buffer.from(object[, offsetOrEncoding[, length]])객체에서
Buffer를 생성합니다.valueOf()값이 객체와 동일하지 않으면Buffer.from(object.valueOf(), offsetOrEncoding, length)값을 반환합니다.-
object: 객체를 입력합니다. -
offsetOrEncoding: 선택 사항입니다. 정수 또는 인코딩 문자열을 입력합니다. -
length: 선택 사항입니다. 정수를 입력합니다.
-
-
Buffer.from(string[, encoding])문자열에서
Buffer를 생성합니다.-
string: 문자열을 입력합니다. -
encoding: 선택 사항입니다.utf8,hex,base64,base64url중 하나를 입력합니다. 기본값은utf8입니다.
-
-
Buffer.isBuffer(object)object가 버퍼인지 확인합니다.true또는false를 반환합니다.-
object: 객체를 입력합니다.
-
-
Buffer.isEncoding(encoding)encoding이 지원되는지 확인합니다.true또는false를 반환합니다.-
encoding: 선택 사항입니다.utf8,hex,base64,base64url중 하나를 입력합니다. 기본값은utf8입니다.
-
이 모듈은 다음과 같은 버퍼 프로토타입 메서드를 제공합니다.
-
Buffer.prototype.compare(target[, targetStart[, targetEnd[, sourceStart[, sourceEnd]]]])Buffer를 대상과 비교합니다. 두 값이 같으면0,buffer이 먼저 오면1,target가 먼저 오면-1을 반환합니다.-
target:Buffer를 입력합니다. -
targetStart: 선택 사항입니다. 정수를 입력합니다. 기본값은 0. -
targetEnd: 선택 사항입니다. 정수를 입력합니다. 기본값은target길이입니다. -
sourceStart: 선택 사항입니다. 정수를 입력합니다. 기본값은 0. -
sourceEnd: 선택 사항입니다. 정수를 입력합니다. 기본값은Buffer길이입니다.
-
-
Buffer.prototype.copy(target[, targetStart[, sourceStart[, sourceEnd]]])버퍼를
target으로 복사합니다.-
target:Buffer또는Uint8Array를 입력합니다. -
targetStart: 선택 사항입니다. 정수를 입력합니다. 기본값은 0. -
sourceStart: 선택 사항입니다. 정수를 입력합니다. 기본값은 0. -
sourceEnd: 선택 사항입니다. 정수를 입력합니다. 기본값은Buffer길이입니다.
-
-
Buffer.prototype.equals(otherBuffer)Buffer와otherBuffer를 비교합니다.true또는false를 반환합니다.-
otherBuffer: 문자열을 입력합니다.
-
-
Buffer.prototype.fill(value[, offset[, end][, encoding])Buffer를value로 채웁니다.-
value: 문자열,Buffer또는 정수를 입력합니다. -
offset: 선택 사항입니다. 정수를 입력합니다. -
end: 선택 사항입니다. 정수를 입력합니다. -
encoding: 선택 사항입니다.utf8,hex,base64,base64url중 하나를 입력합니다. 기본값은utf8입니다.
-
-
Buffer.prototype.includes(value[, byteOffset][, encoding])Buffer에서value를 찾습니다.true또는false를 반환합니다.-
value: 문자열,Buffer,Uint8Array또는 정수를 입력합니다. -
byteOffset: 선택 사항입니다. 정수를 입력합니다. -
encoding: 선택 사항입니다.utf8,hex,base64,base64url중 하나를 입력합니다. 기본값은utf8입니다.
-
-
Buffer.prototype.indexOf(value[, byteOffset][, encoding])Buffer에서 첫 번째value를 찾습니다. 값이 발견되면index, 발견되지 않으면-1을 반환합니다.-
value: 문자열,Buffer, Unit8Array 또는 0에서 255 사이의 정수를 입력합니다. -
byteOffset: 선택 사항입니다. 정수를 입력합니다. -
encoding: 선택 사항입니다.value가 문자열인 경우utf8,hex,base64,base64url중 하나를 입력합니다. 기본값은utf8입니다.
-
-
Buffer.prototype.lastIndexOf(value[, byteOffset][, encoding])Buffer에서 마지막value를 찾습니다. 값이 발견되면index, 발견되지 않으면-1을 반환합니다.-
value: 문자열,Buffer, Unit8Array 또는 0에서 255 사이의 정수를 입력합니다. -
byteOffset: 선택 사항입니다. 정수를 입력합니다. -
encoding: 선택 사항입니다.value가 문자열인 경우utf8,hex,base64,base64url중 하나를 입력합니다. 기본값은utf8입니다.
-
-
Buffer.prototype.readInt8(offset)Buffer의offset에서Int8을 읽습니다.-
offset: 정수를 입력합니다.
-
-
Buffer.prototype.readIntBE(offset, byteLength)Buffer의offset에서Int를 빅 엔디안으로 읽습니다.-
offset: 정수를 입력합니다. -
byteLength: 선택 사항입니다.1에서6까지의 정수를 입력합니다.
-
-
Buffer.prototype.readInt16BE(offset)Buffer의offset에서Int16을 빅 엔디안으로 읽습니다.-
offset: 정수를 입력합니다.
-
-
Buffer.prototype.readInt32BE(offset)Buffer의offset에서Int32를 빅 엔디안으로 읽습니다.-
offset: 정수를 입력합니다.
-
-
Buffer.prototype.readIntLE(offset, byteLength)Buffer의offset에서Int을 리틀 엔디안으로 읽습니다.-
offset: 정수를 입력합니다. -
byteLength:1에서6까지의 정수를 입력합니다.
-
-
Buffer.prototype.readInt16LE(offset)Buffer의offset에서Int16을 리틀 엔디안으로 읽습니다.-
offset: 정수를 입력합니다.
-
-
Buffer.prototype.readInt32LE(offset)Buffer의offset에서Int32을 리틀 엔디안으로 읽습니다.-
offset: 정수를 입력합니다.
-
-
Buffer.prototype.readUInt8(offset)Buffer의offset에서UInt8을 읽습니다.-
offset: 정수를 입력합니다.
-
-
Buffer.prototype.readUIntBE(offset, byteLength)Buffer의offset에서UInt를 빅 엔디안으로 읽습니다.-
offset: 정수를 입력합니다. -
byteLength:1에서6까지의 정수를 입력합니다.
-
-
Buffer.prototype.readUInt16BE(offset)Buffer의offset에서UInt16을 빅 엔디안으로 읽습니다. -
-
offset: 정수를 입력합니다.
-
-
Buffer.prototype.readUInt32BE(offset)Buffer의offset에서UInt32를 빅 엔디안으로 읽습니다.-
offset: 정수를 입력합니다.
-
-
Buffer.prototype.readUIntLE(offset, byteLength)Buffer의offset에서UInt을 리틀 엔디안으로 읽습니다.-
offset: 정수를 입력합니다. -
byteLength:1에서6까지의 정수를 입력합니다.
-
-
Buffer.prototype.readUInt16LE(offset)Buffer의offset에서UInt16을 리틀 엔디안으로 읽습니다.-
offset: 정수를 입력합니다.
-
-
Buffer.prototype.readUInt32LE(offset)Buffer의offset에서UInt32을 리틀 엔디안으로 읽습니다.-
offset: 정수를 입력합니다.
-
-
Buffer.prototype.readDoubleBE([offset])Buffer의offset에서 64비트 배정도를 빅 엔디안으로 읽습니다.-
offset: 선택 사항입니다. 정수를 입력합니다.
-
-
Buffer.prototype.readDoubleLE([offset])Buffer의offset에서 64비트 배정도를 리틀 엔디안으로 읽습니다.-
offset: 선택 사항입니다. 정수를 입력합니다.
-
-
Buffer.prototype.readFloatBE([offset])Buffer의offset에서 32비트 부동소수점을 빅 엔디안으로 읽습니다.-
offset: 선택 사항입니다. 정수를 입력합니다.
-
-
Buffer.prototype.readFloatLE([offset])Buffer의offset에서 32비트 부동소수점을 리틀 엔디안으로 읽습니다.-
offset: 선택 사항입니다. 정수를 입력합니다.
-
-
Buffer.prototype.subarray([start[, end]])오프셋되고 새
start및end로 크롭된Buffer의 복사본을 반환합니다.-
start: 선택 사항입니다. 정수를 입력합니다. 기본값은 0. -
end: 선택 사항입니다. 정수를 입력합니다. 기본값은 버퍼 길이입니다.
-
-
Buffer.prototype.swap16()Buffer배열을 16비트 숫자로 구성된 배열로 취급하여 바이트 순서를 바꿉니다.Buffer길이는 2로 나눌 수 있어야 합니다. 그렇지 않으면 오류가 발생합니다. -
Buffer.prototype.swap32()Buffer배열을 32비트 숫자로 구성된 배열로 취급하여 바이트 순서를 바꿉니다.Buffer길이는 4로 나눌 수 있어야 합니다. 그렇지 않으면 오류가 발생합니다. -
Buffer.prototype.swap64()Buffer배열을 64비트 숫자로 구성된 배열로 취급하여 바이트 순서를 바꿉니다.Buffer길이는 8로 나눌 수 있어야 합니다. 그렇지 않으면 오류가 발생합니다. -
Buffer.prototype.toJSON()Buffer를 JSON으로 반환합니다. -
Buffer.prototype.toString([encoding[, start[, end]]])start에서end로, 인코딩된 문자열로Buffer를 변환합니다.-
encoding: 선택 사항입니다.utf8,hex,base64,base64url중 하나를 입력합니다. 기본값은utf8입니다. -
start: 선택 사항입니다. 정수를 입력합니다. 기본값은 0. -
end: 선택 사항입니다. 정수를 입력합니다. 기본값은 버퍼 길이입니다.
-
-
Buffer.prototype.write(string[, offset[, length]][, encoding])공간이 있는 경우 인코딩된
string을Buffer에 쓰고, 공간이 충분하지 않으면 잘라낸string을 씁니다.-
string: 문자열을 입력합니다. -
offset: 선택 사항입니다. 정수를 입력합니다. 기본값은 0. -
length: 선택 사항입니다. 정수를 입력합니다. 기본값은 문자열 길이입니다. -
encoding: 선택 사항입니다. 필요에 따라utf8,hex,base64,base64url중 하나를 입력합니다. 기본값은utf8입니다.
-
-
Buffer.prototype.writeInt8(value, offset, byteLength)offset에서byteLength의Int8value를Buffer에 씁니다.-
value: 정수를 입력합니다. -
offset: 정수를 입력합니다. -
byteLength:1에서6까지의 정수를 입력합니다.
-
-
Buffer.prototype.writeIntBE(value, offset, byteLength)빅 엔디안을 사용하여
offset에서value를Buffer에 씁니다.-
value: 정수를 입력합니다. -
offset: 정수를 입력합니다. -
byteLength:1에서6까지의 정수를 입력합니다.
-
-
Buffer.prototype.writeInt16BE(value, offset, byteLength)빅 엔디안을 사용하여
offset에서value를Buffer에 씁니다.-
value: 정수를 입력합니다. -
offset: 정수를 입력합니다. -
byteLength:1에서6까지의 정수를 입력합니다.
-
-
Buffer.prototype.writeInt32BE(value, offset, byteLength)빅 엔디안을 사용하여
offset에서value를Buffer에 씁니다.-
value: 정수를 입력합니다. -
offset: 정수를 입력합니다. -
byteLength:1에서6까지의 정수를 입력합니다.
-
-
Buffer.prototype.writeIntLE(offset, byteLength)리틀 엔디안을 사용하여
offset에서value를Buffer에 씁니다.-
offset: 정수를 입력합니다. -
byteLength:1에서6까지의 정수를 입력합니다.
-
-
Buffer.prototype.writeInt16LE(offset, byteLength)리틀 엔디안을 사용하여
offset에서value를Buffer에 씁니다.-
offset: 정수를 입력합니다. -
byteLength:1에서6까지의 정수를 입력합니다.
-
-
Buffer.prototype.writeInt32LE(offset, byteLength)리틀 엔디안을 사용하여
offset에서value를Buffer에 씁니다.-
offset: 정수를 입력합니다. -
byteLength:1에서6까지의 정수를 입력합니다.
-
-
Buffer.prototype.writeUInt8(value, offset, byteLength)offset에서byteLength의UInt8value를Buffer에 씁니다.-
value: 정수를 입력합니다. -
offset: 정수를 입력합니다. -
byteLength:1에서6까지의 정수를 입력합니다.
-
-
Buffer.prototype.writeUIntBE(value, offset, byteLength)빅 엔디안을 사용하여
offset에서value를Buffer에 씁니다.-
value: 정수를 입력합니다. -
offset: 정수를 입력합니다. -
byteLength:1에서6까지의 정수를 입력합니다.
-
-
Buffer.prototype.writeUInt16BE(value, offset, byteLength)빅 엔디안을 사용하여
offset에서value를Buffer에 씁니다.-
value: 정수를 입력합니다. -
offset: 정수를 입력합니다. -
byteLength:1에서6까지의 정수를 입력합니다.
-
-
Buffer.prototype.writeUInt32BE(value, offset, byteLength)빅 엔디안을 사용하여
offset에서value를Buffer에 씁니다.-
value: 정수를 입력합니다. -
offset: 정수를 입력합니다. -
byteLength:1에서6까지의 정수를 입력합니다.
-
-
Buffer.prototype.writeUIntLE(value, offset, byteLength)리틀 엔디안을 사용하여
offset에서value를Buffer에 씁니다.-
value: 정수를 입력합니다. -
offset: 정수를 입력합니다. -
byteLength:1에서6까지의 정수를 입력합니다.
-
-
Buffer.prototype.writeUInt16LE(value, offset, byteLength)리틀 엔디안을 사용하여
offset에서value를Buffer에 씁니다.-
value: 정수를 입력합니다. -
offset: 정수를 입력합니다. -
byteLength:1에서6까지의 정수를 입력합니다.
-
-
Buffer.prototype.writeUInt32LE(value, offset, byteLength)리틀 엔디안을 사용하여
offset에서value를Buffer에 씁니다.-
value: 정수를 입력합니다. -
offset: 정수를 입력합니다. -
byteLength:1에서6까지의 정수를 입력합니다.
-
-
Buffer.prototype.writeDoubleBE(value, [offset])빅 엔디안을 사용하여
offset에서value를Buffer에 씁니다.-
value: 정수를 입력합니다. -
offset: 선택 사항입니다. 정수를 입력합니다. 기본값은 0.
-
-
Buffer.prototype.writeDoubleLE(value, [offset])리틀 엔디안을 사용하여
offset에서value를Buffer에 씁니다.-
value: 정수를 입력합니다. -
offset: 선택 사항입니다. 정수를 입력합니다. 기본값은 0.
-
-
Buffer.prototype.writeFloatBE(value, [offset])빅 엔디안을 사용하여
offset에서value를Buffer에 씁니다.-
value: 정수를 입력합니다. -
offset: 선택 사항입니다. 정수를 입력합니다. 기본값은 0.
-
-
Buffer.prototype.writeFloatLE(value, [offset])리틀 엔디안을 사용하여
offset에서value를Buffer에 씁니다.-
value: 정수를 입력합니다. -
offset: 선택 사항입니다. 정수를 입력합니다. 기본값은 0.
-
다음 인스턴스 메서드가 지원됩니다.
-
buffer[index]Buffer에index의 8진수(바이트)를 가져와 설정합니다.-
0에서255의 숫자를 가져옵니다. 또는0부터255까지의 숫자를 설정할 수도 있습니다.
-
다음 인스턴스 속성이 지원됩니다.
-
buffer버퍼의
ArrayBuffer객체를 가져옵니다. -
byteOffset버퍼의
Arraybuffer객체에 대한byteOffset을 가져옵니다. -
length버퍼 바이트 수를 가져옵니다.
참고
모든 버퍼 모듈 메서드가 JavaScript 런타임 2.0에 새로 추가되었습니다.
쿼리 문자열
참고
CloudFront 함수 이벤트 객체는 URL 쿼리 문자열을 자동으로 구문 분석합니다. 즉, 대부분의 경우 이 모듈을 사용할 필요가 없습니다.
쿼리 문자열 모듈(querystring)은 URL 쿼리 문자열을 구문 분석하고 서식을 지정하는 메서드를 제공합니다. require('querystring')을 사용하여 모듈을 로드할 수 있습니다. 이 모듈은 다음과 같은 방법을 제공합니다.
querystring.escape(string)-
지정된
string을 URL-인코딩하여 이스케이프된 쿼리 문자열을 반환합니다. 이 방법은querystring.stringify()에서 사용되며 직접 사용해서는 안 됩니다. querystring.parse(string[, separator[, equal[, options]]])-
쿼리 문자열(
string)을 구문 분석하고 객체를 반환합니다.separator파라미터는 쿼리 문자열에서 키와 값 페어를 구분하기 위한 하위 문자열입니다. 기본 설정은&입니다.equal파라미터는 쿼리 문자열에서 키와 값을 구분하기 위한 하위 문자열입니다. 기본 설정은=입니다.options파라미터는 다음 키를 가진 객체입니다.decodeURIComponent function-
쿼리 문자열에서 백분율로 인코딩된 문자를 디코딩하는 함수입니다. 기본 설정은
querystring.unescape()입니다. maxKeys number-
구문 분석할 최대 키 수입니다. 기본 설정은
1000입니다.0값을 사용하여 키 카운트 제한을 제거합니다.
기본적으로 쿼리 문자열 내의 백분율로 인코딩된 문자는 UTF-8 인코딩을 사용하는 것으로 간주됩니다. 잘못된 UTF-8 시퀀스는
U+FFFD대체 문자로 대체됩니다.예를 들어 다음 쿼리 문자열의 경우:
'name=value&abc=xyz&abc=123'querystring.parse()의 반환 값:{ name: 'value', abc: ['xyz', '123'] }querystring.decode()는querystring.parse()의 별칭입니다. querystring.stringify(object[, separator[, equal[, options]]])-
object를 직렬화하고 쿼리 문자열을 반환합니다.separator파라미터는 쿼리 문자열에서 키와 값 페어를 구분하기 위한 하위 문자열입니다. 기본 설정은&입니다.equal파라미터는 쿼리 문자열에서 키와 값을 구분하기 위한 하위 문자열입니다. 기본 설정은=입니다.options파라미터는 다음 키를 가진 객체입니다.encodeURIComponent function-
URL에 안전하지 않은 문자를 쿼리 문자열에서 백분율 인코딩으로 변환하는 데 사용할 함수입니다. 기본 설정은
querystring.escape()입니다.
기본적으로 쿼리 문자열 내에서 백분율 인코딩이 필요한 문자는 UTF-8로 인코딩됩니다. 다른 인코딩을 사용하려면
encodeURIComponent옵션을 지정합니다.예를 들어, 다음 코드의 경우:
querystring.stringify({ name: 'value', abc: ['xyz', '123'], anotherName: '' });반환 값:
'name=value&abc=xyz&abc=123&anotherName='querystring.encode()는querystring.stringify()의 별칭입니다. querystring.unescape(string)-
지정된
string의 URL 백분율로 인코딩된 문자를 디코딩하여 이스케이프되지 않은 쿼리 문자열을 반환합니다. 이 방법은querystring.parse()에서 사용되며 직접 사용해서는 안 됩니다.
crypto
암호화 모듈(crypto)은 표준 해싱 및 HMAC(해시 기반 메시지 인증 코드) 헬퍼를 제공합니다. require('crypto')을(를) 사용하여 모듈을 로드할 수 있습니다.
해싱 메서드
crypto.createHash(algorithm)-
지정된 알고리즘(
md5,sha1또는sha256)을 사용하여 해시 다이제스트를 생성하는 데 사용할 수 있는 해시 객체를 생성하고 반환합니다. hash.update(data)-
지정된
data(으)로 해시 콘텐츠를 업데이트합니다. hash.digest([encoding])-
hash.update()을(를) 사용하여 전달된 모든 데이터의 다이제스트를 계산합니다. 인코딩은hex,base64또는base64url일 수 있습니다.
HMAC 메서드
crypto.createHmac(algorithm, secret key)-
지정된
algorithm및secret key을(를) 사용하는 HMAC 객체를 생성 및 반환합니다. 알고리즘은md5,sha1또는sha256일 수 있습니다. hmac.update(data)-
지정된
data(으)로 HMAC 콘텐츠를 업데이트합니다. hmac.digest([encoding])-
hmac.update()을(를) 사용하여 전달된 모든 데이터의 다이제스트를 계산합니다. 인코딩은hex,base64또는base64url일 수 있습니다.
제한된 기능
다음 JavaScript 언어 기능은 보안 문제로 인해 지원되지 않거나 제한됩니다.
- 동적 코드 평가
-
동적 코드 평가는 지원되지 않습니다. 시도하면
eval()및Function생성자 모두 오류가 발생합니다. 예를 들어const sum = new Function('a', 'b', 'return a + b')에서 오류가 발생합니다. - 타이머
-
setTimeout(),setImmediate()및clearTimeout()함수는 지원되지 않습니다. 함수 실행 내에서 연기하거나 출력할 프로비전이 없습니다. 함수가 완료되려면 동기적으로 실행되어야 합니다. - 날짜 및 타임스탬프
-
보안상의 이유로 고해상도 타이머에 액세스할 수 없습니다. 현재 시간을 쿼리하는 모든
Date메서드는 단일 함수 실행의 수명 동안 항상 동일한 값을 반환합니다. 반환된 타임 스탬프는 함수가 실행을 시작한 시간입니다. 따라서 함수에서 경과 시간을 측정할 수 없습니다. - 파일 시스템 액세스
-
파일 시스템 액세스가 없습니다. 예를 들어 Node.js에서처럼 파일 시스템 액세스를 위한
fs모듈이 없습니다. - 프로세스 액세스
-
프로세스 액세스가 없습니다. 예를 들어 Node.js와는 달리 정보 액세스를 처리하기 위한
process글로벌 객체가 없습니다. - 환경 변수
-
환경 변수에 액세스할 수 없습니다. 대신 CloudFront KeyValueStore를 사용하여 CloudFront Functions에 대한 키 값 페어의 중앙 집중식 데이터 스토어를 생성할 수 있습니다. CloudFront KeyValueStore를 사용하면 코드 변경 사항을 배포할 필요 없이 구성 데이터를 동적으로 업데이트할 수 있습니다. 자세한 내용은 Amazon CloudFront KeyValueStore 섹션을 참조하세요.
- 네트워크 액세스
-
네트워크 통화에 대한 지원이 없습니다. 예를 들어 XHR, HTTP(S) 및 소켓은 지원되지 않습니다.