(flags, name = 'flags')
| 724 | } |
| 725 | |
| 726 | function stringToFlags(flags, name = 'flags') { |
| 727 | if (typeof flags === 'number') { |
| 728 | validateInt32(flags, name); |
| 729 | // Coerce -0 to +0. |
| 730 | return flags + 0; |
| 731 | } |
| 732 | |
| 733 | if (flags == null) { |
| 734 | return O_RDONLY; |
| 735 | } |
| 736 | |
| 737 | switch (flags) { |
| 738 | case 'r' : return O_RDONLY; |
| 739 | case 'rs' : // Fall through. |
| 740 | case 'sr' : return O_RDONLY | O_SYNC; |
| 741 | case 'r+' : return O_RDWR; |
| 742 | case 'rs+' : // Fall through. |
| 743 | case 'sr+' : return O_RDWR | O_SYNC; |
| 744 | |
| 745 | case 'w' : return O_TRUNC | O_CREAT | O_WRONLY; |
| 746 | case 'wx' : // Fall through. |
| 747 | case 'xw' : return O_TRUNC | O_CREAT | O_WRONLY | O_EXCL; |
| 748 | |
| 749 | case 'w+' : return O_TRUNC | O_CREAT | O_RDWR; |
| 750 | case 'wx+': // Fall through. |
| 751 | case 'xw+': return O_TRUNC | O_CREAT | O_RDWR | O_EXCL; |
| 752 | |
| 753 | case 'a' : return O_APPEND | O_CREAT | O_WRONLY; |
| 754 | case 'ax' : // Fall through. |
| 755 | case 'xa' : return O_APPEND | O_CREAT | O_WRONLY | O_EXCL; |
| 756 | case 'as' : // Fall through. |
| 757 | case 'sa' : return O_APPEND | O_CREAT | O_WRONLY | O_SYNC; |
| 758 | |
| 759 | case 'a+' : return O_APPEND | O_CREAT | O_RDWR; |
| 760 | case 'ax+': // Fall through. |
| 761 | case 'xa+': return O_APPEND | O_CREAT | O_RDWR | O_EXCL; |
| 762 | case 'as+': // Fall through. |
| 763 | case 'sa+': return O_APPEND | O_CREAT | O_RDWR | O_SYNC; |
| 764 | } |
| 765 | |
| 766 | throw new ERR_INVALID_ARG_VALUE('flags', flags); |
| 767 | } |
| 768 | |
| 769 | const stringToSymlinkType = hideStackFrames((type) => { |
| 770 | switch (type) { |
no outgoing calls
no test coverage detected
searching dependent graphs…